增加电影天堂的RSS (#807)

This commit is contained in:
IMGSS
2018-09-28 11:02:15 +08:00
committed by DIYgod
parent d75eeebe48
commit 79cbe31800
3 changed files with 45 additions and 0 deletions

View File

@@ -1700,3 +1700,11 @@ IATA 国际航空运输协会机场代码, 参见[维基百科 国际航空运
> 高清电影,百度网盘跟迅雷下载 > 高清电影,百度网盘跟迅雷下载
</route> </route>
### 电影天堂
<route name="电影天堂" author="imgss" example="/dytt/index" path="/dytt/index">
> 电影天堂新电影订阅
</route>

View File

@@ -584,4 +584,7 @@ router.get('/thepaper/featured', require('./routes/thepaper/featured'));
// 电影首发站 // 电影首发站
router.get('/dysfz/index', require('./routes/dysfz/index')); router.get('/dysfz/index', require('./routes/dysfz/index'));
// 电影天堂
router.get('/dytt/index', require('./routes/dytt/index'));
module.exports = router; module.exports = router;

34
routes/dytt/index.js Normal file
View File

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