免代理地址更新以及一些其他的小改进

This commit is contained in:
Yuukiy
2022-04-14 18:40:31 +08:00
parent 75e869427c
commit e8755e4131
3 changed files with 11 additions and 7 deletions
+2 -2
View File
@@ -50,9 +50,9 @@ title__chinese_first = yes
# 各个站点的免代理地址。地址失效时软件会自动尝试获取新地址,你也可以手动设置
[ProxyFree]
avsox = https://avsox.monster
javdb = https://javdb36.com
javdb = https://javdb39.com
javbus = https://www.javsee.us
javlib = https://www.e59f.com
javlib = https://www.g60y.com
# 配置整理时的命名规则
# save_dir, nfo_title和filename中可以使用变量来引用影片的数据,支持的变量列表见下面的地址:
+2 -2
View File
@@ -126,7 +126,7 @@ def get_html(url):
html.make_links_absolute(url, resolve_base_href=True)
# 清理功能仅应在需要的时候用来调试网页(如prestige),否则可能反过来影响调试(如JavBus)
# html = cleaner.clean_html(html)
# lxml.html.open_in_browser(html, encoding=encoding) # for develop and debug
# lxml.html.open_in_browser(html, encoding='utf-8') # for develop and debug
return html
@@ -211,7 +211,7 @@ def download(url, output_path, desc=None):
def open_in_chrome(url, new=0, autoraise=True):
"""使用指定的Chrome Profile打开url,便于调试"""
import subprocess
chrome = R'C:\Program Files (x86)\Google\Chrome\Application\chrome.exe'
chrome = R'C:\Program Files\Google\Chrome\Application\chrome.exe'
subprocess.run(f'"{chrome}" --profile-directory="Profile 2" {url}', shell=True)
import webbrowser
+7 -3
View File
@@ -3,6 +3,7 @@ import os
import sys
import logging
from urllib.parse import urlsplit
from requests.exceptions import ConnectionError
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
@@ -30,9 +31,12 @@ def init_network_cfg():
for proxies in proxy_cfgs:
request.proxies = proxies
for url in urls:
resp = request.get(url, delay_raise=True)
if resp.status_code == 200:
return url
try:
resp = request.get(url, delay_raise=True)
if resp.status_code == 200:
return url
except ConnectionError as e:
logger.debug(f"Fail to connect to '{url}': {e}")
logger.warning('无法绕开JavLib的反爬机制')
return permanent_url