Skip to content

Commit

Permalink
fix(route/tencent): Adapt to video pages. (#15328)
Browse files Browse the repository at this point in the history
  • Loading branch information
dzx-dzx authored Apr 22, 2024
1 parent 53c514f commit f75997f
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions lib/routes/tencent/news/author.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,19 @@ async function handler(ctx) {
.text()
.match(/window\.DATA = ({.+});/)[1]
);
const $data = load(data.originContent.text, null, false);

$data('*')
.contents()
.filter((_, elem) => elem.type === 'comment')
.replaceWith((_, elem) =>
art(path.join(__dirname, '../templates/news/image.art'), {
attribute: elem.data.trim(),
originAttribute: data.originAttribute,
})
);
const $data = load(data.originContent?.text || '', null, false);
if ($data) {
// Not video page
$data('*')
.contents()
.filter((_, elem) => elem.type === 'comment')
.replaceWith((_, elem) =>
art(path.join(__dirname, '../templates/news/image.art'), {
attribute: elem.data.trim(),
originAttribute: data.originAttribute,
})
);
}

return {
title,
Expand Down

0 comments on commit f75997f

Please sign in to comment.