diff --git a/lib/v2/bloomberg/utils.js b/lib/v2/bloomberg/utils.js index 7526910324af52..40f2874bb30059 100644 --- a/lib/v2/bloomberg/utils.js +++ b/lib/v2/bloomberg/utils.js @@ -23,7 +23,7 @@ const apiEndpoints = { }, videos: { url: 'https://www.bloomberg.com/news/videos/', - sel: '.footer-container + script', + sel: 'script', }, newsletters: { url: 'https://www.bloomberg.com/news/newsletters/', @@ -153,7 +153,9 @@ const parseAudioPage = async (res, api, item) => { }; const parseVideoPage = async (res, api, item) => { - const json = cheerio.load(res.data)(api.sel).text().trim().replace('window.__PRELOADED_STATE__ = ', '').slice(0, -1); + const $ = cheerio.load(res.data); + const script = $(api.sel).filter((i, el) => $(el).text().includes('__PRELOADED_STATE__')); + const json = script.text().trim().replace('window.__PRELOADED_STATE__ = ', '').slice(0, -1); const article_json = JSON.parse(json); const video_story = article_json.video?.videoStory ?? article_json.quicktakeVideo?.videoStory; if (video_story) {