feat: 新增路由人人影视-评测推荐 (#4857)

This commit is contained in:
巧克力冰激凌
2020-05-27 14:14:00 +08:00
committed by GitHub
parent f4fd0e9802
commit 99dd1f772a
3 changed files with 39 additions and 0 deletions

View File

@@ -395,6 +395,12 @@ pageClass: routes
<Route author="nczitzk" example="/qingting/channel/293411" path="/qingting/channel/:id" :paramsDesc="['专辑id, 可在专辑页 URL 中找到']"/> <Route author="nczitzk" example="/qingting/channel/293411" path="/qingting/channel/:id" :paramsDesc="['专辑id, 可在专辑页 URL 中找到']"/>
## 人人影视
### 评测推荐
<Route author="wb121017405" example="/rrys/review" path="/rrys/review" />
## 色花堂中文论坛 ## 色花堂中文论坛
### 分区帖子 ### 分区帖子

View File

@@ -875,6 +875,9 @@ router.get('/btzj/:type?', require('./routes/btzj/index'));
// 人生05电影网 // 人生05电影网
router.get('/rs05/rs05', require('./routes/rs05/rs05')); router.get('/rs05/rs05', require('./routes/rs05/rs05'));
// 人人影视 (评测推荐)
router.get('/rrys/review', require('./routes/rrys/review'));
// 趣头条 // 趣头条
router.get('/qutoutiao/category/:cid', require('./routes/qutoutiao/category')); router.get('/qutoutiao/category/:cid', require('./routes/qutoutiao/category'));

30
lib/routes/rrys/review.js Normal file
View File

@@ -0,0 +1,30 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const baseURL = 'http://www.rrys2019.com';
module.exports = async (ctx) => {
const response = await got.get(baseURL + '/article');
const $ = cheerio.load(response.data);
const list = $('.article-list li');
ctx.state.data = {
title: '人人影视-评测推荐',
link: baseURL + '/article',
item:
list &&
list
.map((index, item) => {
item = $(item);
const itemPicUrl = item.find('.fl-img img').attr('src');
const itemDesc = item.find('.fl-info p').text().split('By')[0];
return {
title: item.find('.fl-info h3 a').text(),
author: item.find('.fl-info p a').text(),
description: `描述:${itemDesc}<br><img src="${itemPicUrl}">`,
link: baseURL + item.find('.fl-info h3 a').attr('href'),
};
})
.get(),
};
};