feat: add nfmovies (#2969)

]
This commit is contained in:
AngUOI
2019-09-01 12:39:35 +08:00
committed by DIYgod
parent 8094a0bd1b
commit c3c53478de
5 changed files with 142 additions and 1 deletions

View File

@@ -95,7 +95,7 @@ pageClass: routes
**类型参考这里**
| 电影 | 连续剧 | 动画 | 综艺 | 纪录片 |
| - | - | - | - | - |
| ---- | ------ | ---- | ---- | ------ |
| 6 | 7 | 15 | 20 | 24 |
| 动作片 | 喜剧片 | 爱情片 | 科幻片 | 恐怖片 |
@@ -240,6 +240,18 @@ pageClass: routes
<Route author="HenryQW" example="/maoyan/upcoming" path="/maoyan/upcoming" />
## 奈菲影视
### 分区
<Route author="AngUOI" example="/nfmovies/0" path="/nfmovies/:id?" :paramsDesc="['子版块 id, 为空默认首页']">
| 首页 | 电影 | 电视剧 | 综艺 | 动漫 | 奈菲独家 |
| ---- | ---- | ------ | ---- | ---- | -------- |
| 0 | 1 | 2 | 3 | 4 | 5 |
</Route>
## 柠檬 私房歌 (ningmeng.name)
### 私房歌

View File

@@ -606,6 +606,18 @@ pageClass: routes
<Route author="ihewro" example="/meipai/user/56537299" path="/meipai/user/:id" :paramsDesc="['用户 id, 可在 分享出去获得的用户主页 URL 中找到']"/>
## 书友社区
### 导读
<Route author="AngUOI" example="/andyt/newthread" path="/andyt/:view?" :paramsDesc="['子版块 view, 为空默认最新发表']">
| 最新发表 | 最新热门 | 最新精华 | 最新回复 |
| --------- | -------- | -------- | -------- |
| newthread | hot | digest | new |
</Route>
## 搜狐
### 搜狐号

View File

@@ -1685,4 +1685,10 @@ router.get('/houmo/:code?', require('./routes/houmo/booksource'));
// 腾讯企鹅号
router.get('/tencent/news/author/:mid', require('./routes/tencent/news/author'));
// 奈菲影视
router.get('/nfmovies/:id?', require('./routes/nfmovies/index'));
// 书友社区
router.get('/andyt/:view?', require('./routes/andyt/index'));
module.exports = router;

53
lib/routes/andyt/index.js Normal file
View File

@@ -0,0 +1,53 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const baseUrl = 'https://andyt.cn/forum.php?mod=guide&view=';
const host = 'https://andyt.cn/';
const viewProps = {
newthread: '最新发表',
hot: '最新热门',
digest: '最新精华',
new: '最新回复',
};
module.exports = async (ctx) => {
const view = ctx.params.view || 'newthread';
const url = baseUrl + view;
const response = await got({
method: 'get',
url: url,
});
const $ = cheerio.load(response.data);
ctx.state.data = {
title: `${viewProps[view]} - 书友社区`,
link: url,
description: `${viewProps[view]} - 书友社区`,
item: $('.bm_c')
.find('tbody')
.map((index, item) => ({
title:
`` +
$(item)
.find('td.by a')
.eq(0)
.text() +
`` +
$(item)
.find('a.xst')
.text(),
description: '',
author: $(item)
.find('cite')
.text()
.trim(),
link:
host +
$(item)
.find('a')
.eq(0)
.attr('href'),
}))
.get(),
};
};

View File

@@ -0,0 +1,58 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const host = 'https://www.nfmovies.com/';
const mv_slot = 'https://www.nfmovies.com/video/?UID-0-0.html';
const url_slot = 'https://www.nfmovies.com/list/?ID.html';
const idProps = {
0: '首页',
1: '电影',
2: '电视剧',
3: '综艺',
4: '动漫',
5: '奈菲独家',
};
module.exports = async (ctx) => {
const id = ctx.params.id || '0';
let t_url = '';
if (id === '0') {
t_url = host;
} else if (id === '5') {
t_url = 'https://www.nfmovies.com/search.php?searchtype=5&order=time&player=%E5%A5%88%E8%8F%B2%E7%8B%AC%E5%AE%B6%E9%AB%98%E6%B8%85%E7%89%87%E6%BA%90';
} else {
t_url = url_slot.replace('ID', id);
}
const response = await got({
method: 'get',
url: t_url,
});
const $ = cheerio.load(response.data);
const items = [];
$('.col-md-2').each(function() {
const item = $(this);
const link = mv_slot.replace(
'UID',
item
.find('a')
.attr('href')
.match(/\d{4,}/g)
);
const src = host + item.children('a').attr('data-original');
items.push({
title: item.find('h5').text(),
description: `<img src="` + src + `"/><br>` + item.html(),
link: link,
});
});
ctx.state.data = {
title: `${idProps[id]} - 奈菲影视`,
link: t_url,
description: `${idProps[id]} - 奈菲影视-永久免费无广告的福利超清影视站,没有套路,完全免费!`,
item: items,
};
};