Skip to content

Commit

Permalink
增加电影天堂的RSS (#807)
Browse files Browse the repository at this point in the history
  • Loading branch information
imgss authored and DIYgod committed Sep 28, 2018
1 parent d75eeeb commit 79cbe31
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 0 deletions.
8 changes: 8 additions & 0 deletions docs/README.md
Expand Up @@ -1700,3 +1700,11 @@ IATA 国际航空运输协会机场代码, 参见[维基百科 国际航空运
> 高清电影,百度网盘跟迅雷下载
</route>

### 电影天堂

<route name="电影天堂" author="imgss" example="/dytt/index" path="/dytt/index">

> 电影天堂新电影订阅
</route>
3 changes: 3 additions & 0 deletions router.js
Expand Up @@ -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;
34 changes: 34 additions & 0 deletions 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;
};

0 comments on commit 79cbe31

Please sign in to comment.