-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #217 from miyouzi/dev
修復Web解析 #215
- Loading branch information
Showing
5 changed files
with
105 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,8 +21,8 @@ | |
sn_list_path = os.path.join(working_dir, 'sn_list.txt') | ||
cookie_path = os.path.join(working_dir, 'cookie.txt') | ||
logs_dir = os.path.join(working_dir, 'logs') | ||
aniGamerPlus_version = 'v24.2' | ||
latest_config_version = 17.0 | ||
aniGamerPlus_version = 'v24.3' | ||
latest_config_version = 17.1 | ||
latest_database_version = 2.0 | ||
cookie = None | ||
max_multi_thread = 5 | ||
|
@@ -101,7 +101,7 @@ def __init_settings(): | |
'video_filename_extension': 'mp4', # 视频扩展名/封装格式 | ||
'zerofill': 1, # 剧集名补零, 此项填补足位数, 小于等于 1 即不补零 | ||
# cookie的自动刷新对 UA 有检查 | ||
'ua': "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.96 Safari/537.36", | ||
'ua': "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36", | ||
'use_proxy': False, | ||
'proxy': 'http://user:[email protected]:1000', # 代理功能, config_version v13.0 删除链式代理 | ||
'upload_to_server': False, | ||
|
@@ -145,7 +145,7 @@ def __init_settings(): | |
'read_sn_list_when_checking_update': True, | ||
'read_config_when_checking_update': True, | ||
'ads_time': 25, | ||
'mobile_ads_time': 3, | ||
'mobile_ads_time': 25, | ||
'use_dashboard': True, | ||
'dashboard': { | ||
'host': '127.0.0.1', | ||
|
@@ -338,7 +338,7 @@ def __update_settings(old_settings): # 升级配置文件 | |
new_settings['use_mobile_api'] = False | ||
|
||
if 'mobile_ads_time' not in new_settings.keys(): | ||
new_settings['mobile_ads_time'] = 3 # 使用APP API非会员广告等待时间可低至 3s | ||
new_settings['mobile_ads_time'] = 25 # 使用APP API非会员广告等待时间可低至 3s | ||
|
||
if 'message_suffix' not in new_settings['coolq_settings'].keys(): | ||
# v21.1 新增 | ||
|
@@ -371,6 +371,10 @@ def __update_settings(old_settings): # 升级配置文件 | |
if 'only_use_vip' not in new_settings.keys(): | ||
new_settings['only_use_vip'] = False | ||
|
||
if 'no_proxy_akamai' not in new_settings.keys(): | ||
# 是否代理 akamai CDN (视频流) | ||
new_settings['no_proxy_akamai'] = False | ||
|
||
new_settings['config_version'] = latest_config_version | ||
with open(config_path, 'w', encoding='utf-8') as f: | ||
json.dump(new_settings, f, ensure_ascii=False, indent=4) | ||
|
@@ -674,6 +678,9 @@ def read_cookie(log=False): | |
os.rename(error_cookie_path, cookie_path) | ||
# 用户可以将cookie保存在程序所在目录下,保存为 cookies.txt ,UTF-8 编码 | ||
if os.path.exists(cookie_path): | ||
# 防止 Cookie 文件为空报错 | ||
if os.path.getsize(cookie_path) == 0: | ||
return None | ||
# del_bom(cookie_path) # 移除 bom | ||
check_encoding(cookie_path) # 移除 bom | ||
if log: | ||
|
@@ -816,5 +823,32 @@ def get_local_ip(): | |
return local_ip | ||
|
||
|
||
def parse_proxy(proxy_str: str) -> dict: | ||
if len(proxy_str) == 0 or proxy_str.isspace(): | ||
return {} | ||
|
||
result = {} | ||
|
||
if re.match(r'.*@.*', proxy_str): | ||
proxy_user = re.sub(r':(\/\/)?', '', re.findall(r':\/\/.*?:', proxy_str)[0]) | ||
proxy_passwd = re.sub(r'(:\/\/:)?@?', '', re.sub(proxy_user, '', re.findall(r':.*@', proxy_str)[0])) | ||
result['proxy_user'] = proxy_user | ||
result['proxy_passwd'] = proxy_passwd | ||
proxy_str = proxy_str.replace(proxy_user + ':' + proxy_passwd + '@', '') | ||
else: | ||
result['proxy_user'] = None | ||
result['proxy_passwd'] = None | ||
|
||
proxy_protocol = re.sub(r':\/\/.*', '', proxy_str).upper() | ||
proxy_ip = re.sub(r':(\/\/)?', '', re.findall(r':.*:', proxy_str)[0]) | ||
proxy_port = re.sub(r':', '', re.findall(r':\d+', proxy_str)[0]) | ||
|
||
result['proxy_protocol'] = proxy_protocol | ||
result['proxy_ip'] = proxy_ip | ||
result['proxy_port'] = proxy_port | ||
|
||
return result | ||
|
||
|
||
if __name__ == '__main__': | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,9 +20,10 @@ | |
"customized_video_filename_suffix": "", | ||
"video_filename_extension": "mp4", | ||
"zerofill": 1, | ||
"ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.96 Safari/537.36", | ||
"ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36", | ||
"use_proxy": false, | ||
"proxy": "http://user:[email protected]:1000", | ||
"no_proxy_akamai": false, | ||
"upload_to_server": false, | ||
"ftp": { | ||
"server": "", | ||
|
@@ -52,7 +53,7 @@ | |
"read_sn_list_when_checking_update": true, | ||
"read_config_when_checking_update": true, | ||
"ads_time": 25, | ||
"mobile_ads_time": 3, | ||
"mobile_ads_time": 25, | ||
"use_dashboard": true, | ||
"dashboard": { | ||
"host": "127.0.0.1", | ||
|
@@ -66,4 +67,4 @@ | |
"quantity_of_logs": 7, | ||
"config_version": 13.0, | ||
"database_version": 2.0 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,4 @@ pysocks==1.7.1 | |
lxml==4.9.1 | ||
markupsafe<2.1.0 | ||
greenlet==1.1.3 | ||
pyhttpx==1.3.30 |