feat: add warnings for blocked telegram channels (#5439)

This commit is contained in:
notofoe 2020-08-19 04:02:10 +08:00 committed by GitHub
parent 49aa77d360
commit 3fbf70ad43
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -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