From 31a62d2a7dbd034fac35551b349cd47cb55526c3 Mon Sep 17 00:00:00 2001 From: epirus Date: Tue, 18 Sep 2018 11:00:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=B8=80=E4=B8=AA=E7=94=B5?= =?UTF-8?q?=E5=BD=B1=E9=A6=96=E5=8F=91=E7=AB=99=E7=9A=84=E7=BD=91=E7=AB=99?= =?UTF-8?q?=E7=9A=84=E6=8A=93=E5=8F=96=20(#735)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 增加一个电影首发站的网站的抓取 --- docs/README.md | 8 ++++++++ router.js | 3 +++ routes/dysfz/index.js | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 routes/dysfz/index.js diff --git a/docs/README.md b/docs/README.md index b04150c1b..e42622ccf 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1610,3 +1610,11 @@ IATA 国际航空运输协会机场代码, 参见[维基百科 国际航空运 > 少数派专栏需要付费订阅, RSS 仅做更新提醒, 不含付费内容. + +### 电影首发站 + + + +> 高清电影,百度网盘跟迅雷下载 + + diff --git a/router.js b/router.js index 1f61000a9..2ad89a9fe 100644 --- a/router.js +++ b/router.js @@ -566,4 +566,7 @@ router.get('/embassy/:country/:city?', require('./routes/embassy/index')); // 澎湃新闻 router.get('/thepaper/featured', require('./routes/thepaper/featured')); +// 电影首发站 +router.get('/dysfz/index', require('./routes/dysfz/index')); + module.exports = router; diff --git a/routes/dysfz/index.js b/routes/dysfz/index.js new file mode 100644 index 000000000..10766bf28 --- /dev/null +++ b/routes/dysfz/index.js @@ -0,0 +1,33 @@ +const axios = require('../../utils/axios'); +const cheerio = require('cheerio'); + +module.exports = async (ctx) => { + const response = await axios.get('http://www.dysfz.cc'); + const $ = cheerio.load(response.data); + const list = $('.movie-list li') + .get() + .slice(2); + const data = { + title: '电影首发站', + link: 'http://www.dysfz.cc', + description: '高清电影', + item: list.map((item) => ({ + title: $(item) + .find('a') + .text(), + description: $(item) + .find('.txt') + .text(), + pubDate: new Date( + $(item) + .find('.txt p>span:nth-child(1)') + .text() + ).toUTCString(), + link: $(item) + .find('h2 a') + .attr('href'), + })), + }; + + ctx.state.data = data; +};