diff --git a/README.md b/README.md index 6587ec6..ebc2bb9 100644 --- a/README.md +++ b/README.md @@ -9,9 +9,9 @@ English | [简体中文](./README.zh-cn.md) ## ✨ Features - **Turn your Telegram Channel into a MicroBlog** -- **SEO friendly** +- **SEO friendly** `/sitemap.xml` - **0 JS on the browser side** -- **RSS and RSS JSON** +- **RSS and RSS JSON** `/rss.xml` `/rss.json` ## 🪧 Demo @@ -61,7 +61,7 @@ For detailed tutorials, see [Deploy your Astro site](https://docs.astro.build/en ## ⚒️ Configuration ```env -## Telegram channel name, required +## Telegram Channel Username, must be configured. The string of characters following t.me/ CHANNEL=miantiao_me ## Language and timezone settings, language options see [dayjs](https://github.com/iamkun/dayjs/tree/dev/src/locale) @@ -97,6 +97,15 @@ HOST=telegram.dog STATIC_PROXY= ``` +## 🙋🏻 FAQs + +1. Why is the content empty after deployment? + - Check if the channel is public, it must be public + - The channel username is a string, not a number + - Turn off the "Restricting Saving Content" setting in the channel + - Redeploy after modifying environment variables + - Telegram blocks public display of some sensitive channels, you can verify by visiting `https://t.me/s/channelusername`. + ## ☕ Sponsor 1. [Follow me on Telegram](https://t.me/miantiao_me) diff --git a/README.zh-cn.md b/README.zh-cn.md index 510916e..ec3cdc9 100644 --- a/README.zh-cn.md +++ b/README.zh-cn.md @@ -9,9 +9,9 @@ ## ✨ 特性 - **将 Telegram Channel 转为微博客** -- **SEO 友好** +- **SEO 友好** `/sitemap.xml` - **浏览器端 0 JS** -- **提供 RSS 和 RSS JSON** +- **提供 RSS 和 RSS JSON** `/rss.xml` `/rss.json` ## 🪧 演示 @@ -61,7 +61,7 @@ ## ⚒️ 配置 ```env -## Telegram 频道名称,必须配置 +## Telegram 频道用户名,必须配置。 t.me/ 后面那串字符 CHANNEL=miantiao_me ## 语言和时区设置,语言选项见[dayjs](https://github.com/iamkun/dayjs/tree/dev/src/locale) @@ -95,6 +95,15 @@ HOST=telegram.dog STATIC_PROXY= ``` +## 🙋🏻 常问问题 + +1. 为什么部署后内容为空? + - 检查频道是否是公开的,必须是公开的 + - 频道用户名是字符串,不是数字 + - 关闭频道 Restricting Saving Content 设置项 + - 修改完环境变量后需要重新部署 + - Telegram 会屏蔽一些敏感频道的公开展示, 可以通过访问 `https://t.me/s/频道用户名` 确认 + ## ☕ 赞助 1. [在 Telegram 关注我](https://t.me/miantiao_me) diff --git a/src/lib/telegram/index.js b/src/lib/telegram/index.js index 5d1b45f..bd13182 100644 --- a/src/lib/telegram/index.js +++ b/src/lib/telegram/index.js @@ -115,7 +115,7 @@ function getPost($, item, { channel, staticProxy, index = 0 }) { const content = $(item).find('.js-message_reply_text')?.length > 0 ? modifyHTMLContent($, $(item).find('.tgme_widget_message_text.js-message_text'), { index }) : modifyHTMLContent($, $(item).find('.tgme_widget_message_text'), { index }) - const title = content?.text()?.match(/[^。\n]*(?=[。\n]|http)/g)?.[0] ?? content?.text() ?? '' + const title = content?.text()?.match(/^.*?(?=[。::]|http\S)/g)?.[0] ?? content?.text() ?? '' const id = $(item).attr('data-post')?.replace(`${channel}/`, '') const tags = $(content).find('a[href^="?q="]')?.each((_index, a) => {