增加微信公众号 wemp.app 路径 (#1469)
This commit is contained in:
@@ -391,6 +391,8 @@ RSSHub 提供下列 API 接口:
|
||||
|
||||
<route name="公众号(瓦斯来源)" author="DIYgod" example="/wechat/wasi/5b575db858e5c4583338db11" path="/wechat/wasi/:id" :paramsDesc="['瓦斯公众号 id, 可在[瓦斯](https://w.qnmlgb.tech/wx)搜索公众号, 打开公众号页, 在 URL 中找到 id']"/>
|
||||
|
||||
<route name="公众号( wemp.app 来源)" author="HenryQW" example="/wechat/wemp/36836fbe-bdec-4758-8967-7cc82722952d" path="/wechat/wemp/:id" :paramsDesc="['wemp 公众号 id, 可在搜索引擎使用 `site:wemp.app` 搜索公众号(例如: 人民日报 site:wemp.app), 打开公众号页, 在 URL 中找到 id']"/>
|
||||
|
||||
<route name="公众平台系统公告栏目" author="xyqfer" example="/wechat/announce" path="/wechat/announce" />
|
||||
|
||||
<route name="小程序插件" author="xyqfer" example="/wechat/miniprogram/plugins" path="/wechat/miniprogram/plugins" />
|
||||
|
||||
@@ -497,6 +497,7 @@ router.get('/bugly/changelog/:platform', require('./routes/tencent/bugly/changel
|
||||
|
||||
// wechat
|
||||
router.get('/wechat/wasi/:id', require('./routes/tencent/wechat/wasi'));
|
||||
router.get('/wechat/wemp/:id', require('./routes/tencent/wechat/wemp'));
|
||||
router.get('/wechat/announce', require('./routes/tencent/wechat/announce'));
|
||||
router.get('/wechat/miniprogram/plugins', require('./routes/tencent/wechat/miniprogram/plugins'));
|
||||
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
const axios = require('../../../utils/axios');
|
||||
const cheerio = require('cheerio');
|
||||
// const timezone = require('../../utils/timezone');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const { id } = ctx.params;
|
||||
|
||||
const response = await axios.get(`https://wemp.app/accounts/${id}`);
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
const author = $('.mp-info__title')
|
||||
.text()
|
||||
.trim();
|
||||
|
||||
const year = new Date().getFullYear();
|
||||
const items = $('.post-item__main')
|
||||
.slice(0, 10)
|
||||
.get()
|
||||
.map((e) => ({
|
||||
title: $(e)
|
||||
.find('.post-item__title')
|
||||
.text()
|
||||
.trim(),
|
||||
link: `https://wemp.app${$(e)
|
||||
.find('.post-item__title')
|
||||
.attr('href')}`,
|
||||
pubDate: timezone(
|
||||
`${year} ${$(e)
|
||||
.find('.post-item__date')
|
||||
.text()
|
||||
.trim()}`,
|
||||
8
|
||||
),
|
||||
author,
|
||||
}));
|
||||
|
||||
// to be replaced
|
||||
function timezone(html, timezone) {
|
||||
return new Date(new Date(html).getTime() - 60 * 60 * 1000 * (timezone + new Date().getTimezoneOffset() / 60)).toUTCString();
|
||||
}
|
||||
|
||||
ctx.state.data = {
|
||||
title: `微信公众号 - ${author}`,
|
||||
link: `https://wemp.app/accounts/${id}/`,
|
||||
description: $('.mp-info__value')
|
||||
.text()
|
||||
.trim(),
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user