Skip to main content

轻量、异步、开箱即用的社交媒体聚合解析库

Project description

🔗 ParseHub

社交媒体聚合解析器

PyPI version Python License: MIT GitHub stars

轻量、异步、开箱即用的社交媒体聚合解析库,支持 16+ 平台 🚀

快速开始 · 支持平台 · 高级用法 · TG Bot


✨ 特性

  • 🌍 广泛的平台支持 — 覆盖国内外 16+ 主流社交媒体
  • 🧹 隐私保护 — 自动清除链接中的跟踪参数, 返回干净的原始链接
  • 🎬 多媒体支持 — 视频 / 图文 / 动图 / 实况照片,一网打尽
  • 📦 开箱即用async/await 原生支持,API 极简
  • 🤖 Telegram Bot — 基于本项目的 Bot 已上线 → @ParsehuBot

📦 安装

# pip
pip install parsehub

# uv (推荐)
uv add parsehub

要求 Python ≥ 3.12

🚀 快速开始

from parsehub import ParseHub

result = ParseHub().parse_sync("https://www.xiaoheihe.cn/app/bbs/link/174972336")
print(result)
# ImageParseResult(platform=小黑盒, title=名为希望和绝望的红包, content=[cube_doge][cube_doge][cube_doge], media=[17], raw_url=https://www.xiaoheihe.cn/app/bbs/link/174972336)

下载媒体

from parsehub import ParseHub

result = ParseHub().download_sync("https://www.xiaoheihe.cn/app/bbs/link/174972336")
print(result)
# DownloadResult(media=[ImageFile(path='D:\\downloads\\名为希望和绝望的红包\\0.jpg', width=1773, height=2364), ...], output_dir=D:\downloads\名为希望和绝望的红包)

🌐 支持平台

平台 视频 图文 其他
Twitter / X
Instagram
YouTube 🎵 音乐
Facebook
Threads
Bilibili 📝 动态
抖音 / TikTok
微博
小红书
贴吧
微信公众号
快手
酷安
皮皮虾
最右
小黑盒

🔧 更多平台持续接入中...

🔑 高级用法

Cookie 登录 & 代理

部分平台的内容需要登录才能访问,通过 Cookie 即可解锁:

from parsehub import ParseHub
from parsehub.config import ParseConfig

config = ParseConfig(
    cookie="key1=value1; key2=value2",  # 从浏览器中获取
    proxy="http://127.0.0.1:7890",  # 可选
)
ph = ParseHub(config=config)

Cookie 支持多种格式传入:

# 字符串
ParseConfig(cookie="key1=value1; key2=value2")

# JSON 字符串
ParseConfig(cookie='{"key1": "value1", "key2": "value2"}')

# 字典
ParseConfig(cookie={"key1": "value1", "key2": "value2"})

目前支持 Cookie 登录的平台:

Twitter · Instagram · Kuaishou · Bilibili · YouTube

全局配置

from parsehub.config import GlobalConfig

# 自定义默认下载目录
GlobalConfig.default_save_dir = "./my_downloads"

# 视频时长限制 (超过此时长将下载最低画质,0 为不限制)
GlobalConfig.duration_limit = 600  # 秒

🤝 参考项目

📜 开源协议

本项目基于 MIT License 开源。


如果这个项目对你有帮助,欢迎点个 ⭐ Star!

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

parsehub-2.0.0.tar.gz (54.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

parsehub-2.0.0-py3-none-any.whl (71.1 kB view details)

Uploaded Python 3

File details

Details for the file parsehub-2.0.0.tar.gz.

File metadata

  • Download URL: parsehub-2.0.0.tar.gz
  • Upload date:
  • Size: 54.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for parsehub-2.0.0.tar.gz
Algorithm Hash digest
SHA256 f6b97b64f119d7fbf964f347a64a1152c5e9d34609eb41c40585b9249e88dcc7
MD5 53ec9bb8c48eccd4ecaed0b85ae08fe6
BLAKE2b-256 c49fdbc8abb2b7d71f80ce9df524cf1edead11d054ed0e62a043390eeccb6d7f

See more details on using hashes here.

Provenance

The following attestation bundles were made for parsehub-2.0.0.tar.gz:

Publisher: python-publish.yml on z-mio/ParseHub

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file parsehub-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: parsehub-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 71.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for parsehub-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 adc839903404171eecef938f36fbbd43f05aaa73428bb105f270c84617d592e6
MD5 9ebcc57f2309b7c54e684f53cd7fb0fe
BLAKE2b-256 1b7c045df66921acb6f652d47e1073483074b0d0605ad47737dae4b554333d71

See more details on using hashes here.

Provenance

The following attestation bundles were made for parsehub-2.0.0-py3-none-any.whl:

Publisher: python-publish.yml on z-mio/ParseHub

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page