mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
fix(route): bloomberg videopage parse error (#11688)
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user