mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-08 14:07:54 +08:00
feat: add 公众号Telegrame 频道来源 (#2205)
* feat: add 公众号Telegrame 频道来源 * 去掉全文抓取
This commit is contained in:
@@ -646,6 +646,16 @@ pageClass: routes
|
|||||||
|
|
||||||
<Route author="HenryQW" example="/wechat/csm/huxiu_com" path="/wechat/csm/:id" :paramsDesc="['公众号 id, 打开公众号页, 在 URL 中找到 id']"/>
|
<Route author="HenryQW" example="/wechat/csm/huxiu_com" path="/wechat/csm/:id" :paramsDesc="['公众号 id, 打开公众号页, 在 URL 中找到 id']"/>
|
||||||
|
|
||||||
|
### 公众号(Telegrame 频道来源)
|
||||||
|
|
||||||
|
<Route author="LogicJake" example="/wechat/tgchannel/lifeweek" path="/wechat/tgchannel/:id" :paramsDesc="['公众号绑定频道 id']">
|
||||||
|
|
||||||
|
::: warning 注意
|
||||||
|
|
||||||
|
该方法需要通过 efb 进行频道绑定,具体操作见[https://github.com/DIYgod/RSSHub/issues/2172](https://github.com/DIYgod/RSSHub/issues/2172)
|
||||||
|
:::
|
||||||
|
</Route>
|
||||||
|
|
||||||
### 公众平台系统公告栏目
|
### 公众平台系统公告栏目
|
||||||
|
|
||||||
<Route author="xyqfer" example="/wechat/announce" path="/wechat/announce" />
|
<Route author="xyqfer" example="/wechat/announce" path="/wechat/announce" />
|
||||||
|
|||||||
@@ -445,6 +445,7 @@ router.get('/wechat/wemp/:id', require('./routes/tencent/wechat/wemp'));
|
|||||||
router.get('/wechat/csm/:id', require('./routes/tencent/wechat/csm'));
|
router.get('/wechat/csm/:id', require('./routes/tencent/wechat/csm'));
|
||||||
router.get('/wechat/announce', require('./routes/tencent/wechat/announce'));
|
router.get('/wechat/announce', require('./routes/tencent/wechat/announce'));
|
||||||
router.get('/wechat/miniprogram/plugins', require('./routes/tencent/wechat/miniprogram/plugins'));
|
router.get('/wechat/miniprogram/plugins', require('./routes/tencent/wechat/miniprogram/plugins'));
|
||||||
|
router.get('/wechat/tgchannel/:id', require('./routes/tencent/wechat/tgchannel'));
|
||||||
|
|
||||||
// All the Flight Deals
|
// All the Flight Deals
|
||||||
router.get('/atfd/:locations/:nearby?', require('./routes/atfd/index'));
|
router.get('/atfd/:locations/:nearby?', require('./routes/atfd/index'));
|
||||||
|
|||||||
38
lib/routes/tencent/wechat/tgchannel.js
Normal file
38
lib/routes/tencent/wechat/tgchannel.js
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
const axios = require('@/utils/axios');
|
||||||
|
const cheerio = require('cheerio');
|
||||||
|
|
||||||
|
module.exports = async (ctx) => {
|
||||||
|
const id = ctx.params.id;
|
||||||
|
|
||||||
|
const { data } = await axios.get(`https://t.me/s/${id}`);
|
||||||
|
const $ = cheerio.load(data);
|
||||||
|
const list = $('.tgme_widget_message_wrap');
|
||||||
|
|
||||||
|
const out = await Promise.all(
|
||||||
|
list
|
||||||
|
.map((index, item) => {
|
||||||
|
item = $(item);
|
||||||
|
const title = item.find('.tgme_widget_message_text > a:nth-child(2)').text();
|
||||||
|
const link = item.find('.tgme_widget_message_text > a:nth-child(2)').attr('href');
|
||||||
|
const pubDate = new Date(item.find('.tgme_widget_message_date time').attr('datetime')).toUTCString();
|
||||||
|
const description = item.find('.tgme_widget_message_text').html();
|
||||||
|
|
||||||
|
const single = {
|
||||||
|
title,
|
||||||
|
pubDate,
|
||||||
|
link,
|
||||||
|
description,
|
||||||
|
};
|
||||||
|
|
||||||
|
return single;
|
||||||
|
})
|
||||||
|
.get()
|
||||||
|
);
|
||||||
|
|
||||||
|
out.reverse();
|
||||||
|
ctx.state.data = {
|
||||||
|
title: $('.tgme_channel_info_header_title').text(),
|
||||||
|
link: `https://t.me/s/${id}`,
|
||||||
|
item: out,
|
||||||
|
};
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user