mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
fix(route/tencent): Circumvent video type link. (#14302)
* fix(route/tencent): Circumvent video type link. * .
This commit is contained in:
@@ -24,34 +24,42 @@ module.exports = async (ctx) => {
|
||||
const author = item.source;
|
||||
const abstract = item.abstract;
|
||||
|
||||
return ctx.cache.tryGet(itemUrl, async () => {
|
||||
const response = await got(itemUrl);
|
||||
const $ = cheerio.load(response.data);
|
||||
const data = JSON.parse(
|
||||
$('script:contains("window.DATA")')
|
||||
.text()
|
||||
.match(/window\.DATA = ({.+});/)[1]
|
||||
);
|
||||
const $data = cheerio.load(data.originContent.text, null, false);
|
||||
return item.articletype === '4'
|
||||
? {
|
||||
title,
|
||||
description: abstract,
|
||||
link: itemUrl,
|
||||
author,
|
||||
pubDate,
|
||||
}
|
||||
: ctx.cache.tryGet(itemUrl, async () => {
|
||||
const response = await got(itemUrl);
|
||||
const $ = cheerio.load(response.data);
|
||||
const data = JSON.parse(
|
||||
$('script:contains("window.DATA")')
|
||||
.text()
|
||||
.match(/window\.DATA = ({.+});/)[1]
|
||||
);
|
||||
const $data = cheerio.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,
|
||||
})
|
||||
);
|
||||
$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,
|
||||
description: $data.html() || abstract,
|
||||
link: itemUrl,
|
||||
author,
|
||||
pubDate,
|
||||
};
|
||||
});
|
||||
return {
|
||||
title,
|
||||
description: $data.html() || abstract,
|
||||
link: itemUrl,
|
||||
author,
|
||||
pubDate,
|
||||
};
|
||||
});
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user