增加:豆瓣同城-热门活动 (#917)
- 部分实现 #911 - 没有选择从[同城首页](https://www.douban.com/location)获取**热门活动**的原因是上面无法获取到活动时间地址等信息,必须到活动详情页才能拿到,都轮一遍感觉消耗有些大,因此选择走接口获取数据。就是获取`locationId`会麻烦些,看后续反馈怎么样吧再做相应调整(逃
This commit is contained in:
@@ -440,6 +440,8 @@ RSSHub 提供下列 API 接口:
|
||||
|
||||
<route name="最新增加的音乐" author="fengkx" example="/douban/music/latest" path="/douban/music/latest"/>
|
||||
|
||||
<route name="同城活动-热门" author="xyqfer" example="/douban/event/hot/118172" path="/douban/event/hot/:locationId" :paramsDesc="['位置 id, [同城首页](https://www.douban.com/location)打开控制台执行 `window.__loc_id__` 获取']"/>
|
||||
|
||||
### Disqus
|
||||
|
||||
<route name="评论" author="DIYgod" example="/disqus/posts/diygod-me" path="/disqus/posts/:forum" :paramsDesc="['网站的 disqus name']"/>
|
||||
|
||||
@@ -190,6 +190,7 @@ router.get('/douban/group/:groupid', require('./routes/douban/group'));
|
||||
router.get('/douban/explore', require('./routes/douban/explore'));
|
||||
router.get('/douban/music/latest', require('./routes/douban/latest_music'));
|
||||
router.get('/douban/book/latest', require('./routes/douban/latest_book'));
|
||||
router.get('/douban/event/hot/:locationId', require('./routes/douban/event/hot'));
|
||||
|
||||
// 煎蛋
|
||||
router.get('/jandan/:sub_model', require('./routes/jandan/pic'));
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
const axios = require('../../../utils/axios');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { locationId = 0 } = ctx.params;
|
||||
const referer = 'https://m.douban.com/app_topic/event_hot';
|
||||
|
||||
const response = await axios({
|
||||
method: 'get',
|
||||
url: `https://m.douban.com/rexxar/api/v2/subject_collection/event_hot/items?os=ios&for_mobile=1&callback=&start=0&count=20&loc_id=${locationId}`,
|
||||
headers: {
|
||||
Referer: referer,
|
||||
},
|
||||
});
|
||||
|
||||
ctx.state.data = {
|
||||
title: '豆瓣同城-热门活动',
|
||||
link: referer,
|
||||
item: response.data.subject_collection_items.map(({ title, url, date, cover, subtype, info, price_range }) => {
|
||||
const pubDate = new Date(date).toUTCString();
|
||||
const description = `<img referrerpolicy="no-referrer" src="${cover.url}"><br>
|
||||
${info}/${subtype}/${price_range}
|
||||
`;
|
||||
|
||||
return {
|
||||
title,
|
||||
description,
|
||||
pubDate,
|
||||
link: url,
|
||||
};
|
||||
}),
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user