mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-11 15:47:48 +08:00
feat: fix tencent->video 更多链接支持 (#4563)
This commit is contained in:
@@ -6,15 +6,36 @@ module.exports = async (ctx) => {
|
||||
const link = `https://v.qq.com/detail/${id[0]}/${id}.html`;
|
||||
const page = await got.get(link);
|
||||
const $ = cheerio.load(page.data);
|
||||
const episodes = await got.get(`https://s.video.qq.com/get_playsource?id=${id}&plat=2&type=4&data_type=2&video_type=3&range=1&plname=qq&otype=json&num_mod_cnt=20&callback=a&_t=${Date.now()}`);
|
||||
const playList = JSON.parse(episodes.data.slice(2, -1)).PlaylistItem.videoPlayList;
|
||||
const items = playList.map((video) => ({
|
||||
title: video.title,
|
||||
link: video.playUrl,
|
||||
description: `
|
||||
<iframe frameborder="0" src="https://v.qq.com/txp/iframe/player.html?vid=${video.id}" allowFullScreen="true"></iframe>
|
||||
`,
|
||||
}));
|
||||
|
||||
let vtype = 4;
|
||||
// 支持地址 https://v.qq.com/detail/8/84842.html
|
||||
let items = null;
|
||||
if (`${id[0]}` === '8') {
|
||||
vtype = 1;
|
||||
const episodes = await got.get(`https://s.video.qq.com/get_playsource?id=${id}&plat=2&type=${vtype}&data_type=2&video_type=3&range=1&plname=qq&otype=json&num_mod_cnt=20&callback=a&_t=${Date.now()}`);
|
||||
const playList = JSON.parse(episodes.data.slice(2, -1)).playlist[0].videoPlayList;
|
||||
items = playList.map(function (video) {
|
||||
const video_id = video.playUrl.split('=')[1];
|
||||
const info = {
|
||||
title: video.title,
|
||||
link: video.playUrl,
|
||||
description: `
|
||||
<iframe src="https://v.qq.com/txp/iframe/player.html?vid=${video_id}" allowFullScreen="true" width="640" height="430"></iframe>
|
||||
`,
|
||||
};
|
||||
return info;
|
||||
});
|
||||
} else {
|
||||
const episodes = await got.get(`https://s.video.qq.com/get_playsource?id=${id}&plat=2&type=${vtype}&data_type=2&video_type=3&range=1&plname=qq&otype=json&num_mod_cnt=20&callback=a&_t=${Date.now()}`);
|
||||
const playList = JSON.parse(episodes.data.slice(2, -1)).PlaylistItem.videoPlayList;
|
||||
items = playList.map((video) => ({
|
||||
title: video.title,
|
||||
link: video.playUrl,
|
||||
description: `
|
||||
<iframe src="https://v.qq.com/txp/iframe/player.html?vid=${video.id}" allowFullScreen="true" width="640" height="430"></iframe>
|
||||
`,
|
||||
}));
|
||||
}
|
||||
|
||||
ctx.state.data = {
|
||||
title: $('title').text(),
|
||||
|
||||
Reference in New Issue
Block a user