Pyckplayer 1.0.9__tar.gz → 1.0.12__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.
- {pyckplayer-1.0.9/src/Pyckplayer.egg-info → pyckplayer-1.0.12}/PKG-INFO +1 -1
- {pyckplayer-1.0.9 → pyckplayer-1.0.12}/setup.py +1 -1
- {pyckplayer-1.0.9 → pyckplayer-1.0.12/src/Pyckplayer.egg-info}/PKG-INFO +1 -1
- {pyckplayer-1.0.9 → pyckplayer-1.0.12}/src/pyckplayer/core.py +10 -39
- {pyckplayer-1.0.9 → pyckplayer-1.0.12}/LICENSE +0 -0
- {pyckplayer-1.0.9 → pyckplayer-1.0.12}/MANIFEST.in +0 -0
- {pyckplayer-1.0.9 → pyckplayer-1.0.12}/README.md +0 -0
- {pyckplayer-1.0.9 → pyckplayer-1.0.12}/pyproject.toml +0 -0
- {pyckplayer-1.0.9 → pyckplayer-1.0.12}/setup.cfg +0 -0
- {pyckplayer-1.0.9 → pyckplayer-1.0.12}/src/Pyckplayer.egg-info/SOURCES.txt +0 -0
- {pyckplayer-1.0.9 → pyckplayer-1.0.12}/src/Pyckplayer.egg-info/dependency_links.txt +0 -0
- {pyckplayer-1.0.9 → pyckplayer-1.0.12}/src/Pyckplayer.egg-info/entry_points.txt +0 -0
- {pyckplayer-1.0.9 → pyckplayer-1.0.12}/src/Pyckplayer.egg-info/requires.txt +0 -0
- {pyckplayer-1.0.9 → pyckplayer-1.0.12}/src/Pyckplayer.egg-info/top_level.txt +0 -0
- {pyckplayer-1.0.9 → pyckplayer-1.0.12}/src/pyckplayer/__init__.py +0 -0
- {pyckplayer-1.0.9 → pyckplayer-1.0.12}/src/pyckplayer/ckplayer/LICENSE +0 -0
- {pyckplayer-1.0.9 → pyckplayer-1.0.12}/src/pyckplayer/ckplayer/css/ckplayer.css +0 -0
- {pyckplayer-1.0.9 → pyckplayer-1.0.12}/src/pyckplayer/ckplayer/css/ckplayer.ixigua.css +0 -0
- {pyckplayer-1.0.9 → pyckplayer-1.0.12}/src/pyckplayer/ckplayer/css/ckplayer.red.css +0 -0
- {pyckplayer-1.0.9 → pyckplayer-1.0.12}/src/pyckplayer/ckplayer/css/images/adclose.png +0 -0
- {pyckplayer-1.0.9 → pyckplayer-1.0.12}/src/pyckplayer/ckplayer/css/images/buffer.png +0 -0
- {pyckplayer-1.0.9 → pyckplayer-1.0.12}/src/pyckplayer/ckplayer/css/images/ckplayer.48.png +0 -0
- {pyckplayer-1.0.9 → pyckplayer-1.0.12}/src/pyckplayer/ckplayer/css/images/ckplayer.png +0 -0
- {pyckplayer-1.0.9 → pyckplayer-1.0.12}/src/pyckplayer/ckplayer/css/images/ckplayer_ixigua.48.png +0 -0
- {pyckplayer-1.0.9 → pyckplayer-1.0.12}/src/pyckplayer/ckplayer/css/images/ckplayer_ixigua.png +0 -0
- {pyckplayer-1.0.9 → pyckplayer-1.0.12}/src/pyckplayer/ckplayer/css/images/ckplayer_red.48.png +0 -0
- {pyckplayer-1.0.9 → pyckplayer-1.0.12}/src/pyckplayer/ckplayer/css/images/ckplayer_red.png +0 -0
- {pyckplayer-1.0.9 → pyckplayer-1.0.12}/src/pyckplayer/ckplayer/css/images/favicon.ico +0 -0
- {pyckplayer-1.0.9 → pyckplayer-1.0.12}/src/pyckplayer/ckplayer/css/images/loading.png +0 -0
- {pyckplayer-1.0.9 → pyckplayer-1.0.12}/src/pyckplayer/ckplayer/css/images/logo.png +0 -0
- {pyckplayer-1.0.9 → pyckplayer-1.0.12}/src/pyckplayer/ckplayer/css/images/play.png +0 -0
- {pyckplayer-1.0.9 → pyckplayer-1.0.12}/src/pyckplayer/ckplayer/flv.js/LICENSE +0 -0
- {pyckplayer-1.0.9 → pyckplayer-1.0.12}/src/pyckplayer/ckplayer/flv.js/README.md +0 -0
- {pyckplayer-1.0.9 → pyckplayer-1.0.12}/src/pyckplayer/ckplayer/flv.js/flv.js +0 -0
- {pyckplayer-1.0.9 → pyckplayer-1.0.12}/src/pyckplayer/ckplayer/flv.js/flv.js.map +0 -0
- {pyckplayer-1.0.9 → pyckplayer-1.0.12}/src/pyckplayer/ckplayer/flv.js/flv.min.js +0 -0
- {pyckplayer-1.0.9 → pyckplayer-1.0.12}/src/pyckplayer/ckplayer/flv.js/flv.min.js.map +0 -0
- {pyckplayer-1.0.9 → pyckplayer-1.0.12}/src/pyckplayer/ckplayer/hls.js/LICENSE +0 -0
- {pyckplayer-1.0.9 → pyckplayer-1.0.12}/src/pyckplayer/ckplayer/hls.js/README.md +0 -0
- {pyckplayer-1.0.9 → pyckplayer-1.0.12}/src/pyckplayer/ckplayer/hls.js/hls-demo.js +0 -0
- {pyckplayer-1.0.9 → pyckplayer-1.0.12}/src/pyckplayer/ckplayer/hls.js/hls-demo.js.map +0 -0
- {pyckplayer-1.0.9 → pyckplayer-1.0.12}/src/pyckplayer/ckplayer/hls.js/hls.js +0 -0
- {pyckplayer-1.0.9 → pyckplayer-1.0.12}/src/pyckplayer/ckplayer/hls.js/hls.js.d.ts +0 -0
- {pyckplayer-1.0.9 → pyckplayer-1.0.12}/src/pyckplayer/ckplayer/hls.js/hls.js.map +0 -0
- {pyckplayer-1.0.9 → pyckplayer-1.0.12}/src/pyckplayer/ckplayer/hls.js/hls.light.js +0 -0
- {pyckplayer-1.0.9 → pyckplayer-1.0.12}/src/pyckplayer/ckplayer/hls.js/hls.light.js.map +0 -0
- {pyckplayer-1.0.9 → pyckplayer-1.0.12}/src/pyckplayer/ckplayer/hls.js/hls.light.min.js +0 -0
- {pyckplayer-1.0.9 → pyckplayer-1.0.12}/src/pyckplayer/ckplayer/hls.js/hls.light.min.js.map +0 -0
- {pyckplayer-1.0.9 → pyckplayer-1.0.12}/src/pyckplayer/ckplayer/hls.js/hls.min.js +0 -0
- {pyckplayer-1.0.9 → pyckplayer-1.0.12}/src/pyckplayer/ckplayer/hls.js/hls.min.js.map +0 -0
- {pyckplayer-1.0.9 → pyckplayer-1.0.12}/src/pyckplayer/ckplayer/js/ckplayer.js +0 -0
- {pyckplayer-1.0.9 → pyckplayer-1.0.12}/src/pyckplayer/ckplayer/js/ckplayer.min.js +0 -0
- {pyckplayer-1.0.9 → pyckplayer-1.0.12}/src/pyckplayer/ckplayer/language/en.js +0 -0
- {pyckplayer-1.0.9 → pyckplayer-1.0.12}/src/pyckplayer/ckplayer/language/zh.cn.js +0 -0
- {pyckplayer-1.0.9 → pyckplayer-1.0.12}/src/pyckplayer/ckplayer/language/zh.hk.js +0 -0
- {pyckplayer-1.0.9 → pyckplayer-1.0.12}/src/pyckplayer/ckplayer/mpegts.js/LICENSE +0 -0
- {pyckplayer-1.0.9 → pyckplayer-1.0.12}/src/pyckplayer/ckplayer/mpegts.js/mpegts.js +0 -0
- {pyckplayer-1.0.9 → pyckplayer-1.0.12}/src/pyckplayer/ckplayer/mpegts.js/mpegts.js.map +0 -0
- {pyckplayer-1.0.9 → pyckplayer-1.0.12}/src/pyckplayer/ckplayer/mpegts.js/mpegts.min.js +0 -0
- {pyckplayer-1.0.9 → pyckplayer-1.0.12}/src/pyckplayer/cli.py +0 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import os
|
|
2
|
+
import sys
|
|
2
3
|
import time
|
|
3
4
|
import subprocess
|
|
4
5
|
import requests
|
|
@@ -76,7 +77,7 @@ def download_cover(poster_url: Optional[str], silent: bool = True) -> Optional[s
|
|
|
76
77
|
if not poster_url:
|
|
77
78
|
return None
|
|
78
79
|
|
|
79
|
-
cover_path = Path(__file__).parent.parent / "cover_image.jpg"
|
|
80
|
+
cover_path = Path(__file__).parent.parent.parent / "cover_image.jpg"
|
|
80
81
|
|
|
81
82
|
try:
|
|
82
83
|
response = requests.get(
|
|
@@ -115,23 +116,6 @@ def get_content_type(url: str) -> Optional[str]:
|
|
|
115
116
|
return None
|
|
116
117
|
|
|
117
118
|
|
|
118
|
-
def is_streaming_content(content_type: str) -> bool:
|
|
119
|
-
streaming_content_types = [
|
|
120
|
-
'application/vnd.apple.mpegurl',
|
|
121
|
-
'application/dash+xml',
|
|
122
|
-
'audio/mpegurl',
|
|
123
|
-
'video/mp4',
|
|
124
|
-
'video/flv',
|
|
125
|
-
'video/quicktime',
|
|
126
|
-
'application/x-mpegURL',
|
|
127
|
-
'application/octet-stream'
|
|
128
|
-
]
|
|
129
|
-
if content_type:
|
|
130
|
-
content_type_lower = content_type.lower()
|
|
131
|
-
return any(ct in content_type_lower for ct in streaming_content_types)
|
|
132
|
-
return False
|
|
133
|
-
|
|
134
|
-
|
|
135
119
|
def get_video_info(video_url: str) -> Optional[Dict[str, Any]]:
|
|
136
120
|
if cv2 is None:
|
|
137
121
|
return None
|
|
@@ -169,27 +153,12 @@ def get_video_info(video_url: str) -> Optional[Dict[str, Any]]:
|
|
|
169
153
|
|
|
170
154
|
|
|
171
155
|
def is_live_url(url: str) -> bool:
|
|
172
|
-
url_lower = url.lower()
|
|
173
|
-
live_keywords = [
|
|
174
|
-
'/live/', '/stream/', '/broadcast/', '/live-stream/',
|
|
175
|
-
'live.', 'stream.', 'live_', 'stream_',
|
|
176
|
-
'?live', '&live', '=live',
|
|
177
|
-
'douyincdn.com', 'live.kuaishou.com', 'live.bilibili.com',
|
|
178
|
-
'live.douyin.com', 'live.qq.com', 'live.weibo.com'
|
|
179
|
-
]
|
|
180
|
-
if any(keyword in url_lower for keyword in live_keywords):
|
|
181
|
-
return True
|
|
182
|
-
|
|
183
156
|
video_info = get_video_info(url)
|
|
184
157
|
if video_info is not None:
|
|
185
158
|
duration = video_info.get("duration", 0)
|
|
186
159
|
if duration < 0:
|
|
187
160
|
return True
|
|
188
161
|
|
|
189
|
-
content_type = get_content_type(url)
|
|
190
|
-
if content_type:
|
|
191
|
-
return is_streaming_content(content_type)
|
|
192
|
-
|
|
193
162
|
return False
|
|
194
163
|
|
|
195
164
|
|
|
@@ -198,7 +167,7 @@ def detect_stream_type(url: str) -> str:
|
|
|
198
167
|
|
|
199
168
|
if '.m3u8' in url_lower or '/hls/' in url_lower:
|
|
200
169
|
return 'hls'
|
|
201
|
-
elif '.flv' in url_lower:
|
|
170
|
+
elif '.flv' in url_lower or 'flv?' in url_lower:
|
|
202
171
|
return 'flv'
|
|
203
172
|
elif '.ts' in url_lower:
|
|
204
173
|
return 'ts'
|
|
@@ -219,7 +188,7 @@ def detect_stream_type(url: str) -> str:
|
|
|
219
188
|
elif 'dash' in content_type_lower:
|
|
220
189
|
return 'dash'
|
|
221
190
|
|
|
222
|
-
return '
|
|
191
|
+
return 'flv'
|
|
223
192
|
|
|
224
193
|
|
|
225
194
|
def generate_html(video_url: str,
|
|
@@ -240,6 +209,7 @@ def generate_html(video_url: str,
|
|
|
240
209
|
"autoplay": True,
|
|
241
210
|
"loop": False,
|
|
242
211
|
"preload": "auto",
|
|
212
|
+
"crossOrigin": "anonymous",
|
|
243
213
|
}
|
|
244
214
|
|
|
245
215
|
if stream_type == 'hls':
|
|
@@ -278,6 +248,7 @@ def generate_html(video_url: str,
|
|
|
278
248
|
<head>
|
|
279
249
|
<meta charset="UTF-8">
|
|
280
250
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
251
|
+
<meta name="referrer" content="no-referrer">
|
|
281
252
|
<title>{title}</title>
|
|
282
253
|
<link rel="icon" href="file:///{favicon_path}" type="image/png">
|
|
283
254
|
<link rel="shortcut icon" href="file:///{favicon_path}" type="image/png">
|
|
@@ -301,7 +272,7 @@ def generate_html(video_url: str,
|
|
|
301
272
|
|
|
302
273
|
|
|
303
274
|
def cleanup_temp_files(temp_files: list) -> None:
|
|
304
|
-
time.sleep(
|
|
275
|
+
time.sleep(20)
|
|
305
276
|
for file_path in temp_files:
|
|
306
277
|
try:
|
|
307
278
|
if file_path.exists():
|
|
@@ -332,13 +303,13 @@ def play_video(url: str,
|
|
|
332
303
|
local_poster_uri = download_cover(poster_url, silent=True)
|
|
333
304
|
html_content = generate_html(url, poster_url=local_poster_uri, title=title)
|
|
334
305
|
|
|
335
|
-
temp_html_path = Path(__file__).parent.parent / "temp_player.html"
|
|
306
|
+
temp_html_path = Path(__file__).parent.parent.parent / "temp_player.html"
|
|
336
307
|
with open(temp_html_path, "w", encoding="utf-8") as f:
|
|
337
308
|
f.write(html_content)
|
|
338
309
|
|
|
339
310
|
temp_files = [
|
|
340
311
|
temp_html_path,
|
|
341
|
-
Path(__file__).parent.parent / "cover_image.jpg"
|
|
312
|
+
Path(__file__).parent.parent.parent / "cover_image.jpg"
|
|
342
313
|
]
|
|
343
314
|
atexit.register(cleanup_temp_files, temp_files)
|
|
344
315
|
|
|
@@ -366,4 +337,4 @@ def play_video(url: str,
|
|
|
366
337
|
return True
|
|
367
338
|
except Exception:
|
|
368
339
|
pass
|
|
369
|
-
return False
|
|
340
|
+
return False
|
|
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
|
{pyckplayer-1.0.9 → pyckplayer-1.0.12}/src/pyckplayer/ckplayer/css/images/ckplayer_ixigua.48.png
RENAMED
|
File without changes
|
{pyckplayer-1.0.9 → pyckplayer-1.0.12}/src/pyckplayer/ckplayer/css/images/ckplayer_ixigua.png
RENAMED
|
File without changes
|
{pyckplayer-1.0.9 → pyckplayer-1.0.12}/src/pyckplayer/ckplayer/css/images/ckplayer_red.48.png
RENAMED
|
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
|