{"record":{"id":"788cc8b1333c55f5","repo":"DIYgod/RSSHub","slug":"unable-to-fetch-message-feed-from-this-channel-pl","errorCode":null,"errorMessage":"Unable to fetch message feed from this channel. Please check this URL to see if you can view the message preview: ${resourceUrl}","messagePattern":"Unable to fetch message feed from this channel\\. Please check this URL to see if you can view the message preview: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":503,"severity":"error","filePath":"lib/routes/telegram/channel.ts","lineNumber":236,"sourceCode":"     */\n    $('a[onclick][href]').each((_, elem) => {\n        const $elem = $(elem);\n        const href = $elem.attr('href');\n        href && $elem.attr('href', href.replaceAll('&amp;', '&'));\n    });\n\n    !showHashtagAsHyperlink &&\n        $('a[href^=\"?q=%23\"]').each((_, elem) => {\n            const $elem = $(elem);\n            $elem.replaceWith($elem.text());\n        });\n\n    const list = includeServiceMsg\n        ? $('.tgme_widget_message_wrap:not(.tgme_widget_message_wrap:has(.tme_no_messages_found))') // exclude 'no posts found' messages\n        : $('.tgme_widget_message_wrap:not(.tgme_widget_message_wrap:has(.service_message,.tme_no_messages_found))'); // also exclude service messages\n\n    if (list.length === 0 && $('.tgme_channel_history').length === 0) {\n        throw new Error(`Unable to fetch message feed from this channel. Please check this URL to see if you can view the message preview: ${resourceUrl}`);\n    }\n\n    const channelName = $('.tgme_channel_info_header_title').text();\n    const feedTitle = (searchQuery ? `\"${searchQuery}\" - ` : '') + channelName + ' - Telegram Channel';\n\n    return {\n        title: feedTitle,\n        description: $('.tgme_channel_info_description').text(),\n        link: resourceUrl,\n        allowEmpty: true,\n\n        itunes_author: channelName,\n        image: $('.tgme_page_photo_image > img').attr('src'),\n\n        item: list\n            .toArray()\n            .map((item) => {\n                const $item = $(item);","sourceCodeStart":218,"sourceCodeEnd":254,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/telegram/channel.ts#L218-L254","documentation":"After scraping a Telegram channel preview page (t.me/s/<channel>), the parser looks for .tgme_widget_message_wrap entries (optionally excluding service messages). If it finds zero message wraps AND zero .tgme_channel_history containers, it concludes the channel feed is not viewable and tells the user to open the URL to confirm.","triggerScenarios":"The channel is private (no public preview), restricted/geo-blocked, deleted, or Telegram returned a 'tme_no_messages_found'/login wall instead of the widget HTML. The scraper got a page but no recognizable message containers.","commonSituations":"Subscribing to a private channel that has no public t.me/s view; the channel was banned or deleted; the requesting IP hit a rate-limit/login interstitial; tgme markup changed and selectors no longer match.","solutions":["Open resourceUrl in a browser to confirm the channel is publicly viewable; if it requires login, the public RSS cannot reach it.","Verify the tgme_widget_message_wrap / tgme_channel_history selectors still match the current Telegram preview markup.","Use a cleaner IP or proxy if Telegram is serving an interstitial instead of the widget HTML.","For a legitimately private channel, configure TELEGRAM_SESSION and use the MTProto-based media route instead of the public scraper."],"exampleFix":"// before\nif (list.length === 0 && $('.tgme_channel_history').length === 0) {\n    throw new Error(`Unable to fetch message feed from this channel. Please check this URL to see if you can view the message preview: ${resourceUrl}`);\n}\n\n// after: distinguish 'private/login wall' from 'selector drift' for clearer errors\nif (list.length === 0 && $('.tgme_channel_history').length === 0) {\n    if ($('.tme_no_messages_found, .tgme_widget_login').length > 0) {\n        throw new Error(`Channel is private, restricted, or requires login: ${resourceUrl}`);\n    }\n    throw new Error(`No message containers found; Telegram preview markup may have changed: ${resourceUrl}`);\n}","handlingStrategy":"validation","validationCode":"function isChannelViewable($: cheerio.Root): boolean {\n    return $('.tgme_channel_history').length > 0 || $('.tgme_widget_message_wrap').length > 0;\n}\n// before building the feed:\n// if (!isChannelViewable($)) { surface a clear access error }","typeGuard":"function hasPublicPreview($: cheerio.CheerioAPI): boolean {\n    return $('.tgme_channel_history').length > 0 || $('.tgme_widget_message_wrap:not(:has(.tme_no_messages_found))').length > 0;\n}","tryCatchPattern":"try {\n    return await buildFeed(html, resourceUrl);\n} catch (e) {\n    if (e instanceof Error && /Unable to fetch message feed/.test(e.message)) {\n        // suggest the MTProto route if TELEGRAM_SESSION is configured\n        return suggestMtprotoRoute(resourceUrl);\n    }\n    throw e;\n}","preventionTips":["Confirm the channel is publicly viewable at t.me/s/<channel> before subscribing.","Keep the tgme_* selectors in sync with the current Telegram preview markup.","Use a clean IP/proxy to avoid login interstitials on the public preview.","For private channels, configure TELEGRAM_SESSION and prefer the MTProto-based routes."],"tags":["telegram","scraping","access","network"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}