feat: remove toutiao
This commit is contained in:
parent
490c184389
commit
94bd686be7
|
|
@ -540,16 +540,6 @@ GitHub 官方也提供了一些 RSS:
|
|||
|
||||
<Route author="qiwihui" example="/juejin/shares/56852b2460b2a099cdc1d133" path="/juejin/shares/:userId" :paramsDesc="['用户 id, 可在用户页 URL 中找到']"/>
|
||||
|
||||
## 开发者头条
|
||||
|
||||
### 今天头条
|
||||
|
||||
<Route author="jjeejj" example="/toutiao/today" path="/toutiao/today"/>
|
||||
|
||||
### 独家号
|
||||
|
||||
<Route author="jjeejj" example="/toutiao/user/140544" path="/toutiao/user/:id" :paramsDesc="['独家号 id, 可在对应独家号页 URL 中找到']"/>
|
||||
|
||||
## 开源中国
|
||||
|
||||
### 资讯
|
||||
|
|
|
|||
|
|
@ -203,10 +203,6 @@ router.get('/dapenti/subject/:id', lazyloadRouteHandler('./routes/dapenti/subjec
|
|||
// Dockone
|
||||
router.get('/dockone/weekly', lazyloadRouteHandler('./routes/dockone/weekly'));
|
||||
|
||||
// 开发者头条
|
||||
router.get('/toutiao/today', lazyloadRouteHandler('./routes/toutiao/today'));
|
||||
router.get('/toutiao/user/:id', lazyloadRouteHandler('./routes/toutiao/user'));
|
||||
|
||||
// 众成翻译
|
||||
router.get('/zcfy', lazyloadRouteHandler('./routes/zcfy/index'));
|
||||
router.get('/zcfy/index', lazyloadRouteHandler('./routes/zcfy/index')); // 废弃
|
||||
|
|
|
|||
|
|
@ -1,32 +0,0 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
const baseUrl = 'https://toutiao.io';
|
||||
module.exports = async (ctx) => {
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: baseUrl,
|
||||
headers: {
|
||||
Host: 'toutiao.io',
|
||||
},
|
||||
responseType: 'text',
|
||||
});
|
||||
const $ = cheerio.load(response.data);
|
||||
const title = $('#daily').find('.date>span').eq(0).text() + ' ' + $('#daily').find('.date>small').eq(0).text();
|
||||
|
||||
const list = $('.posts>.post', '#daily');
|
||||
const article_item = [];
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
const article_el = $(list[i]).find('.content').eq(0);
|
||||
const item = {
|
||||
title: article_el.find('a').eq(0).text(),
|
||||
link: baseUrl + article_el.find('a').eq(0).attr('href'),
|
||||
};
|
||||
article_item.push(item);
|
||||
}
|
||||
ctx.state.data = {
|
||||
title: '开发者头条:' + title,
|
||||
link: baseUrl,
|
||||
item: article_item,
|
||||
};
|
||||
};
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
const baseUrl = 'https://toutiao.io';
|
||||
module.exports = async (ctx) => {
|
||||
const id = ctx.params.id;
|
||||
const requestUrl = `${baseUrl}/subjects/${id}?f=new`;
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: requestUrl,
|
||||
headers: {
|
||||
Host: 'toutiao.io',
|
||||
},
|
||||
responseType: 'text',
|
||||
});
|
||||
const $ = cheerio.load(response.data);
|
||||
const image = $('#main').find('.text-center>.subject-cover>img').eq(0).attr('src');
|
||||
const title = $('#main').find('.text-center>h3').eq(0).text();
|
||||
const description = $('#main').find('.social-share-button').eq(0).attr('data-title');
|
||||
|
||||
const list = $('.posts>.post', '#main');
|
||||
const article_item = [];
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
const article_el = $(list[i]).find('.content').eq(0);
|
||||
const item = {
|
||||
title: article_el.find('a').eq(0).text(),
|
||||
link: baseUrl + article_el.find('a').eq(0).attr('href'),
|
||||
};
|
||||
article_item.push(item);
|
||||
}
|
||||
ctx.state.data = {
|
||||
title: '开发者头条独家号:' + title,
|
||||
description,
|
||||
image,
|
||||
link: baseUrl,
|
||||
item: article_item,
|
||||
};
|
||||
};
|
||||
Loading…
Reference in New Issue