parsehub 2.0.4__tar.gz → 2.0.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. {parsehub-2.0.4 → parsehub-2.0.6}/LICENSE +21 -21
  2. {parsehub-2.0.4/src/parsehub.egg-info → parsehub-2.0.6}/PKG-INFO +197 -178
  3. {parsehub-2.0.4 → parsehub-2.0.6}/README.md +160 -141
  4. {parsehub-2.0.4 → parsehub-2.0.6}/pyproject.toml +1 -1
  5. {parsehub-2.0.4 → parsehub-2.0.6}/setup.cfg +4 -4
  6. {parsehub-2.0.4 → parsehub-2.0.6}/src/parsehub/__init__.py +203 -166
  7. {parsehub-2.0.4 → parsehub-2.0.6}/src/parsehub/config/__init__.py +3 -3
  8. {parsehub-2.0.4 → parsehub-2.0.6}/src/parsehub/config/config.py +20 -20
  9. {parsehub-2.0.4 → parsehub-2.0.6}/src/parsehub/errors.py +29 -29
  10. {parsehub-2.0.4 → parsehub-2.0.6}/src/parsehub/parsers/base/__init__.py +4 -4
  11. {parsehub-2.0.4 → parsehub-2.0.6}/src/parsehub/parsers/base/base.py +148 -107
  12. {parsehub-2.0.4 → parsehub-2.0.6}/src/parsehub/parsers/base/ytdlp.py +209 -207
  13. {parsehub-2.0.4 → parsehub-2.0.6}/src/parsehub/parsers/parser/__init__.py +15 -15
  14. {parsehub-2.0.4 → parsehub-2.0.6}/src/parsehub/parsers/parser/bilibili.py +187 -188
  15. {parsehub-2.0.4 → parsehub-2.0.6}/src/parsehub/parsers/parser/coolapk.py +89 -88
  16. {parsehub-2.0.4 → parsehub-2.0.6}/src/parsehub/parsers/parser/douyin.py +168 -170
  17. {parsehub-2.0.4 → parsehub-2.0.6}/src/parsehub/parsers/parser/facebook.py +11 -11
  18. {parsehub-2.0.4 → parsehub-2.0.6}/src/parsehub/parsers/parser/instagram.py +94 -94
  19. {parsehub-2.0.4 → parsehub-2.0.6}/src/parsehub/parsers/parser/kuaishou.py +31 -32
  20. {parsehub-2.0.4 → parsehub-2.0.6}/src/parsehub/parsers/parser/pipix.py +35 -36
  21. {parsehub-2.0.4 → parsehub-2.0.6}/src/parsehub/parsers/parser/threads.py +25 -25
  22. {parsehub-2.0.4 → parsehub-2.0.6}/src/parsehub/parsers/parser/tieba.py +25 -25
  23. {parsehub-2.0.4 → parsehub-2.0.6}/src/parsehub/parsers/parser/twitter.py +69 -69
  24. {parsehub-2.0.4 → parsehub-2.0.6}/src/parsehub/parsers/parser/weibo.py +89 -90
  25. {parsehub-2.0.4 → parsehub-2.0.6}/src/parsehub/parsers/parser/weixin.py +20 -21
  26. {parsehub-2.0.4 → parsehub-2.0.6}/src/parsehub/parsers/parser/xhs.py +88 -90
  27. {parsehub-2.0.4 → parsehub-2.0.6}/src/parsehub/parsers/parser/xiaoheihe.py +49 -49
  28. {parsehub-2.0.4 → parsehub-2.0.6}/src/parsehub/parsers/parser/youtube.py +44 -44
  29. {parsehub-2.0.4 → parsehub-2.0.6}/src/parsehub/parsers/parser/zuiyou.py +25 -26
  30. {parsehub-2.0.4 → parsehub-2.0.6}/src/parsehub/provider_api/bilibili.py +566 -566
  31. {parsehub-2.0.4 → parsehub-2.0.6}/src/parsehub/provider_api/coolapk.py +38 -38
  32. {parsehub-2.0.4 → parsehub-2.0.6}/src/parsehub/provider_api/instagram.py +78 -78
  33. {parsehub-2.0.4 → parsehub-2.0.6}/src/parsehub/provider_api/kuaishou.py +153 -153
  34. {parsehub-2.0.4 → parsehub-2.0.6}/src/parsehub/provider_api/pipix.py +75 -75
  35. {parsehub-2.0.4 → parsehub-2.0.6}/src/parsehub/provider_api/threads.py +172 -172
  36. {parsehub-2.0.4 → parsehub-2.0.6}/src/parsehub/provider_api/tieba.py +74 -74
  37. {parsehub-2.0.4 → parsehub-2.0.6}/src/parsehub/provider_api/twitter.py +203 -203
  38. {parsehub-2.0.4 → parsehub-2.0.6}/src/parsehub/provider_api/weibo.py +297 -297
  39. {parsehub-2.0.4 → parsehub-2.0.6}/src/parsehub/provider_api/weixin.py +56 -56
  40. {parsehub-2.0.4 → parsehub-2.0.6}/src/parsehub/provider_api/xhs.py +146 -146
  41. {parsehub-2.0.4 → parsehub-2.0.6}/src/parsehub/provider_api/xiaoheihe.py +479 -479
  42. {parsehub-2.0.4 → parsehub-2.0.6}/src/parsehub/provider_api/zuiyou.py +59 -59
  43. {parsehub-2.0.4 → parsehub-2.0.6}/src/parsehub/types/__init__.py +43 -43
  44. {parsehub-2.0.4 → parsehub-2.0.6}/src/parsehub/types/callback.py +26 -25
  45. {parsehub-2.0.4 → parsehub-2.0.6}/src/parsehub/types/media_file.py +105 -105
  46. {parsehub-2.0.4 → parsehub-2.0.6}/src/parsehub/types/media_ref.py +90 -90
  47. {parsehub-2.0.4 → parsehub-2.0.6}/src/parsehub/types/post.py +11 -11
  48. {parsehub-2.0.4 → parsehub-2.0.6}/src/parsehub/types/result.py +373 -364
  49. {parsehub-2.0.4 → parsehub-2.0.6}/src/parsehub/utils/downloader.py +207 -202
  50. {parsehub-2.0.4 → parsehub-2.0.6}/src/parsehub/utils/media_info.py +106 -106
  51. {parsehub-2.0.4 → parsehub-2.0.6}/src/parsehub/utils/utils.py +69 -87
  52. {parsehub-2.0.4 → parsehub-2.0.6/src/parsehub.egg-info}/PKG-INFO +197 -178
  53. {parsehub-2.0.4 → parsehub-2.0.6}/src/__init__.py +0 -0
  54. {parsehub-2.0.4 → parsehub-2.0.6}/src/parsehub/parsers/__init__.py +0 -0
  55. {parsehub-2.0.4 → parsehub-2.0.6}/src/parsehub/provider_api/__init__.py +0 -0
  56. {parsehub-2.0.4 → parsehub-2.0.6}/src/parsehub/types/platform.py +0 -0
  57. {parsehub-2.0.4 → parsehub-2.0.6}/src/parsehub.egg-info/SOURCES.txt +0 -0
  58. {parsehub-2.0.4 → parsehub-2.0.6}/src/parsehub.egg-info/dependency_links.txt +0 -0
  59. {parsehub-2.0.4 → parsehub-2.0.6}/src/parsehub.egg-info/requires.txt +0 -0
  60. {parsehub-2.0.4 → parsehub-2.0.6}/src/parsehub.egg-info/top_level.txt +0 -0
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2024 梓澪
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2024 梓澪
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -1,178 +1,197 @@
1
- Metadata-Version: 2.4
2
- Name: parsehub
3
- Version: 2.0.4
4
- Summary: 轻量、异步、开箱即用的社交媒体聚合解析库
5
- Author-email: 梓澪 <zilingmio@gmail.com>
6
- License: MIT
7
- Project-URL: Repository, https://github.com/z-mio/parsehub
8
- Project-URL: Issues, https://github.com/z-mio/parsehub/issues
9
- Keywords: parser,video-downloader,social-media,crawler,parsehub
10
- Classifier: Programming Language :: Python :: 3.12
11
- Classifier: License :: OSI Approved :: MIT License
12
- Classifier: Operating System :: OS Independent
13
- Classifier: Topic :: Multimedia :: Video
14
- Classifier: Topic :: Software Development :: Libraries :: Python Modules
15
- Requires-Python: >=3.12.0
16
- Description-Content-Type: text/markdown
17
- License-File: LICENSE
18
- Requires-Dist: aiofiles>=23.2
19
- Requires-Dist: beautifulsoup4>=4.12.3
20
- Requires-Dist: loguru>=0.6.0
21
- Requires-Dist: opencv-python>=4.10.0.84
22
- Requires-Dist: pydub>=0.25.1
23
- Requires-Dist: python-dotenv>=1.0.1
24
- Requires-Dist: tenacity>=8.5.0
25
- Requires-Dist: urlextract>=1.9.0
26
- Requires-Dist: yt-dlp[default]
27
- Requires-Dist: lxml>=5.3.0
28
- Requires-Dist: instaloader>=4.14
29
- Requires-Dist: pydantic>=1.10.19
30
- Requires-Dist: markdownify>=1.1.0
31
- Requires-Dist: markdown>=3.7
32
- Requires-Dist: requests
33
- Requires-Dist: httpx>=0.24.1
34
- Requires-Dist: pillow>=12.1.0
35
- Requires-Dist: python-slugify[unidecode]>=8.0.4
36
- Dynamic: license-file
37
-
38
- <div align="center">
39
-
40
- # 🔗 ParseHub
41
-
42
- **社交媒体聚合解析器**
43
-
44
- [![PyPI version](https://img.shields.io/pypi/v/parsehub?color=blue&logo=pypi&logoColor=white)](https://pypi.org/project/parsehub/)
45
- [![Python](https://img.shields.io/badge/python-3.12+-blue?logo=python&logoColor=white)](https://www.python.org/)
46
- [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
47
- [![GitHub stars](https://img.shields.io/github/stars/z-mio/parsehub?style=social)](https://github.com/z-mio/parsehub)
48
-
49
- 轻量、异步、开箱即用的社交媒体聚合解析库,支持 16+ 平台 🚀
50
-
51
- [快速开始](#-快速开始) · [支持平台](#-支持平台) · [高级用法](#-高级用法) · [TG Bot](https://github.com/z-mio/parse_hub_bot)
52
-
53
- </div>
54
-
55
- ---
56
-
57
- ## ✨ 特性
58
-
59
- - 🌍 **广泛的平台支持** — 覆盖国内外 16+ 主流社交媒体
60
- - 🧹 **隐私保护** — 自动清除链接中的跟踪参数, 返回干净的原始链接
61
- - 🎬 **多媒体支持** — 视频 / 图文 / 动图 / 实况照片,一网打尽
62
- - 📦 **开箱即用** — `async/await` 原生支持,API 极简
63
- - 🤖 **Telegram Bot** — 基于本项目的 Bot 已上线 → [@ParsehuBot](https://t.me/ParsehuBot)
64
-
65
- ## 📦 安装
66
-
67
- ```bash
68
- # pip
69
- pip install parsehub
70
-
71
- # uv (推荐)
72
- uv add parsehub
73
- ```
74
-
75
- > 要求 Python ≥ 3.12
76
-
77
- ## 🚀 快速开始
78
-
79
- ```python
80
- from parsehub import ParseHub
81
-
82
- result = ParseHub().parse_sync("https://www.xiaoheihe.cn/app/bbs/link/174972336")
83
- print(result)
84
- # ImageParseResult(platform=小黑盒, title=名为希望和绝望的红包, content=[cube_doge][cube_doge][cube_doge], media=[17], raw_url=https://www.xiaoheihe.cn/app/bbs/link/174972336)
85
- ```
86
-
87
- ### 下载媒体
88
-
89
- ```python
90
- from parsehub import ParseHub
91
-
92
- result = ParseHub().download_sync("https://www.xiaoheihe.cn/app/bbs/link/174972336")
93
- print(result)
94
- # DownloadResult(media=[ImageFile(path='D:\\downloads\\名为希望和绝望的红包\\0.jpg', width=1773, height=2364), ...], output_dir=D:\downloads\名为希望和绝望的红包)
95
- ```
96
-
97
- ## 🌐 支持平台
98
-
99
- | 平台 | 视频 | 图文 | 其他 |
100
- |:----------------|:--:|:--:|:-----:|
101
- | **Twitter / X** | ✅ | ✅ | |
102
- | **Instagram** | ✅ | ✅ | |
103
- | **YouTube** | ✅ | | 🎵 音乐 |
104
- | **Facebook** | ✅ | | |
105
- | **Threads** | ✅ | ✅ | |
106
- | **Bilibili** | ✅ | | 📝 动态 |
107
- | **抖音 / TikTok** | ✅ | ✅ | |
108
- | **微博** | ✅ | ✅ | |
109
- | **小红书** | ✅ | ✅ | |
110
- | **贴吧** | ✅ | ✅ | |
111
- | **微信公众号** | | ✅ | |
112
- | **快手** | ✅ | | |
113
- | **酷安** | ✅ | ✅ | |
114
- | **皮皮虾** | ✅ | ✅ | |
115
- | **最右** | ✅ | ✅ | |
116
- | **小黑盒** | ✅ | ✅ | |
117
-
118
- > 🔧 更多平台持续接入中...
119
-
120
- ## 🔑 高级用法
121
-
122
- ### Cookie 登录 & 代理
123
-
124
- 部分平台的内容需要登录才能访问,通过 Cookie 即可解锁:
125
-
126
- ```python
127
- from parsehub import ParseHub
128
-
129
- ph = ParseHub(cookie="key1=value1; key2=value2", proxy="http://127.0.0.1:7890",)
130
- ```
131
-
132
- Cookie 支持多种格式传入:
133
-
134
- ```python
135
- # 字符串
136
- ParseHub(cookie="key1=value1; key2=value2")
137
-
138
- # JSON 字符串
139
- ParseHub(cookie='{"key1": "value1", "key2": "value2"}')
140
-
141
- # 字典
142
- ParseHub(cookie={"key1": "value1", "key2": "value2"})
143
- ```
144
-
145
- 目前支持 Cookie 登录的平台:
146
-
147
- `Twitter` · `Instagram` · `Kuaishou` · `Bilibili` · `YouTube`
148
-
149
- ### 全局配置
150
-
151
- ```python
152
- from parsehub.config import GlobalConfig
153
-
154
- # 自定义默认下载目录
155
- GlobalConfig.default_save_dir = "./my_downloads"
156
- ```
157
-
158
- ## 🤝 参考项目
159
-
160
- - [Evil0ctal/Douyin_TikTok_Download_API](https://github.com/Evil0ctal/Douyin_TikTok_Download_API)
161
- - [yt-dlp/yt-dlp](https://github.com/yt-dlp/yt-dlp)
162
- - [instaloader/instaloader](https://github.com/instaloader/instaloader)
163
- - [SocialSisterYi/bilibili-API-collect](https://github.com/SocialSisterYi/bilibili-API-collect)
164
- - [Nemo2011/bilibili-api](https://github.com/Nemo2011/bilibili-api)
165
-
166
- ## 📜 开源协议
167
-
168
- 本项目基于 [MIT License](LICENSE) 开源。
169
-
170
- ---
171
-
172
- <div align="center">
173
-
174
- **如果这个项目对你有帮助,欢迎点个 Star!**
175
-
176
- </div>
177
-
178
-
1
+ Metadata-Version: 2.4
2
+ Name: parsehub
3
+ Version: 2.0.6
4
+ Summary: 轻量、异步、开箱即用的社交媒体聚合解析库
5
+ Author-email: 梓澪 <zilingmio@gmail.com>
6
+ License: MIT
7
+ Project-URL: Repository, https://github.com/z-mio/parsehub
8
+ Project-URL: Issues, https://github.com/z-mio/parsehub/issues
9
+ Keywords: parser,video-downloader,social-media,crawler,parsehub
10
+ Classifier: Programming Language :: Python :: 3.12
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Topic :: Multimedia :: Video
14
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
15
+ Requires-Python: >=3.12.0
16
+ Description-Content-Type: text/markdown
17
+ License-File: LICENSE
18
+ Requires-Dist: aiofiles>=23.2
19
+ Requires-Dist: beautifulsoup4>=4.12.3
20
+ Requires-Dist: loguru>=0.6.0
21
+ Requires-Dist: opencv-python>=4.10.0.84
22
+ Requires-Dist: pydub>=0.25.1
23
+ Requires-Dist: python-dotenv>=1.0.1
24
+ Requires-Dist: tenacity>=8.5.0
25
+ Requires-Dist: urlextract>=1.9.0
26
+ Requires-Dist: yt-dlp[default]
27
+ Requires-Dist: lxml>=5.3.0
28
+ Requires-Dist: instaloader>=4.14
29
+ Requires-Dist: pydantic>=1.10.19
30
+ Requires-Dist: markdownify>=1.1.0
31
+ Requires-Dist: markdown>=3.7
32
+ Requires-Dist: requests
33
+ Requires-Dist: httpx>=0.24.1
34
+ Requires-Dist: pillow>=12.1.0
35
+ Requires-Dist: python-slugify[unidecode]>=8.0.4
36
+ Dynamic: license-file
37
+
38
+ <div align="center">
39
+
40
+ # 🔗 ParseHub
41
+
42
+ **社交媒体聚合解析器**
43
+
44
+ [![PyPI version](https://img.shields.io/pypi/v/parsehub?color=blue&logo=pypi&logoColor=white)](https://pypi.org/project/parsehub/)
45
+ [![Python](https://img.shields.io/badge/python-3.12+-blue?logo=python&logoColor=white)](https://www.python.org/)
46
+ [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
47
+ [![GitHub stars](https://img.shields.io/github/stars/z-mio/parsehub?style=social)](https://github.com/z-mio/parsehub)
48
+
49
+ 轻量、异步、开箱即用的社交媒体聚合解析库,支持 16+ 平台 🚀
50
+
51
+ [快速开始](#-快速开始) · [支持平台](#-支持平台) · [高级用法](#-高级用法) · [TG Bot](https://github.com/z-mio/parse_hub_bot)
52
+
53
+ </div>
54
+
55
+ ---
56
+
57
+ ## ✨ 特性
58
+
59
+ - 🌍 **广泛的平台支持** — 覆盖国内外 16+ 主流社交媒体
60
+ - 🧹 **隐私保护** — 自动清除链接中的跟踪参数, 返回干净的原始链接
61
+ - 🎬 **多媒体支持** — 视频 / 图文 / 动图 / 实况照片,一网打尽
62
+ - 📦 **开箱即用** — `async/await` 原生支持,API 极简
63
+ - 🤖 **Telegram Bot** — 基于本项目的 Bot 已上线 → [@ParsehuBot](https://t.me/ParsehuBot)
64
+
65
+ ## 📦 安装
66
+
67
+ ```bash
68
+ # pip
69
+ pip install parsehub
70
+
71
+ # uv (推荐)
72
+ uv add parsehub
73
+ ```
74
+
75
+ > 要求 Python ≥ 3.12
76
+
77
+ ## 🚀 快速开始
78
+
79
+ ```python
80
+ from parsehub import ParseHub
81
+
82
+ result = ParseHub().parse_sync("https://www.xiaoheihe.cn/app/bbs/link/174972336")
83
+ print(result)
84
+ # ImageParseResult(platform=小黑盒, title=名为希望和绝望的红包, content=[cube_doge][cube_doge][cube_doge], media=[17], raw_url=https://www.xiaoheihe.cn/app/bbs/link/174972336)
85
+ ```
86
+
87
+ ### 下载媒体
88
+
89
+ ```python
90
+ from parsehub import ParseHub
91
+
92
+ result = ParseHub().download_sync("https://www.xiaoheihe.cn/app/bbs/link/174972336")
93
+ print(result)
94
+ # DownloadResult(media=[ImageFile(path='D:\\downloads\\名为希望和绝望的红包\\0.jpg', width=1773, height=2364), ...], output_dir=D:\downloads\名为希望和绝望的红包)
95
+ ```
96
+
97
+ ## 🌐 支持平台
98
+
99
+ | 平台 | 视频 | 图文 | 其他 |
100
+ |:----------------|:--:|:--:|:-----:|
101
+ | **Twitter / X** | ✅ | ✅ | |
102
+ | **Instagram** | ✅ | ✅ | |
103
+ | **YouTube** | ✅ | | 🎵 音乐 |
104
+ | **Facebook** | ✅ | | |
105
+ | **Threads** | ✅ | ✅ | |
106
+ | **Bilibili** | ✅ | | 📝 动态 |
107
+ | **抖音 / TikTok** | ✅ | ✅ | |
108
+ | **微博** | ✅ | ✅ | |
109
+ | **小红书** | ✅ | ✅ | |
110
+ | **贴吧** | ✅ | ✅ | |
111
+ | **微信公众号** | | ✅ | |
112
+ | **快手** | ✅ | | |
113
+ | **酷安** | ✅ | ✅ | |
114
+ | **皮皮虾** | ✅ | ✅ | |
115
+ | **最右** | ✅ | ✅ | |
116
+ | **小黑盒** | ✅ | ✅ | |
117
+
118
+ > 🔧 更多平台持续接入中...
119
+
120
+ ## 🔑 高级用法
121
+
122
+ ### 下载进度回调
123
+
124
+ ```python
125
+ from parsehub import ParseHub
126
+
127
+
128
+ class ProgressTracker:
129
+ async def __call__(self, current: int, total: int, unit: str, *args, task_name: str = "", **kwargs):
130
+ print(f"[{task_name}] {current}/{total} ({unit})")
131
+
132
+
133
+ result = ParseHub().download_sync(
134
+ "https://example.com",
135
+ callback=ProgressTracker(),
136
+ callback_args=("extra_arg",),
137
+ callback_kwargs={"task_name": "demo"},
138
+ )
139
+ ```
140
+
141
+ ### Cookie 登录 & 代理
142
+
143
+ 部分平台的内容需要登录才能访问,通过 Cookie 即可解锁:
144
+
145
+ ```python
146
+ from parsehub import ParseHub
147
+
148
+ ph = ParseHub(cookie="key1=value1; key2=value2", proxy="http://127.0.0.1:7890", )
149
+ ```
150
+
151
+ Cookie 支持多种格式传入:
152
+
153
+ ```python
154
+ # 字符串
155
+ ParseHub(cookie="key1=value1; key2=value2")
156
+
157
+ # JSON 字符串
158
+ ParseHub(cookie='{"key1": "value1", "key2": "value2"}')
159
+
160
+ # 字典
161
+ ParseHub(cookie={"key1": "value1", "key2": "value2"})
162
+ ```
163
+
164
+ 目前支持 Cookie 登录的平台:
165
+
166
+ `Twitter` · `Instagram` · `Kuaishou` · `Bilibili` · `YouTube`
167
+
168
+ ### 全局配置
169
+
170
+ ```python
171
+ from parsehub.config import GlobalConfig
172
+
173
+ # 自定义默认下载目录
174
+ GlobalConfig.default_save_dir = "./my_downloads"
175
+ ```
176
+
177
+ ## 🤝 参考项目
178
+
179
+ - [Evil0ctal/Douyin_TikTok_Download_API](https://github.com/Evil0ctal/Douyin_TikTok_Download_API)
180
+ - [yt-dlp/yt-dlp](https://github.com/yt-dlp/yt-dlp)
181
+ - [instaloader/instaloader](https://github.com/instaloader/instaloader)
182
+ - [SocialSisterYi/bilibili-API-collect](https://github.com/SocialSisterYi/bilibili-API-collect)
183
+ - [Nemo2011/bilibili-api](https://github.com/Nemo2011/bilibili-api)
184
+
185
+ ## 📜 开源协议
186
+
187
+ 本项目基于 [MIT License](LICENSE) 开源。
188
+
189
+ ---
190
+
191
+ <div align="center">
192
+
193
+ **如果这个项目对你有帮助,欢迎点个 ⭐ Star!**
194
+
195
+ </div>
196
+
197
+