mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
Hotfix: douyin video url (#1928)
- 考虑到兼容性问题,guid 仍为旧的地址链接,link 和 description 中已换成新链接 - Closes #1921
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
const cheerio = require('cheerio');
|
||||
const { formatItem } = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const id = ctx.params.id;
|
||||
@@ -49,23 +50,6 @@ module.exports = async (ctx) => {
|
||||
title: `${data.name}的抖音-喜欢的视频`,
|
||||
link: `https://www.douyin.com/share/user/${id}`,
|
||||
description: data.description,
|
||||
item:
|
||||
data.list &&
|
||||
data.list.aweme_list.map((item) => ({
|
||||
title: item.desc,
|
||||
description: `
|
||||
<p>${item.desc}</p>
|
||||
<p><a href="https://www.amemv.com/redirect/?redirect_url=aweme%3A%2F%2Faweme%2Fdetail%2F${item.aweme_id}%3Frefer%3Dweb%26gd_label%3Dclick_wap_profile_feature%26appParam%3D%26needlaunchlog%3D1">APP 内打开</a></p>
|
||||
<p>
|
||||
<video
|
||||
controls="controls"
|
||||
width="${item.video.width}"
|
||||
height="${item.video.height}"
|
||||
poster="${item.video.cover.url_list[0]}"
|
||||
src="${item.video.play_addr.url_list[0]}"
|
||||
>
|
||||
</p>`,
|
||||
link: item.video.play_addr.url_list[0],
|
||||
})),
|
||||
item: data.list && data.list.aweme_list.map(formatItem),
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
const cheerio = require('cheerio');
|
||||
const { formatItem } = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const id = ctx.params.id;
|
||||
@@ -49,23 +50,6 @@ module.exports = async (ctx) => {
|
||||
title: `${data.name}的抖音`,
|
||||
link: `https://www.douyin.com/share/user/${id}`,
|
||||
description: data.description,
|
||||
item:
|
||||
data.list &&
|
||||
data.list.aweme_list.map((item) => ({
|
||||
title: item.desc,
|
||||
description: `
|
||||
<p>${item.desc}</p>
|
||||
<p><a href="https://www.amemv.com/redirect/?redirect_url=aweme%3A%2F%2Faweme%2Fdetail%2F${item.aweme_id}%3Frefer%3Dweb%26gd_label%3Dclick_wap_profile_feature%26appParam%3D%26needlaunchlog%3D1">APP 内打开</a></p>
|
||||
<p>
|
||||
<video
|
||||
controls="controls"
|
||||
width="${item.video.width}"
|
||||
height="${item.video.height}"
|
||||
poster="${item.video.cover.url_list[0]}"
|
||||
src="${item.video.play_addr.url_list[0]}"
|
||||
>
|
||||
</p>`,
|
||||
link: item.video.play_addr.url_list[0],
|
||||
})),
|
||||
item: data.list && data.list.aweme_list.map(formatItem),
|
||||
};
|
||||
};
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
const formatVideoUrl = (url) => url.replace('/play/', '/playwm/');
|
||||
|
||||
const formatItem = (item) => {
|
||||
const originVideoUrl = item.video.play_addr.url_list[0];
|
||||
const formatedVideoUrl = formatVideoUrl(originVideoUrl);
|
||||
|
||||
return {
|
||||
title: item.desc,
|
||||
description: `
|
||||
<p>${item.desc}</p>
|
||||
<p><a href="https://www.amemv.com/redirect/?redirect_url=aweme%3A%2F%2Faweme%2Fdetail%2F${item.aweme_id}%3Frefer%3Dweb%26gd_label%3Dclick_wap_profile_feature%26appParam%3D%26needlaunchlog%3D1">APP 内打开</a></p>
|
||||
<p>
|
||||
<video
|
||||
controls="controls"
|
||||
width="${item.video.width}"
|
||||
height="${item.video.height}"
|
||||
poster="${item.video.cover.url_list[0]}"
|
||||
src="${formatedVideoUrl}"
|
||||
>
|
||||
</p>`,
|
||||
link: formatedVideoUrl,
|
||||
guid: originVideoUrl,
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
formatItem,
|
||||
};
|
||||
Reference in New Issue
Block a user