podflow 20250705.1__py3-none-any.whl → 20250706__py3-none-any.whl
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.
- podflow/main_podcast.py +4 -4
- podflow/youtube/check.py +71 -0
- podflow/youtube/login.py +34 -2
- {podflow-20250705.1.dist-info → podflow-20250706.dist-info}/METADATA +1 -1
- {podflow-20250705.1.dist-info → podflow-20250706.dist-info}/RECORD +8 -9
- podflow/netscape/get_cookie_dict.py +0 -21
- podflow/netscape/update_netscape.py +0 -20
- {podflow-20250705.1.dist-info → podflow-20250706.dist-info}/WHEEL +0 -0
- {podflow-20250705.1.dist-info → podflow-20250706.dist-info}/entry_points.txt +0 -0
- {podflow-20250705.1.dist-info → podflow-20250706.dist-info}/top_level.txt +0 -0
podflow/main_podcast.py
CHANGED
@@ -35,9 +35,9 @@ from podflow.message.original_rss_fail_print import original_rss_fail_print
|
|
35
35
|
from podflow.message.update_information_display import update_information_display
|
36
36
|
from podflow.message.update_youtube_bilibili_rss import update_youtube_bilibili_rss
|
37
37
|
|
38
|
-
#
|
38
|
+
# 登录与校验模块
|
39
39
|
from podflow.bilibili.login import get_bilibili_data
|
40
|
-
from podflow.youtube.
|
40
|
+
from podflow.youtube.check import check_youtube_cookie
|
41
41
|
|
42
42
|
# 配置和图标模块
|
43
43
|
from podflow.config.channge_icon import channge_icon
|
@@ -120,8 +120,8 @@ def main_podcast():
|
|
120
120
|
progress_update(0, refresh=1)
|
121
121
|
# 暂停进程打印
|
122
122
|
gVar.server_process_print_flag[0] = "pause"
|
123
|
-
#
|
124
|
-
gVar.youtube_cookie =
|
123
|
+
# 校验YouTube cookie
|
124
|
+
gVar.youtube_cookie = check_youtube_cookie(gVar.channelid_youtube_ids_original)
|
125
125
|
progress_update(0.01, num=0.0049)
|
126
126
|
# 更新哔哩哔哩data
|
127
127
|
gVar.channelid_bilibili_ids, gVar.bilibili_data = get_bilibili_data(
|
podflow/youtube/check.py
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
# podflow/youtube/__init__.py
|
2
|
+
# coding: utf-8
|
3
|
+
|
4
|
+
import os
|
5
|
+
import yt_dlp
|
6
|
+
from podflow.basic.write_log import write_log
|
7
|
+
from podflow.basic.time_print import time_print
|
8
|
+
|
9
|
+
|
10
|
+
# yt-dlp校验cookie模块
|
11
|
+
def yt_dlp_check(file, url):
|
12
|
+
parts = file.split("/")
|
13
|
+
if not os.path.exists(file):
|
14
|
+
time_print(f"{parts[-1]}文件不存在")
|
15
|
+
return False
|
16
|
+
|
17
|
+
class MyLogger:
|
18
|
+
def debug(self, msg):
|
19
|
+
pass
|
20
|
+
def warning(self, msg):
|
21
|
+
pass
|
22
|
+
def info(self, msg):
|
23
|
+
pass
|
24
|
+
def error(self, msg):
|
25
|
+
pass
|
26
|
+
|
27
|
+
ydl_opts = {
|
28
|
+
"cookiefile": file,
|
29
|
+
"quiet": True,
|
30
|
+
"no_warnings": True,
|
31
|
+
"flat_playlist": True,
|
32
|
+
"extract_flat": True,
|
33
|
+
"logger": MyLogger(),
|
34
|
+
}
|
35
|
+
try:
|
36
|
+
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
|
37
|
+
info_dict = ydl.extract_info(url, download=False)
|
38
|
+
playlist_id = info_dict.get("id", "")
|
39
|
+
if playlist_id == "WL":
|
40
|
+
return True
|
41
|
+
else:
|
42
|
+
time_print("cookie校验返回异常")
|
43
|
+
return False
|
44
|
+
except yt_dlp.utils.DownloadError as e:
|
45
|
+
error_message = str(e).lower()
|
46
|
+
if any(
|
47
|
+
keyword in error_message
|
48
|
+
for keyword in ["login required", "sign in", "private", "forbidden"]
|
49
|
+
):
|
50
|
+
time_print(f"cookie无效或已过期\n{e}")
|
51
|
+
else:
|
52
|
+
time_print(f"cookie无效或网络异常\n{e}")
|
53
|
+
return False
|
54
|
+
except Exception as e:
|
55
|
+
time_print(f"cookie发生未知错误\n{e}")
|
56
|
+
return False
|
57
|
+
|
58
|
+
|
59
|
+
# 校验YouTube cookie模块
|
60
|
+
def check_youtube_cookie(channelid_youtube_ids):
|
61
|
+
if not channelid_youtube_ids:
|
62
|
+
return False
|
63
|
+
youtube_cookie = yt_dlp_check(
|
64
|
+
"channel_data/yt_dlp_youtube.txt",
|
65
|
+
"https://www.youtube.com/playlist?list=WL",
|
66
|
+
)
|
67
|
+
if youtube_cookie:
|
68
|
+
time_print("YouTube \033[32m校验cookie成功\033[0m")
|
69
|
+
else:
|
70
|
+
write_log("YouTube \033[31m校验cookie失败\033[0m")
|
71
|
+
return youtube_cookie
|
podflow/youtube/login.py
CHANGED
@@ -1,11 +1,43 @@
|
|
1
1
|
# podflow/youtube/login.py
|
2
2
|
# coding: utf-8
|
3
3
|
|
4
|
+
|
5
|
+
from http.cookiejar import LoadError, MozillaCookieJar
|
4
6
|
from podflow.basic.write_log import write_log
|
5
7
|
from podflow.basic.time_print import time_print
|
6
8
|
from podflow.basic.http_client import http_client
|
7
|
-
|
8
|
-
|
9
|
+
|
10
|
+
|
11
|
+
# 更新Netscape_HTTP_Cookie模块
|
12
|
+
def update_netscape(response_cookies, file: str):
|
13
|
+
netscape_cookie_jar = MozillaCookieJar(file)
|
14
|
+
try:
|
15
|
+
netscape_cookie_jar.load(ignore_discard=True, ignore_expires=True)
|
16
|
+
except Exception:
|
17
|
+
return False
|
18
|
+
for cookie in response_cookies:
|
19
|
+
netscape_cookie_jar.set_cookie(cookie)
|
20
|
+
try:
|
21
|
+
netscape_cookie_jar.save(ignore_discard=True, ignore_expires=True)
|
22
|
+
return True
|
23
|
+
except Exception:
|
24
|
+
return False
|
25
|
+
|
26
|
+
|
27
|
+
# 将Netscape转Dict模块
|
28
|
+
def get_cookie_dict(file):
|
29
|
+
parts = file.split("/")
|
30
|
+
try:
|
31
|
+
# 加载Netscape格式的cookie文件
|
32
|
+
cookie_jar = MozillaCookieJar(file)
|
33
|
+
cookie_jar.load(ignore_discard=True)
|
34
|
+
return {cookie.name: cookie.value for cookie in cookie_jar}
|
35
|
+
except FileNotFoundError:
|
36
|
+
time_print(f"{parts[-1]}文件不存在")
|
37
|
+
return None
|
38
|
+
except LoadError:
|
39
|
+
time_print(f"{parts[-1]}文件错误")
|
40
|
+
return None
|
9
41
|
|
10
42
|
|
11
43
|
def get_youtube_cookie_fail(arg0):
|
@@ -2,7 +2,7 @@ podflow/__init__.py,sha256=hpC5LyzhH6gYwn2DRHUBjQY4eHADFA5oIDztzhES-Ew,7695
|
|
2
2
|
podflow/download_and_build.py,sha256=x7S7N26B1G9Yn2yr7YthDJgKUwEKBLtHBLlaqpofLas,746
|
3
3
|
podflow/ffmpeg_judge.py,sha256=wM49pPXOFwFAA_8TKHal5fV6ka9sAA87yGQMDOssvXo,1340
|
4
4
|
podflow/main.py,sha256=7zWdpw80jqPaYu1Un1nPqaZoiAb7Dqg8zaF-cUioU4c,755
|
5
|
-
podflow/main_podcast.py,sha256=
|
5
|
+
podflow/main_podcast.py,sha256=gH2ERZjZpPqaUnTajwGxnjMyV7dlrXyM7WJFoFXH3i4,12990
|
6
6
|
podflow/main_upload.py,sha256=VOihPtjr37lxRNEr2cJp70DB6W5q7lHvpanApFKA9qE,2595
|
7
7
|
podflow/parse_arguments.py,sha256=h3a7EaRZS04kNMFYbxTW9Ch29KgZ7dyS-yqEEt_etQI,2592
|
8
8
|
podflow/basic/__init__.py,sha256=CAfI6mVQtz7KKbAiTIZ9_IbvaTXeAqxR1U7ov9GDoDo,44
|
@@ -78,8 +78,6 @@ podflow/message/xml_original_item.py,sha256=mlORI0p6aSLP6PWIAuvI4uVN0JbxUDZX5-U5
|
|
78
78
|
podflow/message/xml_rss.py,sha256=ogCteSUXyJJXLhOE7-ZBcRdWYzrRr2Qykjt3oppRpC4,1679
|
79
79
|
podflow/netscape/__init__.py,sha256=SUw_BtbV3moA324UdxRECkPLv1xHkjio8r_5JTkVfxI,47
|
80
80
|
podflow/netscape/bulid_netscape.py,sha256=wmUPlDGF8G456GGyajU_6Ak5WJzsqsq4bZgPjCSTGhI,2279
|
81
|
-
podflow/netscape/get_cookie_dict.py,sha256=laqw-eriABiLyciRLzDmistVHHWqmUM-9eEbYZzsqBQ,643
|
82
|
-
podflow/netscape/update_netscape.py,sha256=b7RL0Rm0pSOyRH9-sgflqtzB8EoyPhSFJgQTSfjFsy4,592
|
83
81
|
podflow/remove/__init__.py,sha256=x1pMfpIyE6xUrmIOkdl43mbvKLwndGo5pIoOBXhJsP4,45
|
84
82
|
podflow/remove/remove_dir.py,sha256=zqgf47UgxiGiLipb1FeoWKzrSHSxcHaEuu0261bqR1s,1105
|
85
83
|
podflow/remove/remove_file.py,sha256=ZusvZsBQX_yRdLuboD7bZKiOX4z4Rxg66zZK9KDWHwE,1006
|
@@ -107,10 +105,11 @@ podflow/upload/upload_files.py,sha256=vI0sSjCxUILlu0K9doMLJpmR7KrqhMRsCJmcWrCKlA
|
|
107
105
|
podflow/upload/upload_server.py,sha256=BFq3QrWE7U97LbC4EQiDhQXbLapEc4R00eRDBH12E6A,565
|
108
106
|
podflow/youtube/__init__.py,sha256=pgXod8gq0IijZxIkPSwgAOcb9JI5rd1mqMomoR7bcJ4,46
|
109
107
|
podflow/youtube/build.py,sha256=j6SVq3HFFGlNNqRrHfnBIThdzsH88PFmwLnejosif1U,12311
|
108
|
+
podflow/youtube/check.py,sha256=VUu2h7o4p2yZ7sFLtHRmxojURbgwqQUgYVNPeyhZ0wc,2009
|
110
109
|
podflow/youtube/get.py,sha256=oO32GjTFvUgP5AfFX5AlIuXU2UT6QtOUOXWLFzi8XtI,17157
|
111
|
-
podflow/youtube/login.py,sha256=
|
112
|
-
podflow-
|
113
|
-
podflow-
|
114
|
-
podflow-
|
115
|
-
podflow-
|
116
|
-
podflow-
|
110
|
+
podflow/youtube/login.py,sha256=pDJNgCJdLOKV02yGot_5JJ-962JACbWZ-GlISmDfgIk,2742
|
111
|
+
podflow-20250706.dist-info/METADATA,sha256=euTyT4mYua63OHU-BSgOkAn-XFTNASWnVrN2dIIOmNo,14195
|
112
|
+
podflow-20250706.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
113
|
+
podflow-20250706.dist-info/entry_points.txt,sha256=mn7hD_c_dmpKe3XU0KNekheBvD01LhlJ9htY-Df0j2A,131
|
114
|
+
podflow-20250706.dist-info/top_level.txt,sha256=fUujhhz-RrMI8aGvi-3Ey5y7FQnpOOgoFw9OWM3yLCU,8
|
115
|
+
podflow-20250706.dist-info/RECORD,,
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# podflow/Netscape/get_cookie_dict.py
|
2
|
-
# coding: utf-8
|
3
|
-
|
4
|
-
from http.cookiejar import LoadError, MozillaCookieJar
|
5
|
-
from podflow.basic.time_print import time_print
|
6
|
-
|
7
|
-
|
8
|
-
# 将Netscape转Dict模块
|
9
|
-
def get_cookie_dict(file):
|
10
|
-
parts = file.split("/")
|
11
|
-
try:
|
12
|
-
# 加载Netscape格式的cookie文件
|
13
|
-
cookie_jar = MozillaCookieJar(file)
|
14
|
-
cookie_jar.load(ignore_discard=True)
|
15
|
-
return {cookie.name: cookie.value for cookie in cookie_jar}
|
16
|
-
except FileNotFoundError:
|
17
|
-
time_print(f"{parts[-1]}文件不存在")
|
18
|
-
return None
|
19
|
-
except LoadError:
|
20
|
-
time_print(f"{parts[-1]}文件错误")
|
21
|
-
return None
|
@@ -1,20 +0,0 @@
|
|
1
|
-
# podflow/netscape/update_netscape.py
|
2
|
-
# coding: utf-8
|
3
|
-
|
4
|
-
from http.cookiejar import MozillaCookieJar
|
5
|
-
|
6
|
-
|
7
|
-
# 更新Netscape_HTTP_Cookie模块
|
8
|
-
def update_netscape(response_cookies, file: str):
|
9
|
-
netscape_cookie_jar = MozillaCookieJar(file)
|
10
|
-
try:
|
11
|
-
netscape_cookie_jar.load(ignore_discard=True, ignore_expires=True)
|
12
|
-
except Exception:
|
13
|
-
return False
|
14
|
-
for cookie in response_cookies:
|
15
|
-
netscape_cookie_jar.set_cookie(cookie)
|
16
|
-
try:
|
17
|
-
netscape_cookie_jar.save(ignore_discard=True, ignore_expires=True)
|
18
|
-
return True
|
19
|
-
except Exception:
|
20
|
-
return False
|
File without changes
|
File without changes
|
File without changes
|