diff --git a/lib/routes/huxiu/utils.js b/lib/routes/huxiu/utils.js index 608b60210..f6256b413 100644 --- a/lib/routes/huxiu/utils.js +++ b/lib/routes/huxiu/utils.js @@ -15,6 +15,14 @@ const ProcessFeed = async (list, cache) => { const $ = cheerio.load(response.data); + const __INITIAL_STATE__ = Function( + 'let window={};' + + $('*') + .html() + .match(/window\.__INITIAL_STATE__.*};/gm)[0] + + 'return window.__INITIAL_STATE__' + )(); + $('.article__content') .find('.lazyImg') .each((i, e) => { @@ -34,9 +42,8 @@ const ProcessFeed = async (list, cache) => { let description = ''; - const videoMatch = response.data.match(/"hd_link":"(.*)"/); - if (videoMatch !== null) { - description += ``; + if ('video_info' in __INITIAL_STATE__.articleDetail.articleDetail) { + description += ``; } if ($('.top-img').html() !== null) { description += $('.top-img').html();