Skip to content

Commit

Permalink
Fix: 自定义网址可能不存在; airavcc jp失效 (#38)
Browse files Browse the repository at this point in the history
Add: 使用自定义网址进行网络检测
  • Loading branch information
sqzw-x committed Jan 8, 2024
1 parent c869f15 commit 07d7462
Show file tree
Hide file tree
Showing 13 changed files with 143 additions and 220 deletions.
9 changes: 0 additions & 9 deletions config.ini.default
Original file line number Diff line number Diff line change
Expand Up @@ -191,15 +191,6 @@ type = no
proxy = 127.0.0.1:7890
timeout = 10
retry = 3
javbus_website =
javdb_website =
iqqtv_website =
avsex_website =
hdouban_website =
mdtv_website =
airavcc_website =
lulubar_website =
javlibrary_website =
theporndb_api_token =

[Cookies]
Expand Down
264 changes: 115 additions & 149 deletions src/controllers/main_window/main_window.py

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion src/controllers/main_window/save_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,9 @@ def save_config(self):

custom_website_name = self.Ui.comboBox_custom_website.currentText()
custom_website_url = self.Ui.lineEdit_custom_website.text()
setattr(config, f"{custom_website_name}_website", custom_website_url)
if custom_website_url:
custom_website_url = custom_website_url.strip('/ ')
setattr(config, f"{custom_website_name}_website", custom_website_url)
config.javdb = self.Ui.plainTextEdit_cookie_javdb.toPlainText() # javdb cookie
config.javbus = self.Ui.plainTextEdit_cookie_javbus.toPlainText() # javbus cookie
config.theporndb_api_token = self.Ui.lineEdit_api_token_theporndb.text() # api token
Expand Down
9 changes: 0 additions & 9 deletions src/models/config/config_generated.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,15 +202,6 @@ class GeneratedConfig:
proxy = r'127.0.0.1:7890'
timeout = 10
retry = 3
javbus_website = r''
javdb_website = r''
iqqtv_website = r''
avsex_website = r''
hdouban_website = r''
mdtv_website = r''
airavcc_website = r''
lulubar_website = r''
javlibrary_website = r''
theporndb_api_token = r''

# Cookies
Expand Down
32 changes: 5 additions & 27 deletions src/models/core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,33 +164,11 @@ def deal_url(url):
return vlaue, url

# 自定义的网址
avsex_website = config.avsex_website
if avsex_website and avsex_website in url:
return 'avsex', url
iqqtv_website = config.iqqtv_website
if iqqtv_website and iqqtv_website in url:
return 'iqqtv', url
hdouban_website = config.hdouban_website
if hdouban_website and hdouban_website in url:
return 'hdouban', url
mdtv_website = config.mdtv_website
if mdtv_website and mdtv_website in url:
return 'mdtv', url
airavcc_website = config.airavcc_website
if airavcc_website and airavcc_website in url:
return 'airav_cc', url
lulubar_website = config.lulubar_website
if lulubar_website and lulubar_website in url:
return 'lulubar', url
javbus_website = config.javbus_website
if javbus_website and javbus_website in url:
return 'javbus', url
javdb_website = config.javdb_website
if javdb_website and javdb_website in url:
return 'javdb', url
javlibrary_website = config.javlibrary_website
if javlibrary_website and javlibrary_website in url:
return 'javlibrary', url
for web_name in config.SUPPORTED_WEBSITES:
if hasattr(config, web_name + '_website'):
web_url = getattr(config, web_name + '_website')
if web_url in url:
return web_name, url

return False, url

Expand Down
10 changes: 5 additions & 5 deletions src/models/crawlers/airav_cc.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from lxml import etree

from models.base.web import curl_html
from models.config import config
from models.signals import signal

urllib3.disable_warnings() # yapf: disable
Expand Down Expand Up @@ -119,12 +120,11 @@ def main(number, appoint_url='', log_info='', req_web='', language='zh_cn'):
image_download = False
url_search = ''
mosaic = '有码'
airav_url = 'https://airav5.fun'
if hasattr(config, 'airav_cc_website'):
airav_url = config.airav_cc_website
if language == 'zh_cn':
airav_url = 'https://airav5.fun/cn'
elif language == 'zh_tw':
airav_url = 'https://airav5.fun'
else:
airav_url = 'https://airav5.fun/jp'
airav_url += '/cn'
web_info = '\n '
log_info += ' \n 🌐 airav[%s]' % language.replace('zh_', '')
debug_info = ''
Expand Down
5 changes: 2 additions & 3 deletions src/models/crawlers/avsex.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,8 @@ def main(number, appoint_url='', log_info='', req_web='', language=''):
if not re.match(r'n\d{4}', number):
number = number.upper()
avsex_url = 'https://paycalling.com'
avsex_website = config.avsex_website
if avsex_website:
avsex_url = avsex_website
if hasattr(config, 'avsex_website'):
avsex_url = config.avsex_website
if appoint_url:
if 'http' in appoint_url:
avsex_url = re.findall(r'(.*//[^/]*)\/', appoint_url)[0]
Expand Down
5 changes: 3 additions & 2 deletions src/models/crawlers/hdouban.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,9 @@ def main(number, appoint_url='', log_info='', req_web='', language='zh_cn', file
score = ''
series = ''
trailer = ''
hdouban_website = config.hdouban_website
hdouban_url = hdouban_website if hdouban_website else 'https://ormtgu.com'
hdouban_url = 'https://ormtgu.com'
if hasattr(config, 'hdouban_website'):
hdouban_url = config.hdouban_website

# real_url = 'https://byym21.com/moviedetail/153858'
# real_url = 'https://byym21.com/moviedetail/2202'
Expand Down
5 changes: 2 additions & 3 deletions src/models/crawlers/iqqtv.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,8 @@ def main(number, appoint_url='', log_info='', req_web='', language='zh_cn'):
real_url = appoint_url
# iqqtv_url = 'https://iqqtv.net'
iqqtv_url = 'https://iqq5.xyz'
iqqtv_website = config.iqqtv_website
if iqqtv_website:
iqqtv_url = iqqtv_website
if hasattr(config, 'iqqtv_website'):
iqqtv_url = config.iqqtv_website
cover_url = ''
image_cut = 'right'
image_download = False
Expand Down
5 changes: 2 additions & 3 deletions src/models/crawlers/javbus.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,8 @@ def main(number, appoint_url='', log_info='', req_web='', language='jp', mosaic=
}
headers.update(headers_o)

javbus_website = config.javbus_website
if javbus_website:
javbus_url = javbus_website
if hasattr(config, 'javbus_website'):
javbus_url = config.javbus_website
title = ''
cover_url = ''
poster_url = ''
Expand Down
5 changes: 2 additions & 3 deletions src/models/crawlers/javdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,9 @@ def main(number, appoint_url='', log_info='', req_web='', language='jp', org_lan

javdb_time = config.javdb_time
cookies = config.javdb_cookie
javdb_website = config.javdb_website
javdb_url = 'https://javdb.com'
if javdb_website:
javdb_url = javdb_website
if hasattr(config, 'javdb_website'):
javdb_url = config.javdb_website
if appoint_url and '?locale' not in appoint_url:
appoint_url += '?locale=zh'
real_url = appoint_url
Expand Down
5 changes: 2 additions & 3 deletions src/models/crawlers/javlibrary.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,9 @@ def main(number, appoint_url='', log_info='', req_web='', language='zh_cn'):
req_web += '-> %s[%s]' % (website_name, language)
proxies = True

javlibrary_website = config.javlibrary_website
domain = 'https://www.javlibrary.com'
if javlibrary_website:
domain = javlibrary_website
if hasattr(config, 'javlibrary_website'):
domain = config.javlibrary_website
proxies = False
real_url = appoint_url
title = ''
Expand Down
5 changes: 2 additions & 3 deletions src/models/crawlers/mdtv.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,9 @@ def main(number, appoint_url='', log_info='', req_web='', language='zh_cn', file
log_info += ' \n 🌐 mdtv'
debug_info = ''

mdtv_website = config.mdtv_website
mdtv_url = 'https://www.mdpjzip.xyz'
if mdtv_website:
mdtv_url = mdtv_website
if hasattr(config, 'mdtv_website'):
mdtv_url = config.mdtv_website
real_url = appoint_url
search_url = f"{mdtv_url}/index.php/vodsearch/-------------.html"

Expand Down

0 comments on commit 07d7462

Please sign in to comment.