mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
feat: 新增豆瓣电影人作品页订阅 (#4294)
This commit is contained in:
@@ -520,6 +520,10 @@ Tiny Tiny RSS 会给所有 iframe 元素添加 `sandbox="allow-scripts"` 属性
|
||||
| -------- | -------- | -------- | -------- |
|
||||
| U | T | S | R |
|
||||
|
||||
### 豆瓣电影人
|
||||
|
||||
<Route author="minimalistrojan" example="/douban/celebrity/1274261" path="/douban/celebrity/:id/:sort?" :paramsDesc="['电影人 id', '排序方式,缺省为 `time` (时间排序),可为 `vote` (评价排序)']"/>
|
||||
|
||||
### 豆瓣小组
|
||||
|
||||
<Route author="DIYgod" example="/douban/group/camera" path="/douban/group/:groupid" :paramsDesc="['豆瓣小组的 id']"/>
|
||||
|
||||
@@ -169,6 +169,7 @@ router.get('/douban/people/:userid/status', require('./routes/douban/people/stat
|
||||
router.get('/douban/topic/:id/:sort?', require('./routes/douban/topic.js'));
|
||||
router.get('/douban/channel/:id/:nav?', require('./routes/douban/channel/topic.js'));
|
||||
router.get('/douban/channel/:id/subject/:nav', require('./routes/douban/channel/subject.js'));
|
||||
router.get('/douban/celebrity/:id/:sort?', require('./routes/douban/celebrity.js'));
|
||||
|
||||
// 法律白話文運動
|
||||
router.get('/plainlaw/archives', require('./routes/plainlaw/archives.js'));
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const id = ctx.params.id;
|
||||
const sort = ctx.params.sort || 'time';
|
||||
|
||||
// 发起 HTTP GET 请求
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: `https://movie.douban.com/celebrity/${id}/movies?sortby=${sort}`,
|
||||
});
|
||||
|
||||
const data = response.data; // response.data 为 HTTP GET 请求返回的 HTML
|
||||
|
||||
const $ = cheerio.load(data); // 使用 cheerio 加载返回的 HTML
|
||||
const list = $('div.grid_view > ul li'); // 使用 cheerio 选择器
|
||||
let itemPicUrl;
|
||||
|
||||
ctx.state.data = {
|
||||
title: '豆瓣电影-电影人作品',
|
||||
link: `https://movie.douban.com/celebrity/${id}/movies?sortby=${sort}`,
|
||||
item:
|
||||
list &&
|
||||
list
|
||||
.map((index, item) => {
|
||||
item = $(item);
|
||||
itemPicUrl = item.find('img').attr('src');
|
||||
return {
|
||||
title:
|
||||
'《' +
|
||||
item.find('h6 > a').text() +
|
||||
'》' +
|
||||
item
|
||||
.find('h6 > span')
|
||||
.text()
|
||||
.replace('(', '(')
|
||||
.replace(')', ')')
|
||||
.replace('[', '【')
|
||||
.replace(']', '】'),
|
||||
description: `<img src="${itemPicUrl}"/><br/>主演:${item
|
||||
.find('dl > dd')
|
||||
.last()
|
||||
.text()}<br/>评分:${item.find('.star > span:nth-child(2)').text()}`,
|
||||
link: item.find('dt > a').attr('href'),
|
||||
};
|
||||
})
|
||||
.get(),
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user