diff --git a/lib/routes/telegram/channel.js b/lib/routes/telegram/channel.js index 14c4a941f5..b6901536af 100644 --- a/lib/routes/telegram/channel.js +++ b/lib/routes/telegram/channel.js @@ -10,12 +10,17 @@ module.exports = async (ctx) => { const $ = cheerio.load(data); const list = $('.tgme_widget_message_wrap'); + if (list.length === 0 && $('.tgme_channel_history').length === 0) { + throw `Unable to fetch message feed from this channel. Please check this URL to see if you can view the message preview: https://t.me/s/${username}`; + } + const feedTitle = searchQuery ? `「${searchQuery}」- ` + $('.tgme_channel_info_header_title').text() + ' - Telegram 频道' : $('.tgme_channel_info_header_title').text() + ' - Telegram 频道'; ctx.state.data = { title: feedTitle, description: $('.tgme_channel_info_description').text(), link: resourceUrl, + allowEmpty: true, item: list && list