為什么我的videos的信息獲取不到?
function?filterChapters(html){ ????var?$?=cheerio.load(html); ????var?chapters?=?$('.chapter-active'); ????var?title?=$('.path?span').text(); ????var?number?=?parseInt($('.js-learn-num').text().trim(),10); ???? ????var?courseData?={ ????????title:title, ????????number:number, ????????videos:[] ???????? ????}; ???? ????chapters.each(function(item){ ????????var?chapter?=$(this); ????????var?temp?=chapter.find('strong'); ????????var?chapterTitles?=[]; ????????temp.contents().each(function(){ ????????????if(this.nodeType?===?3){ ????????????????chapterTitles.push(this.wholeText); ????????????} ????????});? ????????var?chapterTitle?=??chapterTitles[1]; ????????var?videos?=?chapter.find('video').children('li'); ????????var?chapterData?=?{ ????????????chapterTitle:chapterTitle, ????????????videos:[] ????????} ????????videos.each(function(item){ ????????????var?video?=$(this); ????????????var?videotemp?=?$(this).find('a').contents(); ????????????var?videoTitle?=''; ????????????videotemp.each(function(){ ????????????????if(this.nodeType?===?3){ ????????????????????videoTitle?=?this.wholeText; ????????????????} ????????????}) ????????????var?id?=?video.$('a').attr('href').split('video/')[1]; ????????????chapterData.videos.push({ ????????????????title:videoTitle, ????????????????id:id ????????????}) ????????}) ????????courseData.videos.push(chapterData); ????}) ????return?courseData; }
不知道哪里出問題了,就是videos.each循環這個不執行,獲取不到video標簽里的信息