rss: add wechat wasi

This commit is contained in:
DIYgod
2018-08-19 16:03:36 +08:00
parent 07abaf9ddd
commit d3253ab1e2
4 changed files with 48 additions and 4 deletions
+2 -1
View File
@@ -54,7 +54,8 @@ RSSHub 是一个轻量、易于扩展的 RSS 生成器,可以给任何奇奇
- 主题
- 用户动态
- 微信
- 公众号
- 公众号(即刻来源)
- 公众号(瓦斯来源)
- 网易云音乐
- 歌单歌曲
- 用户歌单
+15 -3
View File
@@ -552,16 +552,28 @@ rid: 排行榜分区 id,默认 0
## 微信
### 公众号
::: tip 提示
公众号抓取困难,目前可提供的方案是通过即刻的公众号主题订阅
公众号直接抓取困难,故目前提供即刻和瓦斯两种间接抓取方案,请自行选择
:::
### 公众号(即刻来源)
举例: [https://rsshub.app/jike/topic/584b8ac671a288001154a115](https://rsshub.app/jike/topic/584b8ac671a288001154a115)
路由: `/jike/user/:id`
参数: 参考 [即刻-主题-精选](#主题-精选)
### 公众号(瓦斯来源)
举例: [https://rsshub.app/wechat/wasi/5b5adaf358e5c4583338eace](https://rsshub.app/jike/topic/584b8ac671a288001154a115)
路由: `/wechat/wasi/:id`
参数: id,瓦斯公众号 id,可在[瓦斯](https://w.qnmlgb.tech/wx)搜索公众号,打开公众号页,在 URL 中找到 id
## 网易云音乐
### 歌单歌曲
+3
View File
@@ -424,4 +424,7 @@ router.get('/appstore/price/:country/:type/:id', require('./routes/appstore/pric
// Hopper
router.get('/hopper/:lowestOnly/:from/:to?', require('./routes/hopper/index'));
// wechat
router.get('/wechat/wasi/:id', require('./routes/wechat/wasi'));
module.exports = router;
+28
View File
@@ -0,0 +1,28 @@
const axios = require('../../utils/axios');
const config = require('../../config');
module.exports = async (ctx) => {
const id = ctx.params.id;
const response = await axios({
method: 'get',
url: `https://q.qnmlgb.tech/w/api/articles?_ls=&_fmt=authorSimple&_page=author&_author_id=${id}&_sub_tab=&_tab=author`,
headers: {
'User-Agent': config.ua,
Referer: `https://w.qnmlgb.tech/authors/${id}/`,
},
});
const data = response.data.result.articles[0];
ctx.state.data = {
title: `${data.author.nickname}微信公众号`,
link: `https://w.qnmlgb.tech/authors/${id}/`,
description: data.author.profile_desc,
item: data.sub_articles.map((item) => ({
title: item.article.title,
description: `${item.article.digest}<img referrerpolicy="no-referrer" src="${item.article.cover}">`,
pubDate: new Date(item.article.datetime * 1000).toUTCString(),
link: item.article.content_url,
})),
};
};