nonebot-plugin-parser 2.5.2__tar.gz → 2.5.3__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.
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/PKG-INFO +1 -1
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/pyproject.toml +2 -2
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/src/nonebot_plugin_parser/download/__init__.py +23 -20
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/src/nonebot_plugin_parser/renders/base.py +5 -5
- nonebot_plugin_parser-2.5.3/src/nonebot_plugin_parser/renders/templates/card.html.jinja2 +616 -0
- nonebot_plugin_parser-2.5.2/src/nonebot_plugin_parser/renders/templates/card.html.jinja2 +0 -668
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/README.md +0 -0
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/src/nonebot_plugin_parser/__init__.py +0 -0
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/src/nonebot_plugin_parser/config.py +0 -0
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/src/nonebot_plugin_parser/constants.py +0 -0
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/src/nonebot_plugin_parser/download/task.py +0 -0
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/src/nonebot_plugin_parser/download/ytdlp.py +0 -0
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/src/nonebot_plugin_parser/exception.py +0 -0
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/src/nonebot_plugin_parser/helper.py +0 -0
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/src/nonebot_plugin_parser/matchers/__init__.py +0 -0
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/src/nonebot_plugin_parser/matchers/filter.py +0 -0
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/src/nonebot_plugin_parser/matchers/rule.py +0 -0
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/src/nonebot_plugin_parser/parsers/__init__.py +0 -0
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/src/nonebot_plugin_parser/parsers/acfun/__init__.py +0 -0
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/src/nonebot_plugin_parser/parsers/acfun/video.py +0 -0
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/src/nonebot_plugin_parser/parsers/base.py +0 -0
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/src/nonebot_plugin_parser/parsers/bilibili/__init__.py +0 -0
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/src/nonebot_plugin_parser/parsers/bilibili/article.py +0 -0
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/src/nonebot_plugin_parser/parsers/bilibili/common.py +0 -0
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/src/nonebot_plugin_parser/parsers/bilibili/dynamic.py +0 -0
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/src/nonebot_plugin_parser/parsers/bilibili/favlist.py +0 -0
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/src/nonebot_plugin_parser/parsers/bilibili/live.py +0 -0
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/src/nonebot_plugin_parser/parsers/bilibili/opus.py +0 -0
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/src/nonebot_plugin_parser/parsers/bilibili/video.py +0 -0
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/src/nonebot_plugin_parser/parsers/cookie.py +0 -0
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/src/nonebot_plugin_parser/parsers/data.py +0 -0
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/src/nonebot_plugin_parser/parsers/douyin/__init__.py +0 -0
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/src/nonebot_plugin_parser/parsers/douyin/slides.py +0 -0
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/src/nonebot_plugin_parser/parsers/douyin/video.py +0 -0
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/src/nonebot_plugin_parser/parsers/kuaishou/__init__.py +0 -0
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/src/nonebot_plugin_parser/parsers/kuaishou/states.py +0 -0
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/src/nonebot_plugin_parser/parsers/nga.py +0 -0
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/src/nonebot_plugin_parser/parsers/tiktok.py +0 -0
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/src/nonebot_plugin_parser/parsers/twitter.py +0 -0
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/src/nonebot_plugin_parser/parsers/weibo/__init__.py +0 -0
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/src/nonebot_plugin_parser/parsers/weibo/article.py +0 -0
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/src/nonebot_plugin_parser/parsers/weibo/common.py +0 -0
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/src/nonebot_plugin_parser/parsers/weibo/show.py +0 -0
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/src/nonebot_plugin_parser/parsers/xiaohongshu/__init__.py +0 -0
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/src/nonebot_plugin_parser/parsers/xiaohongshu/common.py +0 -0
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/src/nonebot_plugin_parser/parsers/xiaohongshu/discovery.py +0 -0
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/src/nonebot_plugin_parser/parsers/xiaohongshu/explore.py +0 -0
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/src/nonebot_plugin_parser/parsers/youtube/__init__.py +0 -0
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/src/nonebot_plugin_parser/parsers/youtube/meta.py +0 -0
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/src/nonebot_plugin_parser/renders/__init__.py +0 -0
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/src/nonebot_plugin_parser/renders/common.py +0 -0
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/src/nonebot_plugin_parser/renders/default.py +0 -0
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/src/nonebot_plugin_parser/renders/htmlrender.py +0 -0
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/src/nonebot_plugin_parser/renders/resources/HYSongYunLangHeiW.ttf +0 -0
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/src/nonebot_plugin_parser/renders/resources/__init__.py +0 -0
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/src/nonebot_plugin_parser/renders/resources/avatar.png +0 -0
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/src/nonebot_plugin_parser/renders/resources/bilibili.png +0 -0
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/src/nonebot_plugin_parser/renders/resources/douyin.png +0 -0
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/src/nonebot_plugin_parser/renders/resources/kuaishou.png +0 -0
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/src/nonebot_plugin_parser/renders/resources/play.png +0 -0
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/src/nonebot_plugin_parser/renders/resources/tiktok.png +0 -0
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/src/nonebot_plugin_parser/renders/resources/twitter.png +0 -0
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/src/nonebot_plugin_parser/renders/resources/weibo.png +0 -0
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/src/nonebot_plugin_parser/renders/resources/xiaohongshu.png +0 -0
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/src/nonebot_plugin_parser/renders/resources/youtube.png +0 -0
- {nonebot_plugin_parser-2.5.2 → nonebot_plugin_parser-2.5.3}/src/nonebot_plugin_parser/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: nonebot-plugin-parser
|
|
3
|
-
Version: 2.5.
|
|
3
|
+
Version: 2.5.3
|
|
4
4
|
Summary: NoneBot2 链接分享解析 Alconna 版, 现支持B站|抖音|快手|微博|小红书|YouTube|TikTok|Twitter|AcFun|NGA
|
|
5
5
|
Keywords: acfun,bilibili,douyin,kuaishou,nga,nonebot,nonebot2,tiktok,twitter,video,weibo,xiaohongshu,youtube
|
|
6
6
|
Author: fllesser
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "nonebot-plugin-parser"
|
|
3
|
-
version = "2.5.
|
|
3
|
+
version = "2.5.3"
|
|
4
4
|
description = "NoneBot2 链接分享解析 Alconna 版, 现支持B站|抖音|快手|微博|小红书|YouTube|TikTok|Twitter|AcFun|NGA"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.10"
|
|
@@ -118,7 +118,7 @@ nonebug = { git = "https://github.com/nonebot/nonebug", rev = "master" }
|
|
|
118
118
|
[tool.bumpversion]
|
|
119
119
|
tag = true
|
|
120
120
|
commit = true
|
|
121
|
-
current_version = "2.5.
|
|
121
|
+
current_version = "2.5.3"
|
|
122
122
|
message = "release: bump vesion from {current_version} to {new_version}"
|
|
123
123
|
|
|
124
124
|
[[tool.bumpversion.files]]
|
|
@@ -41,8 +41,7 @@ class StreamDownloader:
|
|
|
41
41
|
task_id = progress.add_task(description=desc, total=total)
|
|
42
42
|
yield partial(progress.update, task_id)
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
async def download_file(
|
|
44
|
+
async def _download_file(
|
|
46
45
|
self,
|
|
47
46
|
url: str,
|
|
48
47
|
*,
|
|
@@ -87,6 +86,23 @@ class StreamDownloader:
|
|
|
87
86
|
|
|
88
87
|
return file_path
|
|
89
88
|
|
|
89
|
+
@auto_task
|
|
90
|
+
async def download_file(
|
|
91
|
+
self,
|
|
92
|
+
url: str,
|
|
93
|
+
*,
|
|
94
|
+
file_name: str | None = None,
|
|
95
|
+
ext_headers: dict[str, str] | None = None,
|
|
96
|
+
chunk_size: int = 64 * 1024,
|
|
97
|
+
) -> Path:
|
|
98
|
+
"""download file by url with stream"""
|
|
99
|
+
return await self._download_file(
|
|
100
|
+
url,
|
|
101
|
+
file_name=file_name,
|
|
102
|
+
ext_headers=ext_headers,
|
|
103
|
+
chunk_size=chunk_size,
|
|
104
|
+
)
|
|
105
|
+
|
|
90
106
|
@auto_task
|
|
91
107
|
async def download_video(
|
|
92
108
|
self,
|
|
@@ -99,7 +115,7 @@ class StreamDownloader:
|
|
|
99
115
|
if video_name is None:
|
|
100
116
|
video_name = generate_file_name(url, ".mp4")
|
|
101
117
|
|
|
102
|
-
return await self.
|
|
118
|
+
return await self._download_file(
|
|
103
119
|
url,
|
|
104
120
|
file_name=video_name,
|
|
105
121
|
ext_headers=ext_headers,
|
|
@@ -118,7 +134,7 @@ class StreamDownloader:
|
|
|
118
134
|
if audio_name is None:
|
|
119
135
|
audio_name = generate_file_name(url, ".mp3")
|
|
120
136
|
|
|
121
|
-
return await self.
|
|
137
|
+
return await self._download_file(
|
|
122
138
|
url,
|
|
123
139
|
file_name=audio_name,
|
|
124
140
|
ext_headers=ext_headers,
|
|
@@ -136,7 +152,7 @@ class StreamDownloader:
|
|
|
136
152
|
if img_name is None:
|
|
137
153
|
img_name = generate_file_name(url, ".jpg")
|
|
138
154
|
|
|
139
|
-
return await self.
|
|
155
|
+
return await self._download_file(
|
|
140
156
|
url,
|
|
141
157
|
file_name=img_name,
|
|
142
158
|
ext_headers=ext_headers,
|
|
@@ -153,25 +169,12 @@ class StreamDownloader:
|
|
|
153
169
|
) -> Path:
|
|
154
170
|
"""download video and audio file by url with stream and merge"""
|
|
155
171
|
v_path, a_path = await asyncio.gather(
|
|
156
|
-
self.
|
|
157
|
-
self.
|
|
172
|
+
self._download_file(v_url, ext_headers=ext_headers),
|
|
173
|
+
self._download_file(a_url, ext_headers=ext_headers),
|
|
158
174
|
)
|
|
159
175
|
await merge_av(v_path=v_path, a_path=a_path, output_path=output_path)
|
|
160
176
|
return output_path
|
|
161
177
|
|
|
162
|
-
async def download_imgs_without_raise(
|
|
163
|
-
self,
|
|
164
|
-
urls: list[str],
|
|
165
|
-
*,
|
|
166
|
-
ext_headers: dict[str, str] | None = None,
|
|
167
|
-
) -> list[Path]:
|
|
168
|
-
"""download image files by urls with stream, ignore errors"""
|
|
169
|
-
paths_or_errs = await asyncio.gather(
|
|
170
|
-
*[self.download_img(url, ext_headers=ext_headers) for url in urls],
|
|
171
|
-
return_exceptions=True,
|
|
172
|
-
)
|
|
173
|
-
return [p for p in paths_or_errs if isinstance(p, Path)]
|
|
174
|
-
|
|
175
178
|
@auto_task
|
|
176
179
|
async def download_m3u8(
|
|
177
180
|
self,
|
|
@@ -61,10 +61,7 @@ class BaseRenderer(ABC):
|
|
|
61
61
|
case AudioContent():
|
|
62
62
|
yield UniMessage(UniHelper.record_seg(path))
|
|
63
63
|
case ImageContent():
|
|
64
|
-
|
|
65
|
-
if cont.alt:
|
|
66
|
-
img_seg += cont.alt
|
|
67
|
-
forwardable_segs.append(img_seg)
|
|
64
|
+
forwardable_segs.append(UniHelper.img_seg(path))
|
|
68
65
|
case DynamicContent():
|
|
69
66
|
dynamic_segs.append(UniHelper.video_seg(path))
|
|
70
67
|
|
|
@@ -81,7 +78,10 @@ class BaseRenderer(ABC):
|
|
|
81
78
|
continue
|
|
82
79
|
|
|
83
80
|
if path := await cont.path_task.safe_get(on_error):
|
|
84
|
-
|
|
81
|
+
img_seg = UniHelper.img_seg(path)
|
|
82
|
+
if cont.alt:
|
|
83
|
+
img_seg += cont.alt
|
|
84
|
+
forwardable_segs.append(img_seg)
|
|
85
85
|
|
|
86
86
|
if forwardable_segs:
|
|
87
87
|
if pconfig.need_forward_contents or len(forwardable_segs) > 4:
|