fix(route): fix radio canada by fixing regular expression to match correct data (#14630)

This commit is contained in:
LyleLee
2024-03-03 16:07:03 +08:00
committed by GitHub
parent cd6f2d982c
commit 172f6cfd2b
+3 -3
View File
@@ -31,10 +31,10 @@ export default async (ctx) => {
});
const $ = load(detailResponse.data);
const rcState = $('script:contains("window._rcState_ = JSON.parse")')
const rcState = $('script:contains("window._rcState_ = ")')
.text()
.match(/JSON\.parse\((".*")\);/)[1];
const rcStateJson = JSON.parse(JSON.parse(rcState));
.match(/window\._rcState_ = (.*);/)[1];
const rcStateJson = JSON.parse(rcState);
const news = Object.values(rcStateJson.pagesV2.pages)[0];
item.description = news.data.newsStory.body.html.replaceAll('\\n', '<br>');