mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-13 00:35:57 +08:00
Fix(route): remove next() and change to V2 (#8844)
This commit is contained in:
@@ -1993,28 +1993,6 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
't.me': {
|
|
||||||
_name: 'Telegram',
|
|
||||||
'.': [
|
|
||||||
{
|
|
||||||
title: '频道',
|
|
||||||
docs: 'https://docs.rsshub.app/social-media.html#telegram',
|
|
||||||
source: '/:username',
|
|
||||||
target: (params, url, document) => {
|
|
||||||
const isChannel = document && document.querySelector('.tgme_action_button_label');
|
|
||||||
if (isChannel) {
|
|
||||||
return '/telegram/channel/:username';
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: '频道',
|
|
||||||
docs: 'https://docs.rsshub.app/social-media.html#telegram',
|
|
||||||
source: '/s/:username',
|
|
||||||
target: '/telegram/channel/:username',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
'zhuixinfan.com': {
|
'zhuixinfan.com': {
|
||||||
_name: '追新番日剧站',
|
_name: '追新番日剧站',
|
||||||
'.': [
|
'.': [
|
||||||
|
|||||||
@@ -269,11 +269,6 @@ router.get('/v2ex/topics/:type', lazyloadRouteHandler('./routes/v2ex/topics'));
|
|||||||
router.get('/v2ex/post/:postid', lazyloadRouteHandler('./routes/v2ex/post'));
|
router.get('/v2ex/post/:postid', lazyloadRouteHandler('./routes/v2ex/post'));
|
||||||
router.get('/v2ex/tab/:tabid', lazyloadRouteHandler('./routes/v2ex/tab'));
|
router.get('/v2ex/tab/:tabid', lazyloadRouteHandler('./routes/v2ex/tab'));
|
||||||
|
|
||||||
// Telegram
|
|
||||||
router.get('/telegram/channel/:username/:searchQuery?', lazyloadRouteHandler('./routes/telegram/channel'));
|
|
||||||
router.get('/telegram/stickerpack/:name', lazyloadRouteHandler('./routes/telegram/stickerpack'));
|
|
||||||
router.get('/telegram/blog', lazyloadRouteHandler('./routes/telegram/blog'));
|
|
||||||
|
|
||||||
// readhub
|
// readhub
|
||||||
router.get('/readhub/category/:category', lazyloadRouteHandler('./routes/readhub/category'));
|
router.get('/readhub/category/:category', lazyloadRouteHandler('./routes/readhub/category'));
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
const cherrio = require('cheerio');
|
const cherrio = require('cheerio');
|
||||||
const got = require('@/utils/got');
|
const got = require('@/utils/got');
|
||||||
|
const { parseDate } = require('@/utils/parse-date');
|
||||||
|
|
||||||
module.exports = async (ctx, next) => {
|
module.exports = async (ctx) => {
|
||||||
const link = 'https://telegram.org/blog';
|
const link = 'https://telegram.org/blog';
|
||||||
|
|
||||||
const res = await got(link);
|
const res = await got(link);
|
||||||
@@ -19,7 +20,7 @@ module.exports = async (ctx, next) => {
|
|||||||
return {
|
return {
|
||||||
title: $('#dev_page_title').text(),
|
title: $('#dev_page_title').text(),
|
||||||
link,
|
link,
|
||||||
pubDate: new Date($('[property="article:published_time"]').attr('content')).toUTCString(),
|
pubDate: parseDate($('[property="article:published_time"]').attr('content')),
|
||||||
description: $('#dev_page_content_wrap').html(),
|
description: $('#dev_page_content_wrap').html(),
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
@@ -31,5 +32,4 @@ module.exports = async (ctx, next) => {
|
|||||||
link,
|
link,
|
||||||
item: items,
|
item: items,
|
||||||
};
|
};
|
||||||
await next();
|
|
||||||
};
|
};
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
const got = require('@/utils/got');
|
const got = require('@/utils/got');
|
||||||
const cheerio = require('cheerio');
|
const cheerio = require('cheerio');
|
||||||
|
const { parseDate } = require('@/utils/parse-date');
|
||||||
|
|
||||||
module.exports = async (ctx) => {
|
module.exports = async (ctx) => {
|
||||||
const username = ctx.params.username;
|
const username = ctx.params.username;
|
||||||
@@ -187,7 +188,7 @@ module.exports = async (ctx) => {
|
|||||||
const attachmentTitle = item.find('.tgme_widget_message_document_title').length ? item.find('.tgme_widget_message_document_title').text() + ' / ' + item.find('.tgme_widget_message_document_extra').text() : '';
|
const attachmentTitle = item.find('.tgme_widget_message_document_title').length ? item.find('.tgme_widget_message_document_title').text() + ' / ' + item.find('.tgme_widget_message_document_extra').text() : '';
|
||||||
|
|
||||||
/* pubDate */
|
/* pubDate */
|
||||||
const pubDate = new Date(item.find('.tgme_widget_message_date time').attr('datetime')).toUTCString();
|
const pubDate = parseDate(item.find('.tgme_widget_message_date time').attr('datetime'));
|
||||||
|
|
||||||
/* message text & title */
|
/* message text & title */
|
||||||
const messageTextObject = item.find('.tgme_widget_message_bubble > .tgme_widget_message_text');
|
const messageTextObject = item.find('.tgme_widget_message_bubble > .tgme_widget_message_text');
|
||||||
5
lib/v2/telegram/maintainer.js
Normal file
5
lib/v2/telegram/maintainer.js
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
module.exports = {
|
||||||
|
'/telegram/channel/:username/:searchQuery?': ['DIYgod'],
|
||||||
|
'/telegram/stickerpack/:name': ['DIYgod'],
|
||||||
|
'/telegram/blog': ['fengkx'],
|
||||||
|
};
|
||||||
35
lib/v2/telegram/radar.js
Normal file
35
lib/v2/telegram/radar.js
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
module.exports = {
|
||||||
|
't.me': {
|
||||||
|
_name: 'Telegram',
|
||||||
|
'.': [
|
||||||
|
{
|
||||||
|
title: '频道',
|
||||||
|
docs: 'https://docs.rsshub.app/social-media.html#telegram',
|
||||||
|
source: '/:username',
|
||||||
|
target: (params, url, document) => {
|
||||||
|
const isChannel = document && document.querySelector('.tgme_action_button_label');
|
||||||
|
if (isChannel) {
|
||||||
|
return '/telegram/channel/:username';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '频道',
|
||||||
|
docs: 'https://docs.rsshub.app/social-media.html#telegram',
|
||||||
|
source: '/s/:username',
|
||||||
|
target: '/telegram/channel/:username',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
'telegram.org': {
|
||||||
|
_name: 'Telegram',
|
||||||
|
'.': [
|
||||||
|
{
|
||||||
|
title: 'Telegram Blog',
|
||||||
|
docs: 'https://docs.rsshub.app/social-media.html#telegram-telegram-blog',
|
||||||
|
source: '/blog',
|
||||||
|
target: '/telegram/blog',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
};
|
||||||
5
lib/v2/telegram/router.js
Normal file
5
lib/v2/telegram/router.js
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
module.exports = function (router) {
|
||||||
|
router.get('/channel/:username/:searchQuery?', require('./channel'));
|
||||||
|
router.get('/stickerpack/:name', require('./stickerpack'));
|
||||||
|
router.get('/blog', require('./blog'));
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user