feat(route)!: remove `/wechat/wemp/:id` (#11792)

This commit is contained in:
Tony 2023-02-06 15:28:59 -05:00 committed by GitHub
parent 59dd5ac086
commit c6a3ff730b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 40 additions and 104 deletions

View File

@ -3894,14 +3894,14 @@ column 为 third 时可选的 category:
:::
### 公众号wemp.app 来源)
<Route 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']" anticrawler="1"/>
### 公众号CareerEngine 来源)
<Route author="HenryQW" example="/wechat/ce/595a5b14d7164e53908f1606" path="/wechat/ce/:id" :paramsDesc="['公众号 id, 在 [CareerEngine](https://search.careerengine.us/) 搜索公众号,通过 URL 中找到对应的公众号 id']" anticrawler="1"/>
### 公众号(二十次幂来源)
<Route author="sanmmm" example="/wechat/ershicimi/813oxJOl" path="/wechat/ershicimi/:id" :paramsDesc="['公众号id, 打开公众号页, 在 URL 中找到 id']" anticrawler="1"/>
### 公众号Telegram 频道来源)
<Route author="LogicJake Rongronggg9" example="/wechat/tgchannel/lifeweek" path="/wechat/tgchannel/:id/:mpName?/:searchQueryType?" :paramsDesc="['公众号绑定频道 id', '欲筛选的公众号全名URL-encoded, 精确匹配),在频道订阅了多个公众号时可选用', '搜索查询类型,见下表']">
@ -3926,49 +3926,10 @@ column 为 third 时可选的 category:
</Route>
### 公众号(优读来源)
<Route author="kt286" example="/wechat/uread/shensing" path="/wechat/uread/:userid" :paramsDesc="['公众号的微信号, 可在 微信-公众号-更多资料 中找到。并不是所有的都支持,能不能用随缘']"/>
### 公众号(二十次幂来源)
<Route author="sanmmm" example="/wechat/ershicimi/813oxJOl" path="/wechat/ershicimi/:id" :paramsDesc="['公众号id, 打开公众号页, 在 URL 中找到 id']" anticrawler="1"/>
### 公众号(微阅读来源)
<Route author="Rongronggg9" example="/wechat/data258/gh_cbbad4c1d33c" path="/data258/:id?" :paramsDesc="['公众号 id 或分类 id可在公众号页或分类页 URL 中找到;若略去,则抓取首页']" anticrawler="1" radar="1" rssbud="1" selfhost="1">
::: warning 注意
由于使用了一些针对反爬的缓解措施,本路由响应较慢。默认只抓取前 5 条,可通过 `?limit=` 改变(不推荐,容易被反爬)。\
该网站使用 IP 甄别访客,且应用严格的每日阅读量限额(约 15 次),请自建并确保正确配置缓存;如使用内存缓存而非 Redis 缓存,请增大缓存容量。该限额足够订阅至少 3 个公众号 (假设公众号每日仅更新一次);首页 / 分类页更新相当频繁,不推荐订阅。
:::
</Route>
### 公众号wxnmh.com 来源)
<Route author="laampui" example="/wechat/wxnmh/51798" path="/wechat/wxnmh/:id" :paramsDesc="['公众号 id, 打开 wxnmh.com, 在 URL 中找到 id']" anticrawler="1"/>
### 公众号wechat-feeds 来源)
::: warning 注意
wechat-feeds 来源[已停止更新](https://github.com/hellodword/wechat-feeds/issues/3882),历史文章可以正常订阅阅读
:::
<Route author="tylinux" example="/wechat/feeds/MzIwMzAwMzQxNw==" path="/wechat/feeds/:id" :paramsDesc="['公众号 id, 打开 `https://wechat.privacyhide.com/`, 在选定公众号的订阅 URL 中找到 id, 不包含最后的 .xml']"/>
### 公众号feeddd 来源)
### 公众号feeddd 来源)
<Route author="TonyRL Rongronggg9" example="/wechat/feeddd/6131e1441269c358aa0e2141" path="/wechat/feeddd/:id" :paramsDesc="['公众号 id, 打开 `https://feeddd.org/feeds``https://cdn.jsdelivr.net/gh/feeddd/feeds/feeds_all_rss.txt`, 在 URL 中找到 id; 注意不是公众号页的 id, 而是订阅的 id']"/>
### 公众号(公众号 360 来源)
见 [#公众号 360](#gong-zhong-hao-360)
### 公众号(自由微信来源)
见 [#自由微信](#zi-you-wei-xin)
@ -3991,6 +3952,41 @@ wechat-feeds 来源[已停止更新](https://github.com/hellodword/wechat-feeds/
</Route>
### 公众号(优读来源)
<Route author="kt286" example="/wechat/uread/shensing" path="/wechat/uread/:userid" :paramsDesc="['公众号的微信号, 可在 微信-公众号-更多资料 中找到。并不是所有的都支持,能不能用随缘']"/>
### 公众号wxnmh.com 来源)
<Route author="laampui" example="/wechat/wxnmh/51798" path="/wechat/wxnmh/:id" :paramsDesc="['公众号 id, 打开 wxnmh.com, 在 URL 中找到 id']" anticrawler="1"/>
### 公众号wechat-feeds 来源)
::: warning 注意
wechat-feeds 来源[已停止更新](https://github.com/hellodword/wechat-feeds/issues/3882),历史文章可以正常订阅阅读
:::
<Route author="tylinux" example="/wechat/feeds/MzIwMzAwMzQxNw==" path="/wechat/feeds/:id" :paramsDesc="['公众号 id, 打开 `https://wechat.privacyhide.com/`, 在选定公众号的订阅 URL 中找到 id, 不包含最后的 .xml']"/>
### 公众号(公众号 360 来源)
见 [#公众号 360](#gong-zhong-hao-360)
### 公众号(微阅读来源)
<Route author="Rongronggg9" example="/wechat/data258/gh_cbbad4c1d33c" path="/data258/:id?" :paramsDesc="['公众号 id 或分类 id可在公众号页或分类页 URL 中找到;若略去,则抓取首页']" anticrawler="1" radar="1" rssbud="1" selfhost="1">
::: warning 注意
由于使用了一些针对反爬的缓解措施,本路由响应较慢。默认只抓取前 5 条,可通过 `?limit=` 改变(不推荐,容易被反爬)。\
该网站使用 IP 甄别访客,且应用严格的每日阅读量限额(约 15 次),请自建并确保正确配置缓存;如使用内存缓存而非 Redis 缓存,请增大缓存容量。该限额足够订阅至少 3 个公众号 (假设公众号每日仅更新一次);首页 / 分类页更新相当频繁,不推荐订阅。
:::
</Route>
## 维基百科
### 中国大陆新闻动态

View File

@ -9,6 +9,5 @@ module.exports = {
'/mp/msgalbum/:biz/:aid': ['MisteryMonster'],
'/tgchannel/:id/:mpName?/:searchQueryType?': ['LogicJake', 'Rongronggg9'],
'/uread/:userid': ['kt286'],
'/wemp/:id': ['HenryQW'],
'/wxnmh/:id': ['laampui'],
};

View File

@ -9,6 +9,5 @@ module.exports = function (router) {
router.get('/mp/msgalbum/:biz/:aid', require('./msgalbum'));
router.get('/tgchannel/:id/:mpName?/:searchQueryType?', require('./tgchannel'));
router.get('/uread/:userid', require('./uread'));
router.get('/wemp/:id', require('./wemp'));
router.get('/wxnmh/:id', require('./wxnmh'));
};

View File

@ -1,58 +0,0 @@
const got = require('@/utils/got');
const entities = require('entities');
const cheerio = require('cheerio');
const date = require('@/utils/date');
module.exports = async (ctx) => {
const { id } = ctx.params;
const response = await got.get(`https://wemp.app/accounts/${id}`);
const $ = cheerio.load(response.data);
const meta = $('.mp-info__list .mp-info__value');
const author = $(meta[0]).text().trim();
const year = new Date().getFullYear();
const items = await Promise.all(
$('.post-item__main')
.get()
.slice(0, 3)
.map(async (e) => {
let pubDate = date(`${year} ${$(e).find('.post-item__date').text().trim()}`, 8);
if (new Date(pubDate) > new Date()) {
pubDate = new Date(pubDate).setFullYear(year - 1);
pubDate = new Date(pubDate).toUTCString();
}
const link = `https://wemp.app${$(e).find('.post-item__title').attr('href')}`;
const response = await ctx.cache.tryGet(link, async () => (await got.get(link)).data);
const article = cheerio.load(response);
const matchs = /"(url|temp_url)":"([^"]+mp\.weixin\.qq\.com[^"]+)"/.exec(response);
let weixinLink = '';
if (matchs && matchs[2]) {
weixinLink = entities.decodeXML(unescape(matchs[2].replace(/\\u/g, '%u')));
}
const single = {
title: $(e).find('.post-item__title').text().trim(),
link: weixinLink || link,
description: article('#content').html(),
pubDate,
author,
};
return Promise.resolve(single);
})
);
ctx.state.data = {
title: `微信公众号 - ${author}`,
link: `https://wemp.app/accounts/${id}/`,
description: $(meta[1]).text().trim(),
item: items,
};
};