mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-10-16 16:44:53 +08:00
@@ -50,6 +50,7 @@ RSSHub 是一个轻量、易于扩展的 RSS 生成器,可以给任何奇奇
|
||||
- 用户动态
|
||||
- 用户回答
|
||||
- 专栏
|
||||
- 知乎日报
|
||||
- 自如
|
||||
- 房源
|
||||
- 快递
|
||||
|
||||
@@ -392,6 +392,12 @@ order: 排序方式,live_time 开播时间,online 人气
|
||||
|
||||
参数: id,专栏 id,可在专栏主页 URL 中找到
|
||||
|
||||
### 知乎日报
|
||||
|
||||
举例:[https://rsshub.app/zhihu/daily](https://rsshub.app/zhihu/daily)
|
||||
|
||||
路由:`/zhihu/daily`
|
||||
|
||||
## 自如
|
||||
|
||||
### 房源
|
||||
|
||||
@@ -58,6 +58,7 @@ router.get('/zhihu/collection/:id', require('./routes/zhihu/collection'));
|
||||
router.get('/zhihu/people/activities/:id', require('./routes/zhihu/activities'));
|
||||
router.get('/zhihu/people/answers/:id', require('./routes/zhihu/answers'));
|
||||
router.get('/zhihu/zhuanlan/:id', require('./routes/zhihu/zhuanlan'));
|
||||
router.get('/zhihu/daily', require('./routes/zhihu/daily'))
|
||||
|
||||
// 贴吧
|
||||
router.get('/tieba/forum/:kw', require('./routes/tieba/forum'));
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
const axios = require('axios');
|
||||
const config = require('../../config');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const today = await axios({
|
||||
method: 'get',
|
||||
url: 'https://news-at.zhihu.com/api/2/news/latest', // 旧版api,可以获取文章的url。参考:https://github.com/izzyleung/ZhihuDailyPurify/wiki/%E7%9F%A5%E4%B9%8E%E6%97%A5%E6%8A%A5-API-%E5%88%86%E6%9E%90
|
||||
headers: {
|
||||
'User-Agent': config.ua,
|
||||
'Referer': 'https://daily.zhihu.com' // 不知道应该写什么比较好,随便写一个吧
|
||||
}
|
||||
});
|
||||
const d = new Date();
|
||||
// todayfmt: YYYYMMDD
|
||||
const todayfmt = `${d.getFullYear()}${d.getMonth() > 8 ? d.getMonth() + 1 : '0' + (d.getMonth() + 1)}${d.getDate()}`;
|
||||
|
||||
const yesterday = await axios({
|
||||
method: 'get',
|
||||
url: `https://news-at.zhihu.com/api/2/news/before/${todayfmt}`, // 旧版api,可以获取文章的url。参考:https://github.com/izzyleung/ZhihuDailyPurify/wiki/%E7%9F%A5%E4%B9%8E%E6%97%A5%E6%8A%A5-API-%E5%88%86%E6%9E%90
|
||||
headers: {
|
||||
'User-Agent': config.ua,
|
||||
'Referer': 'https://daily.zhihu.com'
|
||||
}
|
||||
});
|
||||
|
||||
const items = today.data.news.concat(yesterday.data.news);
|
||||
|
||||
ctx.state.data = {
|
||||
title: '知乎日报',
|
||||
link: 'https://daily.zhihu.com',
|
||||
description: '每天3次,每次7分钟',
|
||||
item: items.map((item) => {
|
||||
return {
|
||||
title: item.title,
|
||||
description: `<img referrerpolicy="no-referrer" src='${item.image}'/>`, // 暂时没有找到包含正文的api,所以就放一张图吧
|
||||
link: item.share_url
|
||||
};
|
||||
}),
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user