parsehub 2.1.3__tar.gz → 2.1.4__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.
- {parsehub-2.1.3/src/parsehub.egg-info → parsehub-2.1.4}/PKG-INFO +1 -1
- {parsehub-2.1.3 → parsehub-2.1.4}/pyproject.toml +1 -1
- {parsehub-2.1.3 → parsehub-2.1.4}/src/parsehub/parsers/parser/douyin.py +8 -7
- {parsehub-2.1.3 → parsehub-2.1.4/src/parsehub.egg-info}/PKG-INFO +1 -1
- {parsehub-2.1.3 → parsehub-2.1.4}/test/test_core_offline.py +1 -2
- {parsehub-2.1.3 → parsehub-2.1.4}/LICENSE +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/README.md +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/setup.cfg +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/src/__init__.py +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/src/parsehub/__init__.py +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/src/parsehub/cli.py +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/src/parsehub/cli_config.py +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/src/parsehub/config/__init__.py +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/src/parsehub/config/config.py +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/src/parsehub/errors.py +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/src/parsehub/parsers/__init__.py +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/src/parsehub/parsers/base/__init__.py +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/src/parsehub/parsers/base/base.py +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/src/parsehub/parsers/base/ytdlp.py +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/src/parsehub/parsers/parser/__init__.py +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/src/parsehub/parsers/parser/bilibili.py +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/src/parsehub/parsers/parser/coolapk.py +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/src/parsehub/parsers/parser/facebook.py +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/src/parsehub/parsers/parser/instagram.py +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/src/parsehub/parsers/parser/kuaishou.py +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/src/parsehub/parsers/parser/pipix.py +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/src/parsehub/parsers/parser/snapchat.py +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/src/parsehub/parsers/parser/threads.py +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/src/parsehub/parsers/parser/tieba.py +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/src/parsehub/parsers/parser/tiktok.py +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/src/parsehub/parsers/parser/twitter.py +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/src/parsehub/parsers/parser/weibo.py +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/src/parsehub/parsers/parser/weixin.py +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/src/parsehub/parsers/parser/xhs.py +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/src/parsehub/parsers/parser/xiaoheihe.py +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/src/parsehub/parsers/parser/youtube.py +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/src/parsehub/parsers/parser/zhihu.py +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/src/parsehub/parsers/parser/zuiyou.py +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/src/parsehub/provider_api/__init__.py +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/src/parsehub/provider_api/bilibili.py +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/src/parsehub/provider_api/coolapk.py +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/src/parsehub/provider_api/douyin.py +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/src/parsehub/provider_api/instagram.py +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/src/parsehub/provider_api/kuaishou.py +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/src/parsehub/provider_api/pipix.py +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/src/parsehub/provider_api/threads.py +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/src/parsehub/provider_api/tieba.py +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/src/parsehub/provider_api/tiktok.py +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/src/parsehub/provider_api/twitter.py +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/src/parsehub/provider_api/weibo.py +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/src/parsehub/provider_api/weixin.py +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/src/parsehub/provider_api/xhs.py +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/src/parsehub/provider_api/xiaoheihe.py +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/src/parsehub/provider_api/zhihu.py +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/src/parsehub/provider_api/zuiyou.py +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/src/parsehub/types/__init__.py +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/src/parsehub/types/callback.py +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/src/parsehub/types/media_file.py +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/src/parsehub/types/media_ref.py +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/src/parsehub/types/platform.py +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/src/parsehub/types/post.py +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/src/parsehub/types/result.py +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/src/parsehub/utils/downloader.py +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/src/parsehub/utils/helpers.py +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/src/parsehub/utils/media_info.py +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/src/parsehub.egg-info/SOURCES.txt +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/src/parsehub.egg-info/dependency_links.txt +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/src/parsehub.egg-info/entry_points.txt +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/src/parsehub.egg-info/requires.txt +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/src/parsehub.egg-info/top_level.txt +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/test/test_cli.py +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/test/test_cli_config.py +0 -0
- {parsehub-2.1.3 → parsehub-2.1.4}/test/test_downloader.py +0 -0
|
@@ -125,9 +125,10 @@ def _p_play_addr(video_data: dict) -> tuple[str | None, int, int]:
|
|
|
125
125
|
return url_list[0], play_addr.get("width", 0), play_addr.get("height", 0)
|
|
126
126
|
|
|
127
127
|
|
|
128
|
-
def _p_bit_rates(video_data: dict) -> tuple[str, int, int]:
|
|
128
|
+
def _p_bit_rates(video_data: dict, filter_bytevc1: bool = False) -> tuple[str, int, int]:
|
|
129
129
|
bit_rates: list = video_data.get("bit_rate", [])
|
|
130
|
-
|
|
130
|
+
if filter_bytevc1:
|
|
131
|
+
bit_rates = list(filter(lambda i: i.get("is_bytevc1", 0) == 0, bit_rates))
|
|
131
132
|
bit_rates.sort(
|
|
132
133
|
key=lambda x: (
|
|
133
134
|
x.get("play_addr", {}).get("width", 0) * x.get("play_addr", {}).get("height", 0),
|
|
@@ -144,12 +145,12 @@ def _p_bit_rates(video_data: dict) -> tuple[str, int, int]:
|
|
|
144
145
|
|
|
145
146
|
|
|
146
147
|
def parse_video_info(video_data: dict) -> dict:
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
# is_bytevc1 = 1 | 2 为字节自研视频编码 bytevc1 | bytevc2
|
|
150
|
-
if is_bytevc1 == 0:
|
|
148
|
+
is_app = video_data.get("is_bytevc1", None) is not None # 只有 app 接口带 is_bytevc1 参数
|
|
149
|
+
if is_app:
|
|
151
150
|
u, w, h = _p_play_addr(video_data)
|
|
152
|
-
|
|
151
|
+
if not u:
|
|
152
|
+
u, w, h = _p_bit_rates(video_data, True)
|
|
153
|
+
else:
|
|
153
154
|
u, w, h = _p_bit_rates(video_data)
|
|
154
155
|
|
|
155
156
|
video_url = remove_video_watermark(u)
|
|
@@ -265,11 +265,11 @@ class TestDouyinStorySupport(unittest.TestCase):
|
|
|
265
265
|
|
|
266
266
|
def test_parse_video_info_prefers_story_default_play_url_by_data_size(self):
|
|
267
267
|
video_data = {
|
|
268
|
+
"duration": 9682,
|
|
268
269
|
"cover": {"url_list": ["https://cdn.example/thumb.jpg"]},
|
|
269
270
|
"bit_rate": [
|
|
270
271
|
{
|
|
271
272
|
"bit_rate": 0,
|
|
272
|
-
"duration": 9682,
|
|
273
273
|
"play_addr": {
|
|
274
274
|
"url_list": ["https://cdn.example/story-default.mp4"],
|
|
275
275
|
"width": 720,
|
|
@@ -279,7 +279,6 @@ class TestDouyinStorySupport(unittest.TestCase):
|
|
|
279
279
|
},
|
|
280
280
|
{
|
|
281
281
|
"bit_rate": 632,
|
|
282
|
-
"duration": 9682,
|
|
283
282
|
"play_addr": {
|
|
284
283
|
"url_list": ["https://cdn.example/720p.mp4"],
|
|
285
284
|
"width": 720,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|