diff --git a/docs/programming.md b/docs/programming.md index 401ada0c3..cccfcf262 100644 --- a/docs/programming.md +++ b/docs/programming.md @@ -540,16 +540,6 @@ GitHub 官方也提供了一些 RSS: -## 开发者头条 - -### 今天头条 - - - -### 独家号 - - - ## 开源中国 ### 资讯 diff --git a/lib/router.js b/lib/router.js index 5e6dc9b49..02bbb17da 100644 --- a/lib/router.js +++ b/lib/router.js @@ -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')); // 废弃 diff --git a/lib/routes/toutiao/today.js b/lib/routes/toutiao/today.js deleted file mode 100644 index 88da30409..000000000 --- a/lib/routes/toutiao/today.js +++ /dev/null @@ -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, - }; -}; diff --git a/lib/routes/toutiao/user.js b/lib/routes/toutiao/user.js deleted file mode 100644 index b82302108..000000000 --- a/lib/routes/toutiao/user.js +++ /dev/null @@ -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, - }; -};