mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-19 09:52:21 +08:00
feat: remove douyin, close #3977
This commit is contained in:
@@ -339,10 +339,6 @@ pageClass: routes
|
||||
|
||||
<Route author="imgss" example="/dytt" path="/dytt" supportBT="1"/>
|
||||
|
||||
## 抖音
|
||||
|
||||
见 [#抖音](/social-media.html#dou-yin)
|
||||
|
||||
## 高清电台
|
||||
|
||||
### 最新电影
|
||||
|
||||
@@ -610,16 +610,6 @@ Tiny Tiny RSS 会给所有 iframe 元素添加 `sandbox="allow-scripts"` 属性
|
||||
|
||||
</Route>
|
||||
|
||||
## 抖音
|
||||
|
||||
### 用户动态
|
||||
|
||||
<Route author="DIYgod" example="/douyin/user/93610979153" path="/douyin/user/:id" :paramsDesc="['用户 id, 可在 分享出去获得的用户主页 URL 中找到']"/>
|
||||
|
||||
### 喜欢的视频
|
||||
|
||||
<Route author="xyqfer" example="/douyin/like/93610979153" path="/douyin/like/:id" :paramsDesc="['用户 id, 可在 分享出去获得的用户主页 URL 中找到']"/>
|
||||
|
||||
## 饭否
|
||||
|
||||
::: warning 注意
|
||||
|
||||
@@ -768,10 +768,6 @@ router.get('/ipsw/index/:ptype/:pname', require('./routes/ipsw/index'));
|
||||
// Minecraft CurseForge
|
||||
router.get('/curseforge/files/:project', require('./routes/curseforge/files'));
|
||||
|
||||
// 抖音
|
||||
router.get('/douyin/user/:id', require('./routes/douyin/user'));
|
||||
router.get('/douyin/like/:id', require('./routes/douyin/like'));
|
||||
|
||||
// 少数派 sspai
|
||||
router.get('/sspai/series', require('./routes/sspai/series'));
|
||||
router.get('/sspai/shortcuts', require('./routes/sspai/shortcutsGallery'));
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
const cheerio = require('cheerio');
|
||||
const { formatItem } = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const id = ctx.params.id;
|
||||
const browser = await require('@/utils/puppeteer')();
|
||||
const page = await browser.newPage();
|
||||
|
||||
const timerPromise = new Promise((resolve) => setTimeout(resolve, 1000));
|
||||
await timerPromise;
|
||||
|
||||
const data = await new Promise((resolve) => {
|
||||
const result = {
|
||||
name: null,
|
||||
description: null,
|
||||
list: null,
|
||||
};
|
||||
|
||||
page.goto(`https://www.iesdouyin.com/share/user/${id}`)
|
||||
.then(() => {
|
||||
page.click('.like-tab').catch(() => {});
|
||||
})
|
||||
.catch(() => {});
|
||||
|
||||
page.on('response', (response) => {
|
||||
const req = response.request();
|
||||
if (req.url().match(`www.iesdouyin.com/share/user/${id}`)) {
|
||||
response.text().then((text) => {
|
||||
const $ = cheerio.load(text);
|
||||
result.name = $('.nickname').text();
|
||||
result.description = $('.signature').text();
|
||||
if (result.list) {
|
||||
resolve(result);
|
||||
browser.close();
|
||||
}
|
||||
});
|
||||
} else if (req.url().match('www.iesdouyin.com/web/api/v2/aweme/like')) {
|
||||
response.json().then((data) => {
|
||||
result.list = data;
|
||||
if (result.name) {
|
||||
resolve(result);
|
||||
browser.close();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
ctx.state.data = {
|
||||
title: `${data.name}的抖音-喜欢的视频`,
|
||||
link: `https://www.iesdouyin.com/share/user/${id}`,
|
||||
description: data.description,
|
||||
item: data.list && data.list.aweme_list.map(formatItem),
|
||||
};
|
||||
};
|
||||
@@ -1,55 +0,0 @@
|
||||
const cheerio = require('cheerio');
|
||||
const { formatItem } = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const id = ctx.params.id;
|
||||
const browser = await require('@/utils/puppeteer')();
|
||||
const page = await browser.newPage();
|
||||
|
||||
const timerPromise = new Promise((resolve) => setTimeout(resolve, 1000));
|
||||
await timerPromise;
|
||||
|
||||
const data = await new Promise((resolve) => {
|
||||
const result = {
|
||||
name: null,
|
||||
description: null,
|
||||
list: null,
|
||||
};
|
||||
|
||||
page.goto(`https://www.iesdouyin.com/share/user/${id}`)
|
||||
.then(() => {
|
||||
page.click('.user-tab').catch(() => {});
|
||||
})
|
||||
.catch(() => {});
|
||||
|
||||
page.on('response', (response) => {
|
||||
const req = response.request();
|
||||
if (req.url().match(`www.iesdouyin.com/share/user/${id}`)) {
|
||||
response.text().then((text) => {
|
||||
const $ = cheerio.load(text);
|
||||
result.name = $('.nickname').text();
|
||||
result.description = $('.signature').text();
|
||||
if (result.list) {
|
||||
resolve(result);
|
||||
browser.close();
|
||||
}
|
||||
});
|
||||
} else if (req.url().match('www.iesdouyin.com/web/api/v2/aweme/post')) {
|
||||
response.json().then((data) => {
|
||||
result.list = data;
|
||||
if (result.name) {
|
||||
resolve(result);
|
||||
browser.close();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
ctx.state.data = {
|
||||
title: `${data.name}的抖音`,
|
||||
link: `https://www.iesdouyin.com/share/user/${id}`,
|
||||
description: data.description,
|
||||
item: data.list && data.list.aweme_list.map(formatItem),
|
||||
};
|
||||
};
|
||||
@@ -1,59 +0,0 @@
|
||||
const formatItem = (item) => {
|
||||
const formatVideoUrl = (url) => url.replace('/play/', '/playwm/');
|
||||
const appLink = `https://www.amemv.com/redirect/?redirect_url=snssdk1128%3A%2F%2Faweme%2Fdetail%2F${item.aweme_id}%3Frefer%3Dweb%26gd_label%3Dclick_wap_profile_feature%26appParam%3D%26needlaunchlog%3D1`;
|
||||
let content = '';
|
||||
let link = '';
|
||||
let guid = '';
|
||||
|
||||
switch (item.aweme_type) {
|
||||
case 2:
|
||||
// 图片
|
||||
content = item.image_infos.reduce((acc, item) => {
|
||||
const imgUrl = item.label_large.url_list[0].replace('.webp', '.png');
|
||||
acc += `
|
||||
<img src="${imgUrl}"><br>
|
||||
`;
|
||||
return acc;
|
||||
}, '');
|
||||
link = guid = appLink;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
// 视频
|
||||
/* eslint-disable no-case-declarations */
|
||||
const originVideoUrl = item.video.play_addr.url_list[0];
|
||||
const formatedVideoUrl = formatVideoUrl(originVideoUrl);
|
||||
content = `
|
||||
<video
|
||||
controls="controls"
|
||||
width="${item.video.width}"
|
||||
height="${item.video.height}"
|
||||
poster="${item.video.cover.url_list[0]}"
|
||||
src="${formatedVideoUrl}"
|
||||
>
|
||||
`;
|
||||
link = formatedVideoUrl;
|
||||
guid = originVideoUrl;
|
||||
break;
|
||||
|
||||
default:
|
||||
content = '未知类型,请点击<a href="https://github.com/DIYgod/RSSHub/issues">链接</a>提交issue';
|
||||
link = guid = appLink;
|
||||
}
|
||||
|
||||
return {
|
||||
title: item.desc,
|
||||
description: `
|
||||
<p>${item.desc}</p>
|
||||
<p><a href="${appLink}">APP 内打开</a></p>
|
||||
<p>
|
||||
${content}
|
||||
</p>`,
|
||||
link,
|
||||
guid,
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
formatItem,
|
||||
};
|
||||
Reference in New Issue
Block a user