Skip to content

Commit

Permalink
fix(route): fix radio canada by fixing regular expression to match co…
Browse files Browse the repository at this point in the history
…rrect data (#14630)
  • Loading branch information
LyleLee authored Mar 3, 2024
1 parent cd6f2d9 commit 172f6cf
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/routes/radio-canada/latest.js
Original file line number Diff line number Diff line change
Expand Up @@ -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>');

Expand Down

0 comments on commit 172f6cf

Please sign in to comment.