Skip to content

Commit

Permalink
2021-06-05-修复JAVBUS封面问题
Browse files Browse the repository at this point in the history
  • Loading branch information
moyy996 committed Jun 5, 2021
1 parent 0c00473 commit 42ea8c0
Show file tree
Hide file tree
Showing 13 changed files with 377 additions and 366 deletions.
30 changes: 16 additions & 14 deletions AVDC_Main.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def __init__(self, parent=None):
self.Init_Ui()
self.set_style()
# 初始化需要的变量
self.version = '3.963'
self.version = '3.964'
self.m_drag = False
self.m_DragPosition = 0
self.count_claw = 0 # 批量刮削次数
Expand Down Expand Up @@ -341,20 +341,18 @@ def Load_Config(self):
self.Ui.comboBox_website_all.setCurrentIndex(0)
elif config['common']['website'] == 'mgstage':
self.Ui.comboBox_website_all.setCurrentIndex(1)
elif config['common']['website'] == 'fc2club':
self.Ui.comboBox_website_all.setCurrentIndex(2)
elif config['common']['website'] == 'javbus':
self.Ui.comboBox_website_all.setCurrentIndex(3)
self.Ui.comboBox_website_all.setCurrentIndex(2)
elif config['common']['website'] == 'jav321':
self.Ui.comboBox_website_all.setCurrentIndex(4)
self.Ui.comboBox_website_all.setCurrentIndex(3)
elif config['common']['website'] == 'javdb':
self.Ui.comboBox_website_all.setCurrentIndex(5)
self.Ui.comboBox_website_all.setCurrentIndex(4)
elif config['common']['website'] == 'avsox':
self.Ui.comboBox_website_all.setCurrentIndex(6)
self.Ui.comboBox_website_all.setCurrentIndex(5)
elif config['common']['website'] == 'xcity':
self.Ui.comboBox_website_all.setCurrentIndex(7)
self.Ui.comboBox_website_all.setCurrentIndex(6)
elif config['common']['website'] == 'dmm':
self.Ui.comboBox_website_all.setCurrentIndex(8)
self.Ui.comboBox_website_all.setCurrentIndex(7)
self.Ui.lineEdit_success.setText(config['common']['success_output_folder'])
self.Ui.lineEdit_fail.setText(config['common']['failed_output_folder'])
# ========================================================================proxy
Expand Down Expand Up @@ -514,8 +512,6 @@ def save_config_clicked(self):
website = 'all'
elif self.Ui.comboBox_website_all.currentText() == 'mgstage': # mgstage
website = 'mgstage'
elif self.Ui.comboBox_website_all.currentText() == 'fc2club': # fc2club
website = 'fc2club'
elif self.Ui.comboBox_website_all.currentText() == 'javbus': # javbus
website = 'javbus'
elif self.Ui.comboBox_website_all.currentText() == 'jav321': # jav321
Expand Down Expand Up @@ -1233,8 +1229,14 @@ def PrintFiles(self, path, name_file, cn_sub, leak, json_data, filepath, failed_

# ========================================================================thumb复制为fanart
def copyRenameJpgToFanart(self, path, naming_rule):
if not os.path.exists(path + '/' + naming_rule + '-fanart.jpg'):
shutil.copy(path + '/' + naming_rule + '-thumb.jpg', path + '/' + naming_rule + '-fanart.jpg')
try:
if not os.path.exists(path + '/' + naming_rule + '-fanart.jpg'):
shutil.copy(path + '/' + naming_rule + '-thumb.jpg', path + '/' + naming_rule + '-fanart.jpg')
self.add_text_main('[+]Fanart Copied! ' + naming_rule + '-fanart.jpg')
else:
self.add_text_main('[+]Fanart Existed! ' + naming_rule + '-fanart.jpg')
except Exception as error_info:
self.add_text_main('[-]Error in copyRenameJpgToFanart: ' + str(error_info))

# ========================================================================移动视频、字幕
def pasteFileToFolder(self, filepath, path, naming_rule, failed_folder):
Expand Down Expand Up @@ -1417,7 +1419,7 @@ def creatFolder(self, success_folder, json_data, config):

# ========================================================================从指定网站获取json_data
def get_json_data(self, mode, number, config, appoint_url):
if mode == 6: # javdb模式
if mode == 5: # javdb模式
self.add_text_main('[!]Please Wait Three Seconds!')
time.sleep(3)
json_data = getDataFromJSON(number, config, mode, appoint_url)
Expand Down
22 changes: 9 additions & 13 deletions Function/Function.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import json
from PIL import Image
from configparser import ConfigParser
from Getter import avsox, javbus, javdb, fc2fans_club, mgstage, dmm, jav321, xcity
from Getter import avsox, javbus, javdb, mgstage, dmm, jav321, xcity


# ========================================================================获取config
Expand Down Expand Up @@ -162,9 +162,7 @@ def getDataFromJSON(file_number, config, mode, appoint_url): # 从JSON返回元
json_data = json.loads(javbus.main(file_number, appoint_url))
# =======================================================================FC2-111111
elif 'FC2' in file_number.upper():
json_data = json.loads(fc2fans_club.main(re.search('\d{4,}', file_number).group(), appoint_url))
if getDataState(json_data) == 0:
json_data = json.loads(javdb.main(file_number, appoint_url))
json_data = json.loads(javdb.main(file_number, appoint_url))
# =======================================================================ssni00321
elif re.match('\D{2,}00\d{3,}', file_number) and '-' not in file_number and '_' not in file_number:
json_data = json.loads(dmm.main(file_number, appoint_url))
Expand Down Expand Up @@ -192,27 +190,25 @@ def getDataFromJSON(file_number, config, mode, appoint_url): # 从JSON返回元
}
elif mode == 2: # 仅从mgstage
json_data = json.loads(mgstage.main(file_number, appoint_url))
elif mode == 3: # 仅从fc2club
json_data = json.loads(fc2fans_club.main(file_number, appoint_url))
elif mode == 4: # 仅从javbus
elif mode == 3: # 仅从javbus
if isuncensored:
json_data = json.loads(javbus.main_uncensored(file_number, appoint_url))
elif re.search('\D+\.\d{2}\.\d{2}\.\d{2}', file_number):
json_data = json.loads(javbus.main_us(file_number, appoint_url))
else:
json_data = json.loads(javbus.main(file_number, appoint_url))
elif mode == 5: # 仅从jav321
elif mode == 4: # 仅从jav321
json_data = json.loads(jav321.main(file_number, isuncensored, appoint_url))
elif mode == 6: # 仅从javdb
elif mode == 5: # 仅从javdb
if re.search('\D+\.\d{2}\.\d{2}\.\d{2}', file_number):
json_data = json.loads(javdb.main_us(file_number, appoint_url))
else:
json_data = json.loads(javdb.main(file_number, isuncensored, appoint_url))
elif mode == 7: # 仅从avsox
json_data = json.loads(javdb.main(file_number, appoint_url, isuncensored))
elif mode == 6: # 仅从avsox
json_data = json.loads(avsox.main(file_number, appoint_url))
elif mode == 8: # 仅从xcity
elif mode == 7: # 仅从xcity
json_data = json.loads(xcity.main(file_number, appoint_url))
elif mode == 9: # 仅从dmm
elif mode == 8: # 仅从dmm
json_data = json.loads(dmm.main(file_number, appoint_url))

# ================================================网站规则添加结束================================================
Expand Down
11 changes: 11 additions & 0 deletions Function/getHtml.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import requests
import os
from configparser import ConfigParser
import cloudscraper


# ========================================================================获取config
Expand Down Expand Up @@ -32,6 +33,16 @@ def get_proxies(proxy_type, proxy):


# ========================================================================网页请求
# 破解cf5秒盾
def get_html_javdb(url):
scraper = cloudscraper.create_scraper()
# 发送请求,获得响应
response = scraper.get(url)
# 获得网页源代码
html = response.text
return html


def get_html(url, cookies=None):
proxy_type = ''
retry_count = 0
Expand Down
12 changes: 6 additions & 6 deletions Getter/avsox.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def getTag(a): # 获取演员


def getUrl(number):
response = get_html('https://avsox.host/cn/search/' + number)
response = get_html('https://avsox.website/cn/search/' + number)
html = etree.fromstring(response, etree.HTMLParser()) # //table/tr[1]/td[1]/text()
url_list = html.xpath('//*[@id="waterfall"]/div/a/@href')
if len(url_list) > 0:
Expand All @@ -105,11 +105,12 @@ def getUrl(number):
'//*[@id="waterfall"]/div[' + str(i) + ']/a/div[@class="photo-info"]/span/date[1]/text()')).strip(
" ['']")
if number.upper() == number_get.upper():
return i, response, str(html.xpath('//*[@id="waterfall"]/div[' + str(i) + ']/a/@href')).strip(" ['']")
page_url = 'https:' + url_list[i-1]
return i, response, page_url
return 0, response, ''


def main(number, appoint_url):
def main(number, appoint_url=''):
try:
count, response, url = getUrl(number)
if str(response) == 'ProxyError':
Expand All @@ -122,7 +123,6 @@ def main(number, appoint_url):
soup = BeautifulSoup(web, 'lxml')
info = str(soup.find(attrs={'class': 'row movie'}))
number = getNum(web)
print(1)
dic = {
'actor': getActor(web),
'title': getTitle(web).strip(number).strip().replace(' ', '-'),
Expand All @@ -143,7 +143,7 @@ def main(number, appoint_url):
'outline': '',
'score': '',
'website': url,
'source': 'avsox.py',
'source': 'avsox.website',
}
except TimeoutError:
dic = {
Expand All @@ -162,4 +162,4 @@ def main(number, appoint_url):

# print(main('051119-917'))
# print(main('032620_001'))
# print(main('032620_001', 'https://avsox.host/cn/movie/cb8d28437cff4e90'))
# print(main('032620_001', 'https://avsox.website/cn/movie/cb8d28437cff4e90'))
Loading

0 comments on commit 42ea8c0

Please sign in to comment.