mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
@@ -462,6 +462,8 @@ RSSHub 提供下列 API 接口:
|
||||
|
||||
<route name="知乎想法-24小时新闻汇总" author="xyqfer" example="/zhihu/pin/daily" path="/zhihu/pin/daily" crawlerBadge="1"/>
|
||||
|
||||
<route name="知乎书店-知乎周刊" author="LogicJake" example="/zhihu/weekly" path="/zhihu/weekly" crawlerBadge="1"/>
|
||||
|
||||
### pixiv
|
||||
|
||||
<route name="用户收藏" author="EYHN" example="/pixiv/user/bookmarks/15288095" path="/pixiv/user/bookmarks/:id" :paramsDesc="['用户 id, 可在用户主页 URL 中找到']"/>
|
||||
|
||||
@@ -179,6 +179,7 @@ router.get('/zhihu/topic/:topicId', require('./routes/zhihu/topic'));
|
||||
router.get('/zhihu/people/pins/:id', require('./routes/zhihu/pin/people'));
|
||||
router.get('/zhihu/bookstore/newest', require('./routes/zhihu/bookstore/newest'));
|
||||
router.get('/zhihu/pin/daily', require('./routes/zhihu/pin/daily'));
|
||||
router.get('/zhihu/weekly', require('./routes/zhihu/weekly'));
|
||||
|
||||
// 妹子图
|
||||
router.get('/mzitu/home/:type?', require('./routes/mzitu/home'));
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
const axios = require('../../utils/axios');
|
||||
const cheerio = require('cheerio');
|
||||
const url = require('url');
|
||||
|
||||
const host = 'https://www.zhihu.com';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const link = 'https://www.zhihu.com/pub/weekly';
|
||||
const response = await axios.get(link);
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
const description = $('p.Weekly-description').text();
|
||||
const out = $('div.Card-section.PubBookListItem')
|
||||
.slice(0, 10)
|
||||
.map(function() {
|
||||
const info = {
|
||||
title: $(this)
|
||||
.find('span.PubBookListItem-title')
|
||||
.text(),
|
||||
link: url.resolve(
|
||||
host,
|
||||
$(this)
|
||||
.find('a.PubBookListItem-buttonWrapper')
|
||||
.attr('href')
|
||||
),
|
||||
description: $(this)
|
||||
.find('div.PubBookListItem-description')
|
||||
.text(),
|
||||
author: $(this)
|
||||
.find('span.PubBookListItem-author')
|
||||
.text(),
|
||||
};
|
||||
return info;
|
||||
})
|
||||
.get();
|
||||
|
||||
ctx.state.data = {
|
||||
title: '知乎周刊',
|
||||
link: link,
|
||||
description: description,
|
||||
item: out,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user