增加一个电影首发站的网站的抓取 (#735)

增加一个电影首发站的网站的抓取
This commit is contained in:
epirus 2018-09-18 11:00:23 +08:00 committed by DIYgod
parent c597754f75
commit 31a62d2a7d
3 changed files with 44 additions and 0 deletions

View File

@ -1610,3 +1610,11 @@ IATA 国际航空运输协会机场代码, 参见[维基百科 国际航空运
> 少数派专栏需要付费订阅, RSS 仅做更新提醒, 不含付费内容.
</route>
### 电影首发站
<route name="电影首发站" author="epirus" example="/dysfz/index" path="/dysfz/index">
> 高清电影,百度网盘跟迅雷下载
</route>

View File

@ -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;

33
routes/dysfz/index.js Normal file
View File

@ -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;
};