Skip to content
Projects

z-mio/parse_hub_bot

View on GitHub

About

A Telegram bot for aggregating and parsing across multiple platforms.

Science & Engineering

How these counts are measured

Measured star growth

in 24h
+3
in 7 days
+8
in 15 days
+24
in 1 month
Collecting history

Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.

README.en.md

Original

🔗 ParseHubBot

Telegram Multi-Platform Content Parsing Bot

License Python Telegram Bot uv

简体中文 | English

🤖 Live Demo · 📚 Related Project · 🐛 Report an Issue


Official bot: @ParseHubot

✨ Features

  • 🎬 Multi-platform parsing — Parse content from 20+ major platforms, including Douyin, Bilibili, YouTube, Xiaohongshu, and Twitter
  • ⚡ Inline mode — Parse a link from any chat by typing @BotUsername <link>
  • 👥 Guest mode — Mention @BotUsername in any chat to parse, no need to add the bot first
  • 🖼️ Telegram-ready media — Automatic transcoding, long-image splitting, and large-video segmentation
  • 📦 Multiple delivery modes — Online preview, original file, or packaged download
  • 🐳 Docker deployment — Ready to use out of the box

📦 Supported Platforms

Platform Video Image Posts Other
Twitter / X ✅ ✅ 📝 Articles
Instagram ✅ ✅
YouTube ✅ 🎵 Music
Facebook ✅
Threads ✅ ✅
Bilibili ✅ 📝 Updates, 🎵 Music
Douyin ✅ ✅ ☀️ Daily posts
TikTok ✅ ✅
Weibo ✅ ✅
Xiaohongshu ✅ ✅
Tieba ✅ ✅
WeChat OA ✅
WeChat Channels ✅
Kuaishou ✅ ✅
Coolapk ✅
Pipixia ✅ ✅
Zuiyou ✅ ✅
Xiaoheihe ✅ ✅
Snapchat ✅
Zhihu ✅ ✅ 🐶 Questions, columns, circles, Daily
Douban ✅ ✅ 👥 Group topics
Bangumi ✅ 💬 Subject discussions, blogs, group topics
Toutiao ✅ ✅ 📰 Articles, Weitoutiao posts
Medium ✅ ✅ 📰 Articles
Jandan ✅ 📰 Articles, 💬 Topics

🔧 More platforms are being added continuously...

🚀 Quick Start

🐳 Run with Docker (recommended)

mkdir parse_hub_bot && cd parse_hub_bot

docker run -d \
  --restart=always \
  -e API_ID=YOUR_API_ID \
  -e API_HASH=YOUR_API_HASH \
  -e BOT_TOKEN=YOUR_BOT_TOKEN \
  -e ADMIN_IDS=YOUR_TG_USER_ID \
  -v ./logs:/app/logs \
  -v ./data:/app/data \
  --name parse-hub-bot \
  ghcr.io/z-mio/parse_hub_bot:latest

💻 Run from Source

uv sync
uv run bot.py

⚙️ Configuration

  • Environment variables: Required base configuration
  • Platform configuration (optional): Per-platform proxies and cookies

📝 Environment Variables

# ✅ Required
API_ID=        # Telegram API ID; obtain it at https://my.telegram.org
API_HASH=      # Telegram API Hash; obtain it at the same place
BOT_TOKEN=     # Bot token; create one via @BotFather

# 🔲 Optional
BOT_PROXY=     # Proxy for the bot's Telegram connection, e.g. http://127.0.0.1:7890
ADMIN_IDS=     # Telegram user IDs of admins, comma-separated, e.g. 123456789,987654321
               # Admins can use /admin in private chat to manage platform config and receive cookie failure alerts

🌐 Platform Configuration

Configure proxies and cookies for each parser platform. Managing them online with /admin is recommended — changes take effect immediately, no restart required.

🛠️ Online Management

  1. Set ADMIN_IDS in .env
  2. Send /admin to the bot in a private chat to open the config panel
  • Global default proxies — Set the default parser / downloader proxy pools
  • Platform config — Choose a proxy mode per platform (global / dedicated / direct) and manage dedicated proxy pools and cookies
  • One-click testing — Test proxy connectivity; send a link to parse it with each selected cookie and check whether it works
  • Failure alerts — Admins are notified when a cookie fails to parse 3 times in a row, with shortcuts to replace it and retry the original link
  • Import / Export — Export a full config backup, or import a file / YAML to replace the whole config; after editing the file manually, tap "Reload Configuration" to apply it

🔀 Proxy Priority

Parser and downloader proxies each use the same priority order:

Disable proxy (disable_*_proxy: true)
  ↓ if not disabled
Platform-specific proxy (parser_proxies / downloader_proxies)
  ↓ if not configured
Global default proxy (default_parser_proxies / default_downloader_proxies)
  ↓ if not configured
Direct connection (no proxy)

💡 When a proxy pool contains multiple addresses, one is selected at random for every request.

🍪 Platforms Supporting Cookies

  • Twitter / X
  • Instagram
  • Threads
  • YouTube
  • Bilibili
  • Douyin
  • TikTok
  • Kuaishou
  • Xiaohongshu
  • Zhihu
  • Douban
  • WeChat Channels (requires the Cookie from Tencent Yuanbao yuanbao.tencent.com after logging in)
📄 Edit the config file manually

The config file is located at data/config/platform_config.yaml and can also be edited directly. After editing, tap "Reload Configuration" in /admin or restart the bot to apply the changes.

# ═══════════════════════ Global default proxies ═══════════════════════
# A platform without an individual proxy configuration uses the global default.
# A proxy may be a single address (string) or a pool of addresses (list, selected at random).
# Supported schemes: http://, https://, socks5://, socks5h://

default_parser_proxies: http://127.0.0.1:7890        # Parser proxy (single)
default_downloader_proxies: # Downloader proxy (pool)
  - http://127.0.0.1:7890
  - http://127.0.0.1:7891

# ═══════════════════════ Per-platform configuration ═══════════════════════
platforms:
  <platform_id>: # Platform ID; see the supported-platform list below
    disable_parser_proxy: false          # Disable parser proxy (use direct connection)
    disable_downloader_proxy: false      # Disable downloader proxy (use direct connection)
    parser_proxies: # Dedicated parser proxy pool for this platform
      - http://proxy1:port
    downloader_proxies: # Dedicated downloader proxy pool for this platform
      - http://proxy2:port
    cookies: # Cookie list for this platform (selected at random)
      - "cookie_string_1"
      - "cookie_string_2"

🔑 Supported Platform IDs

<platform_id> must be one of the following valid platform IDs:

Platform ID Platform Platform ID Platform
twitter Twitter / X instagram Instagram
youtube YouTube facebook Facebook
threads Threads bilibili Bilibili
douyin Douyin tiktok TikTok
weibo Weibo xhs Xiaohongshu
tieba Baidu Tieba weixin WeChat OA
weixin_channels WeChat Channels kuaishou Kuaishou
coolapk Coolapk pipix Pipixia
zuiyou Zuiyou xiaoheihe Xiaoheihe
snapchat Snapchat zhihu Zhihu
douban Douban bangumi Bangumi
toutiao Toutiao medium Medium
jandan Jandan

📌 Configuration Examples

Example 1: Use direct connections for mainland Chinese platforms and a proxy for overseas platforms
default_parser_proxies: http://127.0.0.1:7890
default_downloader_proxies: http://127.0.0.1:7890

platforms:
  bilibili:
    disable_parser_proxy: true
    disable_downloader_proxy: true
  douyin:
    disable_parser_proxy: true
    disable_downloader_proxy: true
  xhs:
    disable_parser_proxy: true
    disable_downloader_proxy: true
Example 2: Configure a Twitter cookie and use the global proxy
default_parser_proxies: http://127.0.0.1:7890
default_downloader_proxies: http://127.0.0.1:7890

platforms:
  twitter:
    cookies:
      - "auth_token=your_token_here; ct0=your_ct0_here"
Example 3: Use a dedicated proxy pool for YouTube
platforms:
  youtube:
    parser_proxies:
      - http://proxy-us-1:8080
      - http://proxy-us-2:8080
      - http://proxy-eu-1:8080
    downloader_proxies:
      - http://proxy-us-1:8080
      - http://proxy-eu-1:8080
Example 4: Rotate Bilibili cookies, parse directly, and use a proxy for downloads
platforms:
  bilibili:
    disable_parser_proxy: true
    downloader_proxies:
      - http://127.0.0.1:7890
    cookies:
      - "SESSDATA=xxx; bili_jct=xxx; buvid3=xxx"
      - "SESSDATA=yyy; bili_jct=yyy; buvid3=yyy"

🤝 Contributing

Pull requests and issues are welcome!

  • For core parsing features, please visit ParseHub.
  • When reporting a bug, please include the relevant URL and log information.

Development Guidelines

Before submitting code, run at least:

ruff format && ruff check --fix && uv run mypy
uv run pytest

📄 License

This project is released under the MIT License.


If this project helps you, please consider giving it a ⭐ Star!

Explore related projects

Loading…