diff --git a/docs/social-media.md b/docs/social-media.md index 20fe79c570..c272357f18 100644 --- a/docs/social-media.md +++ b/docs/social-media.md @@ -500,7 +500,7 @@ Tiny Tiny RSS 会给所有 iframe 元素添加 `sandbox="allow-scripts"` 属性 ### 用户 / 标签 - Private API - + | 用户时间线 | 标签 | | ----- | ---- | @@ -946,7 +946,8 @@ YouTube 官方亦有提供频道 RSS,形如 @@ -1257,6 +1259,35 @@ YouTube 官方亦有提供频道 RSS,形如 +### 榜单与集合 + + + +| 榜单 / 集合 | 路由(type) | +| --------- | -------------------------- | +| 实时热门书影音 | subject_real_time_hotest | +| 影院热映 | movie_showing | +| 实时热门电影 | movie_real_time_hotest | +| 实时热门电视 | tv_real_time_hotest | +| 一周口碑电影榜 | movie_weekly_best | +| 华语口碑剧集榜 | tv_chinese_best_weekly | +| 全球口碑剧集榜 | tv_global_best_weekly | +| 国内口碑综艺榜 | show_chinese_best_weekly | +| 国外口碑综艺榜 | show_global_best_weekly | +| 虚构类小说热门榜 | book_fiction_hot_weekly | +| 非虚构类小说热门榜 | book_nonfiction_hot_weekly | +| 热门单曲榜 | music_single | +| 华语新碟榜 | music_chinese | +| ... | ... | + +> 上面的榜单 / 集合并没有列举完整。 +> +> 如何找到榜单对应的路由参数: +> 在豆瓣手机 APP 中,对应地榜单页面右上角,点击分享链接。链接路径 `subject_collection` 后的路径就是路由参数 `type`。 +> 如:小说热门榜的分享链接为:`https://m.douban.com/subject_collection/ECDIHUN4A`,其对应本 RSS 路由的 `type` 为 `ECDIHUN4A`,对应的订阅链接路由:[`/douban/list/ECDIHUN4A`](https://rsshub.app/douban/list/ECDIHUN4A) + + + ## 饭否 ::: warning 注意 diff --git a/lib/v2/douban/maintainer.js b/lib/v2/douban/maintainer.js index 83aabf0db8..85a7a6dc4e 100644 --- a/lib/v2/douban/maintainer.js +++ b/lib/v2/douban/maintainer.js @@ -11,6 +11,7 @@ module.exports = { '/explore': ['clarkzsd'], '/explore_column/:id': ['LogicJake'], '/group/:groupid/:type?': ['DIYgod'], + '/list/:type?': ['5upernova-heng'], '/jobs/:type': ['Fatpandac'], '/movie/classification/:sort?/:score?/:tags?': ['zzwab'], '/movie/later': ['DIYgod'], diff --git a/lib/v2/douban/other/list.js b/lib/v2/douban/other/list.js new file mode 100644 index 0000000000..59cbcd3bf2 --- /dev/null +++ b/lib/v2/douban/other/list.js @@ -0,0 +1,40 @@ +const got = require('@/utils/got'); +const path = require('path'); +const { art } = require('@/utils/render'); + +module.exports = async (ctx) => { + const type = ctx.params.type || 'subject_real_time_hotest'; + const url = `https://m.douban.com/rexxar/api/v2/subject_collection/${type}/items`; + const response = await got({ + method: 'get', + url, + headers: { + Referer: `https://m.douban.com/subject_collection/${type}`, + }, + }); + const description = response.data.subject_collection.description; + const items = response.data.subject_collection_items.map((item) => { + const title = item.title; + const link = item.url; + const description = art(path.join(__dirname, '../templates/list_description.art'), { + ranking_value: item.ranking_value, + title, + original_title: item.original_title, + rate: item.rating ? item.rating.value : null, + card_subtitle: item.card_subtitle, + description: item.cards ? item.cards[0].content : item.abstract, + cover: item.cover_url || item.cover.url, + }); + return { + title, + link, + description, + }; + }); + ctx.state.data = { + title: `豆瓣 - ${response.data.subject_collection.name}`, + link: 'https://m.douban.com/subject_collection/subject_real_time_hotest', + item: items, + description, + }; +}; diff --git a/lib/v2/douban/radar.js b/lib/v2/douban/radar.js index ea49ac1c65..8fdbdb622f 100644 --- a/lib/v2/douban/radar.js +++ b/lib/v2/douban/radar.js @@ -29,6 +29,12 @@ module.exports = { source: '/group/:groupid', target: '/douban/group/:groupid/elite', }, + { + title: '榜单与集合', + docs: 'https://docs.rsshub.app/social-media.html#douban', + source: ['/subject_collection/:type'], + target: '/douban/list/:type', + }, ], jobs: [ { diff --git a/lib/v2/douban/router.js b/lib/v2/douban/router.js index d40f443271..6c40d1a17b 100644 --- a/lib/v2/douban/router.js +++ b/lib/v2/douban/router.js @@ -12,6 +12,7 @@ module.exports = function (router) { router.get('/explore/column/:id', require('./other/explore_column')); router.get('/group/:groupid/:type?', require('./other/group')); router.get('/jobs/:type', require('./other/jobs.js')); + router.get('/list/:type?', require('./other/list')); router.get('/movie/classification/:sort?/:score?/:tags?', require('./other/classification.js')); router.get('/movie/later', require('./other/later')); router.get('/movie/playing', require('./other/playing')); diff --git a/lib/v2/douban/templates/list_description.art b/lib/v2/douban/templates/list_description.art new file mode 100644 index 0000000000..169b03dd95 --- /dev/null +++ b/lib/v2/douban/templates/list_description.art @@ -0,0 +1,25 @@ +{{ if ranking_value }} +

{{ ranking_value }}

+{{ /if }} + +

{{ title }}

+ +{{ if original_title }} +

{{ original_title }}

+{{ /if }} + +{{ if rate }} +

{{ rate }}

+{{ /if }} + +{{ if card_subtitle }} +

{{ card_subtitle }}

+{{ /if }} + +{{ if description }} +

{{ description }}

+{{ /if }} + +{{ if cover }} + +{{ /if }}