podflow 20250406__tar.gz → 20250413.1__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.
- {podflow-20250406 → podflow-20250413.1}/PKG-INFO +1 -1
- {podflow-20250406 → podflow-20250413.1}/podflow/__init__.py +1 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/basic/qr_code.py +13 -5
- podflow-20250413.1/podflow/basic/time_print.py +51 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/bilibili/login.py +50 -36
- {podflow-20250406 → podflow-20250413.1}/podflow/download/dl_aideo_video.py +6 -4
- {podflow-20250406 → podflow-20250413.1}/podflow/httpfs/to_html.py +4 -4
- {podflow-20250406 → podflow-20250413.1}/podflow/main_podcast.py +27 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/makeup/make_up_file.py +19 -3
- {podflow-20250406 → podflow-20250413.1}/podflow/message/create_main_rss.py +7 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/message/fail_message_initialize.py +5 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/message/get_video_format.py +17 -1
- {podflow-20250406 → podflow-20250413.1}/podflow/message/get_video_format_multithread.py +13 -2
- {podflow-20250406 → podflow-20250413.1}/podflow/message/get_youtube_and_bilibili_video_format.py +11 -1
- {podflow-20250406 → podflow-20250413.1}/podflow/message/update_youtube_bilibili_rss.py +15 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/netscape/get_cookie_dict.py +3 -3
- {podflow-20250406 → podflow-20250413.1}/podflow/templates/index.html +115 -18
- {podflow-20250406 → podflow-20250413.1}/podflow.egg-info/PKG-INFO +1 -1
- {podflow-20250406 → podflow-20250413.1}/setup.py +1 -1
- podflow-20250406/podflow/basic/time_print.py +0 -39
- {podflow-20250406 → podflow-20250413.1}/MANIFEST.in +0 -0
- {podflow-20250406 → podflow-20250413.1}/README.md +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/basic/__init__.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/basic/file_save.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/basic/folder_build.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/basic/get_duration.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/basic/get_file_list.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/basic/get_html_dict.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/basic/http_client.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/basic/list_merge_tidy.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/basic/split_dict.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/basic/time_format.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/basic/time_stamp.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/basic/vary_replace.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/basic/write_log.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/bilibili/__init__.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/bilibili/build.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/bilibili/get.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/config/__init__.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/config/build_original.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/config/channge_icon.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/config/correct_channelid.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/config/correct_config.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/config/get_channelid.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/config/get_channelid_id.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/config/get_config.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/download/__init__.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/download/convert_bytes.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/download/delete_part.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/download/show_progress.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/download/wait_animation.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/download/youtube_and_bilibili_download.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/download_and_build.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/ffmpeg_judge.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/httpfs/__init__.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/httpfs/app_bottle.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/httpfs/browser.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/httpfs/get_channelid.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/httpfs/port_judge.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/main.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/main_upload.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/makeup/__init__.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/makeup/del_makeup_format_fail.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/makeup/make_up_file_format_mod.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/makeup/make_up_file_mod.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/message/__init__.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/message/backup_zip_save.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/message/display_qrcode_and_url.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/message/format_time.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/message/get_media_name.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/message/get_original_rss.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/message/media_format.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/message/original_rss_fail_print.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/message/rss_create_hash.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/message/save_rss.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/message/title_correction.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/message/update_information_display.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/message/want_retry.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/message/xml_item.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/message/xml_original_item.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/message/xml_rss.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/netscape/__init__.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/netscape/bulid_netscape.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/parse_arguments.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/remove/__init__.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/remove/remove_dir.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/remove/remove_file.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/repair/__init__.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/repair/reverse_log.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/upload/__init__.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/upload/add_upload.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/upload/build_hash.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/upload/get_upload_original.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/upload/linked_client.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/upload/linked_server.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/upload/login.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/upload/time_key.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/upload/update_upload.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/upload/upload_server.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/youtube/__init__.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/youtube/build.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/youtube/get.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow/youtube/login.py +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow.egg-info/SOURCES.txt +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow.egg-info/dependency_links.txt +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow.egg-info/entry_points.txt +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow.egg-info/requires.txt +0 -0
- {podflow-20250406 → podflow-20250413.1}/podflow.egg-info/top_level.txt +0 -0
- {podflow-20250406 → podflow-20250413.1}/setup.cfg +0 -0
@@ -3,13 +3,15 @@
|
|
3
3
|
|
4
4
|
import math
|
5
5
|
import pyqrcode
|
6
|
-
from podflow.
|
6
|
+
from podflow.basic.time_print import time_print
|
7
7
|
|
8
8
|
|
9
9
|
# 网址二维码模块
|
10
|
-
def qr_code(
|
11
|
-
|
12
|
-
|
10
|
+
def qr_code(
|
11
|
+
data,
|
12
|
+
to_html=False,
|
13
|
+
num=None
|
14
|
+
):
|
13
15
|
qr = pyqrcode.create(
|
14
16
|
data,
|
15
17
|
error='L', # 对应于ERROR_CORRECT_L,可选值: 'L','M','Q','H'
|
@@ -47,5 +49,11 @@ def qr_code(data, to_html=False):
|
|
47
49
|
else:
|
48
50
|
ascii_art += fonts[3]
|
49
51
|
ascii_art += "\n"
|
50
|
-
|
52
|
+
Qrcode = data if to_html else ""
|
53
|
+
time_print(
|
54
|
+
ascii_art,
|
55
|
+
Time=False,
|
56
|
+
Qrcode=Qrcode,
|
57
|
+
Number=num,
|
58
|
+
)
|
51
59
|
return height_double
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# podflow/basic/time_print.py
|
2
|
+
# coding: utf-8
|
3
|
+
|
4
|
+
from datetime import datetime
|
5
|
+
from podflow import gVar
|
6
|
+
from podflow.httpfs.to_html import ansi_to_html, qrcode_to_html
|
7
|
+
|
8
|
+
|
9
|
+
def time_print(
|
10
|
+
text,
|
11
|
+
Top=False,
|
12
|
+
NoEnter=False,
|
13
|
+
Time=True,
|
14
|
+
Url="",
|
15
|
+
Qrcode=False,
|
16
|
+
Number=None,
|
17
|
+
Head="",
|
18
|
+
):
|
19
|
+
if Time:
|
20
|
+
text = f"{datetime.now().strftime('%H:%M:%S')}|{text}"
|
21
|
+
text_print = f"\r{text}" if Top else f"{text}"
|
22
|
+
if Url:
|
23
|
+
text_print = f"{text_print}\n\033[34m{Url}\033[0m"
|
24
|
+
if Head:
|
25
|
+
text_print = f"{Head}{text_print}"
|
26
|
+
if NoEnter:
|
27
|
+
print(text_print, end="")
|
28
|
+
else:
|
29
|
+
print(text_print)
|
30
|
+
|
31
|
+
if Number is not None and (
|
32
|
+
not isinstance(Number, int)
|
33
|
+
or not -min(len(gVar.index_message["podflow"]), 4) <= Number < 0
|
34
|
+
):
|
35
|
+
Number = None
|
36
|
+
if text:
|
37
|
+
text = qrcode_to_html(Qrcode) if Qrcode else ansi_to_html(text)
|
38
|
+
if Number:
|
39
|
+
gVar.index_message["podflow"][Number] = text
|
40
|
+
elif not gVar.index_message["enter"] and gVar.index_message["podflow"]:
|
41
|
+
if Top:
|
42
|
+
gVar.index_message["podflow"][-1] = text
|
43
|
+
else:
|
44
|
+
gVar.index_message["podflow"][-1] += text
|
45
|
+
else:
|
46
|
+
gVar.index_message["podflow"].append(text)
|
47
|
+
gVar.index_message["enter"] = not NoEnter
|
48
|
+
if Url:
|
49
|
+
gVar.index_message["podflow"].append(
|
50
|
+
f'<a href="{Url}" target="_blank"><span class="ansi-url">{Url}</span></a>'
|
51
|
+
)
|
@@ -1,18 +1,19 @@
|
|
1
1
|
# podflow/bilibili/login.py
|
2
2
|
# coding: utf-8
|
3
3
|
|
4
|
-
import binascii
|
5
|
-
import json
|
6
4
|
import os
|
7
5
|
import re
|
8
6
|
import time
|
9
|
-
|
7
|
+
import json
|
8
|
+
import binascii
|
10
9
|
import requests
|
11
|
-
from
|
12
|
-
from podflow.basic.http_client import http_client
|
10
|
+
from datetime import datetime
|
13
11
|
from podflow.basic.qr_code import qr_code
|
14
|
-
from podflow.basic.time_stamp import time_stamp
|
15
12
|
from podflow.basic.write_log import write_log
|
13
|
+
from podflow.basic.file_save import file_save
|
14
|
+
from podflow.basic.time_print import time_print
|
15
|
+
from podflow.basic.time_stamp import time_stamp
|
16
|
+
from podflow.basic.http_client import http_client
|
16
17
|
from podflow.netscape.bulid_netscape import bulid_netscape
|
17
18
|
|
18
19
|
try:
|
@@ -75,13 +76,17 @@ def bilibili_scan_login(token):
|
|
75
76
|
|
76
77
|
|
77
78
|
# 登陆哔哩哔哩模块
|
78
|
-
def bilibili_login():
|
79
|
+
def bilibili_login(retry=False):
|
79
80
|
buvid3_and_bnut = http_client(
|
80
81
|
"https://www.bilibili.com", "哔哩哔哩主页", 10, 4, True
|
81
82
|
).cookies.get_dict()
|
82
83
|
token, url = bilibili_request_qr_code()
|
83
|
-
|
84
|
-
|
84
|
+
if retry:
|
85
|
+
time_print("请用BiliBili App扫描登录:", Number=-3)
|
86
|
+
upward = qr_code(url, to_html=True, num=-2)
|
87
|
+
else:
|
88
|
+
time_print("请用BiliBili App扫描登录:")
|
89
|
+
upward = qr_code(url, to_html=True)
|
85
90
|
login_status_change = ""
|
86
91
|
time_text = f"{datetime.now().strftime('%H:%M:%S')}|BiliBili "
|
87
92
|
while True:
|
@@ -97,16 +102,34 @@ def bilibili_login():
|
|
97
102
|
else:
|
98
103
|
login_status = "\033[31m错误\033[0m"
|
99
104
|
if login_status_change != login_status:
|
105
|
+
num = -1 if retry else None
|
100
106
|
if login_status == "":
|
101
|
-
|
107
|
+
time_print(
|
108
|
+
f"{time_text}{login_status}".ljust(42),
|
109
|
+
NoEnter=True,
|
110
|
+
Time=False,
|
111
|
+
Number=num,
|
112
|
+
)
|
102
113
|
else:
|
103
|
-
|
114
|
+
time_print(
|
115
|
+
f"{time_text}{login_status}".ljust(42),
|
116
|
+
Top=True,
|
117
|
+
NoEnter=True,
|
118
|
+
Time=False,
|
119
|
+
Number=num,
|
120
|
+
)
|
104
121
|
login_status_change = login_status
|
105
122
|
if status == 86038:
|
106
|
-
|
123
|
+
time_print(
|
124
|
+
"",
|
125
|
+
Time=False,
|
126
|
+
)
|
107
127
|
return status, refresh_token, upward
|
108
128
|
elif status == 0:
|
109
|
-
|
129
|
+
time_print(
|
130
|
+
"",
|
131
|
+
Time=False,
|
132
|
+
)
|
110
133
|
cookie["buvid3"] = buvid3_and_bnut.get("buvid3", "")
|
111
134
|
cookie["b_nut"] = buvid3_and_bnut.get("b_nut", "")
|
112
135
|
return cookie, refresh_token, upward
|
@@ -114,8 +137,8 @@ def bilibili_login():
|
|
114
137
|
|
115
138
|
|
116
139
|
# 保存哔哩哔哩登陆成功后的cookies模块
|
117
|
-
def save_bilibili_cookies():
|
118
|
-
bilibili_cookie, refresh_token, upward = bilibili_login()
|
140
|
+
def save_bilibili_cookies(retry=False):
|
141
|
+
bilibili_cookie, refresh_token, upward = bilibili_login(retry)
|
119
142
|
if bilibili_cookie == 86038:
|
120
143
|
return {"cookie": None}, upward
|
121
144
|
bilibili_cookie = requests.utils.dict_from_cookiejar(bilibili_cookie)
|
@@ -238,9 +261,7 @@ JNrRuoEUXpabUzGB8QIDAQAB
|
|
238
261
|
|
239
262
|
|
240
263
|
def get_bilibili_data_success(bilibili_data, channelid_bilibili_ids):
|
241
|
-
|
242
|
-
f"{datetime.now().strftime('%H:%M:%S')}|BiliBili \033[32m获取cookie成功\033[0m"
|
243
|
-
)
|
264
|
+
time_print("BiliBili \033[32m获取cookie成功\033[0m")
|
244
265
|
img_key, sub_key = getWbiKeys()
|
245
266
|
bilibili_data["img_key"] = img_key
|
246
267
|
bilibili_data["sub_key"] = sub_key
|
@@ -262,28 +283,23 @@ def get_bilibili_data_state(bilibili_data, channelid_bilibili_ids):
|
|
262
283
|
):
|
263
284
|
if bilibili_login_code != 0:
|
264
285
|
if try_num == 0:
|
265
|
-
|
266
|
-
|
267
|
-
)
|
286
|
+
time_print("BiliBili \033[31m未登陆\033[0m")
|
287
|
+
bilibili_data, upward = save_bilibili_cookies()
|
268
288
|
else:
|
269
|
-
|
270
|
-
f"
|
289
|
+
time_print(
|
290
|
+
f"BiliBili \033[31m未登陆, 重试第\033[0m{try_num}\033[31m次\033[0m",
|
291
|
+
Head=f"\033[{upward + 3}F\033[{upward + 3}K",
|
292
|
+
Number=-4
|
271
293
|
)
|
272
|
-
|
294
|
+
bilibili_data, upward = save_bilibili_cookies(True)
|
273
295
|
try_num += 1
|
274
296
|
else:
|
275
|
-
|
276
|
-
f"{datetime.now().strftime('%H:%M:%S')}|BiliBili \033[33m需刷新\033[0m"
|
277
|
-
)
|
297
|
+
time_print("BiliBili \033[33m需刷新\033[0m")
|
278
298
|
bilibili_data = bilibili_cookie_update(bilibili_data)
|
279
299
|
if bilibili_data["cookie"]:
|
280
|
-
|
281
|
-
f"{datetime.now().strftime('%H:%M:%S')}|BiliBili \033[32m刷新成功\033[0m"
|
282
|
-
)
|
300
|
+
time_print("BiliBili \033[32m刷新成功\033[0m")
|
283
301
|
else:
|
284
|
-
|
285
|
-
f"{datetime.now().strftime('%H:%M:%S')}|BiliBili \033[31m刷新失败, 重新登陆\033[0m"
|
286
|
-
)
|
302
|
+
time_print("BiliBili \033[31m刷新失败, 重新登陆\033[0m")
|
287
303
|
bilibili_login_code, bilibili_login_refresh_token = judgment_bilibili_update(
|
288
304
|
bilibili_data["cookie"]
|
289
305
|
)
|
@@ -305,9 +321,7 @@ def get_bilibili_data(channelid_bilibili_ids):
|
|
305
321
|
bilibili_data = {"cookie": None, "timestamp": 0.0}
|
306
322
|
if time.time() - bilibili_data["timestamp"] - 60 * 60 > 0:
|
307
323
|
return get_bilibili_data_state(bilibili_data, channelid_bilibili_ids)
|
308
|
-
|
309
|
-
f"{datetime.now().strftime('%H:%M:%S')}|BiliBili \033[33m获取cookie成功\033[0m"
|
310
|
-
)
|
324
|
+
time_print("BiliBili \033[33m获取cookie成功\033[0m")
|
311
325
|
if not os.path.isfile("channel_data/yt_dlp_bilibili.txt"):
|
312
326
|
bulid_netscape("yt_dlp_bilibili", bilibili_data["cookie"])
|
313
327
|
return channelid_bilibili_ids, bilibili_data
|
@@ -37,7 +37,7 @@ def download_video(
|
|
37
37
|
|
38
38
|
def error(self, msg):
|
39
39
|
msg = fail_message_initialize(msg, video_url).ljust(48)
|
40
|
-
time_print(msg, Time=False)
|
40
|
+
time_print(msg, Top=True, Time=False)
|
41
41
|
|
42
42
|
outtmpl = f"channel_audiovisual/{output_dir}/{video_url}{sesuffix}.{output_format}"
|
43
43
|
ydl_opts = {
|
@@ -78,13 +78,15 @@ def download_video(
|
|
78
78
|
or re.search(r"请求拒绝|数据不完整|传输中断|请求超时|响应超时", fail_info)
|
79
79
|
) and "www.youtube.com" in video_website:
|
80
80
|
if fail_info != "":
|
81
|
-
|
81
|
+
remove_info_part = "|"
|
82
|
+
else:
|
83
|
+
remove_info_part = ""
|
82
84
|
if os.path.isfile(outtmpl):
|
83
85
|
os.remove(outtmpl)
|
84
|
-
remove_info
|
86
|
+
remove_info = remove_info_part + "已删除失败文件"
|
85
87
|
elif os.path.isfile(outtmpl + ".part"):
|
86
88
|
os.remove(outtmpl + ".part")
|
87
|
-
remove_info
|
89
|
+
remove_info = remove_info_part + "已删除部分失败文件"
|
88
90
|
write_log(
|
89
91
|
f"{video_write_log} \033[31m下载失败\033[0m",
|
90
92
|
None,
|
@@ -3,7 +3,6 @@
|
|
3
3
|
|
4
4
|
import re
|
5
5
|
import html
|
6
|
-
from podflow import gVar
|
7
6
|
|
8
7
|
|
9
8
|
def ansi_to_html(ansi_text):
|
@@ -47,10 +46,11 @@ def ansi_to_html(ansi_text):
|
|
47
46
|
|
48
47
|
if inside_span:
|
49
48
|
html_output += "</span>"
|
50
|
-
|
49
|
+
html_output = re.sub(r'^\n', '', html_output)
|
50
|
+
html_output = re.sub(r'\n+$', '', html_output)
|
51
|
+
html_output = re.sub(r' +$', '', html_output)
|
51
52
|
return html_output
|
52
53
|
|
53
54
|
|
54
55
|
def qrcode_to_html(url):
|
55
|
-
|
56
|
-
gVar.index_message["podflow"].append(text)
|
56
|
+
return f'<span class="qrcode-container" data-url="{url}"></span>'
|
@@ -4,6 +4,7 @@
|
|
4
4
|
import sys
|
5
5
|
import json
|
6
6
|
import time
|
7
|
+
import random
|
7
8
|
import urllib
|
8
9
|
import subprocess
|
9
10
|
|
@@ -106,24 +107,30 @@ def main_podcast():
|
|
106
107
|
sys.exit(0)
|
107
108
|
# 主流程
|
108
109
|
while parse.update_num > 0 or parse.update_num == -1: # 循环主更新
|
110
|
+
# 主进度条
|
111
|
+
gVar.index_message["schedule"] = ["准备中", 0]
|
109
112
|
# 暂停进程打印
|
110
113
|
gVar.server_process_print_flag[0] = "pause"
|
111
114
|
# 获取YouTube cookie
|
112
115
|
gVar.youtube_cookie = get_youtube_cookie(gVar.channelid_youtube_ids_original)
|
116
|
+
gVar.index_message["schedule"][1] = 0.01 + random.uniform(0, 0.0049)
|
113
117
|
# 更新哔哩哔哩data
|
114
118
|
gVar.channelid_bilibili_ids, gVar.bilibili_data = get_bilibili_data(
|
115
119
|
gVar.channelid_bilibili_ids_original
|
116
120
|
)
|
121
|
+
gVar.index_message["schedule"][1] = 0.02 + random.uniform(0, 0.0049)
|
117
122
|
# 恢复进程打印
|
118
123
|
bottle_app_instance.cherry_print()
|
119
124
|
# 获取原始xml字典和rss文本
|
120
125
|
gVar.xmls_original, gVar.hash_rss_original, gVar.xmls_original_fail = (
|
121
126
|
get_original_rss()
|
122
127
|
)
|
128
|
+
gVar.index_message["schedule"][1] = 0.03 + random.uniform(0, 0.0049)
|
123
129
|
# 暂停进程打印
|
124
130
|
gVar.server_process_print_flag[0] = "pause"
|
125
131
|
# 连接上传服务器
|
126
132
|
upload_url = connect_upload_server()
|
133
|
+
gVar.index_message["schedule"][1] = 0.04 + random.uniform(0, 0.0049)
|
127
134
|
# 恢复进程打印
|
128
135
|
bottle_app_instance.cherry_print()
|
129
136
|
# 登陆上传服务器
|
@@ -133,16 +140,20 @@ def main_podcast():
|
|
133
140
|
gVar.config["upload"] = False
|
134
141
|
else:
|
135
142
|
gVar.config["upload"] = False
|
143
|
+
gVar.index_message["schedule"][1] = 0.045 + random.uniform(0, 0.0024)
|
136
144
|
# 初始化原始上传信息
|
137
145
|
get_upload_original()
|
146
|
+
gVar.index_message["schedule"][1] = 0.05
|
138
147
|
# 更新Youtube和哔哩哔哩频道xml
|
139
148
|
update_youtube_bilibili_rss()
|
149
|
+
gVar.index_message["schedule"][1] = 0.1
|
140
150
|
# 判断是否有更新内容
|
141
151
|
if gVar.channelid_youtube_ids_update or gVar.channelid_bilibili_ids_update:
|
142
152
|
gVar.update_generate_rss = True
|
143
153
|
if gVar.update_generate_rss:
|
144
154
|
# 根据日出日落修改封面(只适用原封面)
|
145
155
|
channge_icon()
|
156
|
+
gVar.index_message["schedule"][1] = 0.11 + random.uniform(0, 0.0049)
|
146
157
|
# 输出需要更新的信息
|
147
158
|
update_information_display(
|
148
159
|
gVar.channelid_youtube_ids_update,
|
@@ -156,58 +167,74 @@ def main_podcast():
|
|
156
167
|
gVar.bilibili_content_bvid_backward_update,
|
157
168
|
"BiliBili",
|
158
169
|
)
|
170
|
+
gVar.index_message["schedule"][1] = 0.12
|
159
171
|
# 暂停进程打印
|
160
172
|
gVar.server_process_print_flag[0] = "pause"
|
161
173
|
# 获取视频格式信息
|
162
174
|
get_video_format()
|
175
|
+
gVar.index_message["schedule"][1] = 0.199
|
163
176
|
# 恢复进程打印
|
164
177
|
bottle_app_instance.cherry_print()
|
165
178
|
# 删除中断下载的媒体文件
|
166
179
|
if gVar.config["delete_incompletement"]:
|
167
180
|
delete_part(gVar.channelid_youtube_ids | gVar.channelid_bilibili_ids)
|
181
|
+
gVar.index_message["schedule"] = ["构建中", 0.20]
|
168
182
|
# 暂停进程打印
|
169
183
|
gVar.server_process_print_flag[0] = "pause"
|
170
184
|
# 下载并构建YouTube和哔哩哔哩视频
|
171
185
|
download_and_build()
|
186
|
+
gVar.index_message["schedule"][1] = 0.8
|
172
187
|
# 添加新媒体至上传列表
|
173
188
|
add_upload()
|
189
|
+
gVar.index_message["schedule"][1] = 0.81 + random.uniform(0, 0.0049)
|
174
190
|
# 恢复进程打印
|
175
191
|
bottle_app_instance.cherry_print()
|
176
192
|
# 打印无法保留原节目信息
|
177
193
|
original_rss_fail_print(gVar.xmls_original_fail)
|
194
|
+
gVar.index_message["schedule"][1] = 0.82 + random.uniform(0, 0.0049)
|
178
195
|
# 打印无法获取youtube信息
|
179
196
|
print_fail_youtube()
|
197
|
+
gVar.index_message["schedule"][1] = 0.83 + random.uniform(0, 0.0049)
|
180
198
|
if gVar.config["remove_media"]:
|
181
199
|
# 删除不在rss中的媒体文件
|
182
200
|
remove_file()
|
183
201
|
# 删除已抛弃的媒体文件夹
|
184
202
|
remove_dir()
|
203
|
+
gVar.index_message["schedule"][1] = 0.84
|
185
204
|
# 补全缺失媒体文件到字典
|
186
205
|
make_up_file()
|
206
|
+
gVar.index_message["schedule"][1] = 0.85
|
187
207
|
# 按参数获取需要补全的最大个数
|
188
208
|
gVar.make_up_file_format = split_dict(
|
189
209
|
gVar.make_up_file_format,
|
190
210
|
gVar.config["completion_count"],
|
191
211
|
True,
|
192
212
|
)[0]
|
213
|
+
gVar.index_message["schedule"][1] = 0.86 + random.uniform(0, 0.0049)
|
193
214
|
# 暂停进程打印
|
194
215
|
gVar.server_process_print_flag[0] = "pause"
|
195
216
|
# 补全在rss中缺失的媒体格式信息
|
196
217
|
make_up_file_format_mod()
|
218
|
+
gVar.index_message["schedule"][1] = 0.90 + random.uniform(0, 0.0049)
|
197
219
|
# 恢复进程打印
|
198
220
|
bottle_app_instance.cherry_print()
|
221
|
+
gVar.index_message["schedule"][1] = 0.91 + random.uniform(0, 0.0049)
|
199
222
|
# 删除无法补全的媒体
|
200
223
|
del_makeup_format_fail()
|
224
|
+
gVar.index_message["schedule"][1] = 0.92 + random.uniform(0, 0.0049)
|
201
225
|
# 暂停进程打印
|
202
226
|
gVar.server_process_print_flag[0] = "pause"
|
203
227
|
# 保存rss文件模块
|
204
228
|
save_rss()
|
229
|
+
gVar.index_message["schedule"][1] = 0.93 + random.uniform(0, 0.0049)
|
205
230
|
# 下载补全Youtube和哔哩哔哩视频模块
|
206
231
|
make_up_file_mod()
|
232
|
+
gVar.index_message["schedule"][1] = 0.99 + random.uniform(0, 0.0099)
|
207
233
|
# 恢复进程打印
|
208
234
|
bottle_app_instance.cherry_print()
|
209
235
|
# 更新并保存上传列表
|
210
236
|
update_upload()
|
237
|
+
gVar.index_message["schedule"] = ["已完成", 1]
|
211
238
|
else:
|
212
239
|
time_print("频道无更新内容")
|
213
240
|
# 清空变量内数据
|
@@ -8,9 +8,17 @@ from podflow import gVar
|
|
8
8
|
# 补全缺失媒体文件到字典模块
|
9
9
|
def make_up_file():
|
10
10
|
channelid_youtube_ids = gVar.channelid_youtube_ids
|
11
|
+
channelid_bilibili_ids = gVar.channelid_bilibili_ids
|
12
|
+
num = 0
|
13
|
+
for output_dir in channelid_youtube_ids:
|
14
|
+
num += len(gVar.all_youtube_content_ytid[output_dir])
|
15
|
+
for output_dir in channelid_bilibili_ids:
|
16
|
+
num += len(gVar.all_bilibili_content_bvid[output_dir])
|
17
|
+
ratio_part = 0.01 / num if num else 0
|
11
18
|
for output_dir, name in channelid_youtube_ids.items():
|
19
|
+
youtube_os_list = os.listdir(f"channel_audiovisual/{output_dir}")
|
12
20
|
for file_name in gVar.all_youtube_content_ytid[output_dir]:
|
13
|
-
if file_name not in
|
21
|
+
if file_name not in youtube_os_list:
|
14
22
|
main = file_name.split(".")[0]
|
15
23
|
media = file_name.split(".")[1]
|
16
24
|
video_id_format = {
|
@@ -27,11 +35,14 @@ def make_up_file():
|
|
27
35
|
video_quality = 1080
|
28
36
|
video_id_format["quality"] = video_quality
|
29
37
|
gVar.make_up_file_format[main] = video_id_format
|
38
|
+
# 更新进度条
|
39
|
+
ratio = gVar.index_message["schedule"][1] + ratio_part
|
40
|
+
gVar.index_message["schedule"][1] = ratio
|
30
41
|
|
31
|
-
channelid_bilibili_ids = gVar.channelid_bilibili_ids
|
32
42
|
for output_dir, name in channelid_bilibili_ids.items():
|
43
|
+
bilibili_os_list = os.listdir(f"channel_audiovisual/{output_dir}")
|
33
44
|
for file_name in gVar.all_bilibili_content_bvid[output_dir]:
|
34
|
-
if file_name not in
|
45
|
+
if file_name not in bilibili_os_list:
|
35
46
|
main = file_name.split(".")[0][:12]
|
36
47
|
if main not in gVar.make_up_file_format:
|
37
48
|
media = file_name.split(".")[1]
|
@@ -49,3 +60,8 @@ def make_up_file():
|
|
49
60
|
video_quality = 1080
|
50
61
|
video_id_format["quality"] = video_quality
|
51
62
|
gVar.make_up_file_format[main] = video_id_format
|
63
|
+
# 更新进度条
|
64
|
+
ratio = gVar.index_message["schedule"][1] + ratio_part
|
65
|
+
if ratio > 0.85:
|
66
|
+
ratio = 0.85
|
67
|
+
gVar.index_message["schedule"][1] = ratio
|
@@ -29,6 +29,8 @@ def create_main_rss():
|
|
29
29
|
}
|
30
30
|
all_channelid = list(gVar.all_items.keys())
|
31
31
|
|
32
|
+
ratio_part = 0.6 / len(all_channelid) if all_channelid else 0
|
33
|
+
|
32
34
|
while all_channelid:
|
33
35
|
for index, output_dir in enumerate(all_channelid):
|
34
36
|
if output_dir in update_output_dir():
|
@@ -66,5 +68,10 @@ def create_main_rss():
|
|
66
68
|
"bilibili", items["items"]
|
67
69
|
)
|
68
70
|
gVar.all_items[output_dir] = items
|
71
|
+
# 主进度条更新
|
72
|
+
ratio = gVar.index_message["schedule"][1] + ratio_part
|
73
|
+
if ratio > 0.8:
|
74
|
+
ratio = 0.8
|
75
|
+
gVar.index_message["schedule"][1] = ratio
|
69
76
|
del all_channelid[index]
|
70
77
|
break
|
@@ -92,6 +92,20 @@ def get_video_format():
|
|
92
92
|
get_bilibili_format_front(gVar.bilibili_content_bvid_update, False)
|
93
93
|
get_youtube_format_front(gVar.youtube_content_ytid_backward_update, True)
|
94
94
|
get_bilibili_format_front(gVar.bilibili_content_bvid_backward_update, True)
|
95
|
+
if (
|
96
|
+
gVar.youtube_content_ytid_update
|
97
|
+
or gVar.bilibili_content_bvid_update
|
98
|
+
or gVar.youtube_content_ytid_backward_update
|
99
|
+
or gVar.bilibili_content_bvid_backward_update
|
100
|
+
):
|
101
|
+
ratio_part = 0.079 / (
|
102
|
+
len(gVar.youtube_content_ytid_update)
|
103
|
+
+ len(gVar.bilibili_content_bvid_update)
|
104
|
+
+ len(gVar.youtube_content_ytid_backward_update)
|
105
|
+
+ len(gVar.bilibili_content_bvid_backward_update)
|
106
|
+
)
|
107
|
+
else:
|
108
|
+
ratio_part = 0
|
95
109
|
# 按参数拆分获取量
|
96
110
|
if len(gVar.video_id_update_format) != 0:
|
97
111
|
video_id_update_format_list = split_dict(
|
@@ -107,5 +121,7 @@ def get_video_format():
|
|
107
121
|
)
|
108
122
|
# 获取视频信息多线程模块
|
109
123
|
get_video_format_multithread(
|
110
|
-
video_id_update_format_item,
|
124
|
+
video_id_update_format_item,
|
125
|
+
wait_animation_display_info,
|
126
|
+
ratio_part,
|
111
127
|
)
|
@@ -10,7 +10,9 @@ from podflow.message.get_youtube_and_bilibili_video_format import (
|
|
10
10
|
|
11
11
|
# YouTube&哔哩哔哩获取视频信息多线程模块
|
12
12
|
def get_video_format_multithread(
|
13
|
-
video_id_update_format_item,
|
13
|
+
video_id_update_format_item,
|
14
|
+
wait_animation_display_info,
|
15
|
+
ratio_part,
|
14
16
|
):
|
15
17
|
# 创建共享的标志变量
|
16
18
|
stop_flag = ["keep"] # 使用列表来存储标志变量
|
@@ -26,12 +28,21 @@ def get_video_format_multithread(
|
|
26
28
|
prepare_animation.start()
|
27
29
|
# 创建线程锁
|
28
30
|
video_format_lock = threading.Lock()
|
31
|
+
ratio_part_lock = threading.Lock()
|
29
32
|
# 创建线程列表
|
30
33
|
video_id_update_threads = []
|
34
|
+
|
31
35
|
for video_id in video_id_update_format_item.keys():
|
32
36
|
thread = threading.Thread(
|
33
37
|
target=get_youtube_and_bilibili_video_format,
|
34
|
-
args=(
|
38
|
+
args=(
|
39
|
+
video_id,
|
40
|
+
stop_flag,
|
41
|
+
video_format_lock,
|
42
|
+
prepare_animation,
|
43
|
+
ratio_part,
|
44
|
+
ratio_part_lock,
|
45
|
+
),
|
35
46
|
)
|
36
47
|
video_id_update_threads.append(thread)
|
37
48
|
thread.start()
|
{podflow-20250406 → podflow-20250413.1}/podflow/message/get_youtube_and_bilibili_video_format.py
RENAMED
@@ -26,7 +26,11 @@ def one_format(id_update_format, id_num):
|
|
26
26
|
|
27
27
|
# YouTube&哔哩哔哩视频信息模块
|
28
28
|
def get_youtube_and_bilibili_video_format(
|
29
|
-
id_num, stop_flag,
|
29
|
+
id_num, stop_flag,
|
30
|
+
video_format_lock,
|
31
|
+
prepare_animation,
|
32
|
+
ratio_part,
|
33
|
+
ratio_part_lock,
|
30
34
|
):
|
31
35
|
url = gVar.video_id_update_format[id_num]["url"]
|
32
36
|
media = gVar.video_id_update_format[id_num]["media"]
|
@@ -101,3 +105,9 @@ def get_youtube_and_bilibili_video_format(
|
|
101
105
|
False,
|
102
106
|
)
|
103
107
|
del gVar.video_id_update_format[id_num]
|
108
|
+
with ratio_part_lock:
|
109
|
+
# 主进度条更新
|
110
|
+
ratio = gVar.index_message["schedule"][1] + ratio_part
|
111
|
+
if ratio > 0.199:
|
112
|
+
ratio = 0.199
|
113
|
+
gVar.index_message["schedule"][1] = ratio
|
@@ -61,6 +61,12 @@ def update_youtube_bilibili_rss():
|
|
61
61
|
) in pattern_youtube_error.items():
|
62
62
|
if pattern_youtube_error_key in youtube_content:
|
63
63
|
return pattern_youtube_error_value
|
64
|
+
if gVar.channelid_youtube_ids or gVar.channelid_bilibili_ids:
|
65
|
+
ratio_part = 0.05 / (
|
66
|
+
len(gVar.channelid_youtube_ids) + len(gVar.channelid_bilibili_ids)
|
67
|
+
)
|
68
|
+
else:
|
69
|
+
ratio_part = 0
|
64
70
|
|
65
71
|
# 更新Youtube频道
|
66
72
|
for youtube_key, youtube_value in gVar.channelid_youtube_ids.copy().items():
|
@@ -97,6 +103,10 @@ def update_youtube_bilibili_rss():
|
|
97
103
|
if youtube_response_type == "text":
|
98
104
|
del gVar.channelid_youtube_ids[youtube_key]
|
99
105
|
write_log(f"YouTube频道 {youtube_value} 无法更新")
|
106
|
+
# 更新进度条
|
107
|
+
ratio = gVar.index_message["schedule"][1] + ratio_part
|
108
|
+
gVar.index_message["schedule"][1] = ratio
|
109
|
+
|
100
110
|
# 更新哔哩哔哩频道
|
101
111
|
for bilibili_key, bilibili_value in gVar.channelid_bilibili_ids.copy().items():
|
102
112
|
bilibili_space = gVar.channelid_bilibili_rss[bilibili_key]["content"]
|
@@ -114,3 +124,8 @@ def update_youtube_bilibili_rss():
|
|
114
124
|
file_save(bilibili_space, f"{bilibili_key}.json", "channel_id")
|
115
125
|
# 构建频道文件夹
|
116
126
|
folder_build(bilibili_key, "channel_audiovisual")
|
127
|
+
# 更新进度条
|
128
|
+
ratio = gVar.index_message["schedule"][1] + ratio_part
|
129
|
+
if ratio > 0.1:
|
130
|
+
ratio = 0.1
|
131
|
+
gVar.index_message["schedule"][1] = ratio
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# podflow/Netscape/get_cookie_dict.py
|
2
2
|
# coding: utf-8
|
3
3
|
|
4
|
-
from datetime import datetime
|
5
4
|
from http.cookiejar import LoadError, MozillaCookieJar
|
5
|
+
from podflow.basic.time_print import time_print
|
6
6
|
|
7
7
|
|
8
8
|
# 将Netscape转Dict模块
|
@@ -14,8 +14,8 @@ def get_cookie_dict(file):
|
|
14
14
|
cookie_jar.load(ignore_discard=True)
|
15
15
|
return {cookie.name: cookie.value for cookie in cookie_jar}
|
16
16
|
except FileNotFoundError:
|
17
|
-
|
17
|
+
time_print(f"{parts[-1]}文件不存在")
|
18
18
|
return None
|
19
19
|
except LoadError:
|
20
|
-
|
20
|
+
time_print(f"{parts[-1]}文件错误")
|
21
21
|
return None
|