From 79cbe3180048dd2c1f48e3be321a84d9b1853a3f Mon Sep 17 00:00:00 2001 From: IMGSS <838632526@qq.com> Date: Fri, 28 Sep 2018 11:02:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=94=B5=E5=BD=B1=E5=A4=A9?= =?UTF-8?q?=E5=A0=82=E7=9A=84RSS=20(#807)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/README.md | 8 ++++++++ router.js | 3 +++ routes/dytt/index.js | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 routes/dytt/index.js diff --git a/docs/README.md b/docs/README.md index ea1866ac3b..21adc6f2b0 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1700,3 +1700,11 @@ IATA 国际航空运输协会机场代码, 参见[维基百科 国际航空运 > 高清电影,百度网盘跟迅雷下载 + +### 电影天堂 + + + +> 电影天堂新电影订阅 + + diff --git a/router.js b/router.js index ff19cc5365..0054a28a9f 100644 --- a/router.js +++ b/router.js @@ -584,4 +584,7 @@ router.get('/thepaper/featured', require('./routes/thepaper/featured')); // 电影首发站 router.get('/dysfz/index', require('./routes/dysfz/index')); +// 电影天堂 +router.get('/dytt/index', require('./routes/dytt/index')); + module.exports = router; diff --git a/routes/dytt/index.js b/routes/dytt/index.js new file mode 100644 index 0000000000..c89bfd63f4 --- /dev/null +++ b/routes/dytt/index.js @@ -0,0 +1,34 @@ +const axios = require('../../utils/axios'); +const cheerio = require('cheerio'); +const iconv = require('iconv-lite'); +module.exports = async (ctx) => { + const response = await axios.get('http://www.dytt8.net', { + responseType: 'arraybuffer', + }); + response.data = iconv.decode(response.data, 'gb2312'); + + const $ = cheerio.load(response.data); + const list = $('.co_content8 table tr').get(); + const data = { + title: '电影天堂', + link: 'http://www.dytt8.net', + description: '电影天堂RSS', + item: list + .map((item) => { + const link = $(item).find('a:nth-of-type(2)'); + return { + title: link.text(), + description: link.text(), + pubDate: new Date( + $(item) + .find('font') + .text() + ).toUTCString(), + link: 'http://www.dytt8.net' + link.attr('href'), + }; + }) + .slice(1), + }; + + ctx.state.data = data; +};