Skip to content

Commit

Permalink
3.3
Browse files Browse the repository at this point in the history
  • Loading branch information
moyy996 committed Feb 4, 2020
1 parent 09064d2 commit 024dfa6
Show file tree
Hide file tree
Showing 11 changed files with 236 additions and 145 deletions.
1 change: 1 addition & 0 deletions ADC_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,4 @@ def get_html(url, cookies=None): # 网页请求核心
i += 1
print('[-]Connect retry ' + str(i) + '/' + str(retry_count))
print('[-]Connect Failed! Please check your Proxy or Network!')
return 'ProxyError'
106 changes: 71 additions & 35 deletions AVDC_Main.py

Large diffs are not rendered by default.

20 changes: 12 additions & 8 deletions avsox.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def getTitle(a):
try:
html = etree.fromstring(a, etree.HTMLParser())
result = str(html.xpath('/html/body/div[2]/h3/text()')).strip(" ['']") # [0]
return result.replace('/', '')
return result.replace('/', '').replace('_', '-')
except:
return ''

Expand Down Expand Up @@ -101,12 +101,10 @@ def main(number):
result1 = str(html.xpath('//*[@id="waterfall"]/div/a/@href')).strip(" ['']")
if result1 == '' or result1 == 'null' or result1 == 'None':
a = get_html('https://avsox.host/cn/search/' + number.replace('-', '_'))
print(a)
html = etree.fromstring(a, etree.HTMLParser()) # //table/tr[1]/td[1]/text()
result1 = str(html.xpath('//*[@id="waterfall"]/div/a/@href')).strip(" ['']")
if result1 == '' or result1 == 'null' or result1 == 'None':
a = get_html('https://avsox.host/cn/search/' + number.replace('_', ''))
print(a)
html = etree.fromstring(a, etree.HTMLParser()) # //table/tr[1]/td[1]/text()
result1 = str(html.xpath('//*[@id="waterfall"]/div/a/@href')).strip(" ['']")
web = get_html(result1)
Expand All @@ -115,7 +113,7 @@ def main(number):
try:
dic = {
'actor': getActor(web),
'title': getTitle(web).strip(getNum(web)),
'title': getTitle(web).strip(getNum(web)).strip().replace(' ', '-'),
'studio': getStudio(info),
'outline': '', #
'runtime': getRuntime(info),
Expand All @@ -133,10 +131,16 @@ def main(number):
'source': 'avsox.py',
}
except:
dic = {
'title': '',
}
if a == 'ProxyError':
dic = {
'title': '',
'website': 'timeout',
}
else:
dic = {
'title': '',
}
js = json.dumps(dic, ensure_ascii=False, sort_keys=True, indent=4, separators=(',', ':'), ) # .encode('UTF-8')
return js

# print(main('012717_472'))
# print(main('050517-522'))
2 changes: 1 addition & 1 deletion config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ website = all

[proxy]
proxy =
timeout = 10
timeout = 7
retry = 3

[Name_Rule]
Expand Down
27 changes: 7 additions & 20 deletions core.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,8 @@ def getDataFromJSON(file_number, config, mode): # 从JSON返回元数据
# ==
elif 'siro' in file_number or 'SIRO' in file_number or 'Siro' in file_number:
json_data = json.loads(siro.main(file_number))
elif not '-' in file_number or '_' in file_number:
elif re.match('\D{2,}00\d{4,}', file_number):
json_data = json.loads(fanza.main(file_number))
if getDataState(json_data) == 0: # 如果元数据获取失败,请求番号至其他网站抓取
json_data = json.loads(javbus.main(file_number))
if getDataState(json_data) == 0: # 如果元数据获取失败,请求番号至其他网站抓取
json_data = json.loads(avsox.main(file_number))
if getDataState(json_data) == 0: # 如果元数据获取失败,请求番号至其他网站抓取
json_data = json.loads(javdb.main(file_number))
# ==
else:
json_data = json.loads(javbus.main(file_number))
if getDataState(json_data) == 0: # 如果元数据获取失败,请求番号至其他网站抓取
Expand All @@ -66,8 +59,10 @@ def getDataFromJSON(file_number, config, mode): # 从JSON返回元数据
json_data = json.loads(javdb.main(file_number))

# ================================================网站规则添加结束================================================

if json_data['website'] == 'timeout':
return json_data
title = json_data['title']
number = json_data['number'].replace('_', '-')
actor_list = str(json_data['actor']).strip("[ ]").replace("'", '').split(',') # 字符串转列表
release = json_data['release']
try:
Expand Down Expand Up @@ -99,6 +94,7 @@ def getDataFromJSON(file_number, config, mode): # 从JSON返回元数据

# 返回处理后的json_data
json_data['title'] = title
json_data['number'] = number
json_data['actor'] = actor
json_data['release'] = release
json_data['cover_small'] = cover_small
Expand All @@ -118,17 +114,8 @@ def get_info(json_data): # 返回json里的数据
actor_photo = json_data['actor_photo']
actor = json_data['actor']
release = json_data['release']
tag = json_data['tag']
number = json_data['number']
cover = json_data['cover']
website = json_data['website']
return title, studio, year, outline, runtime, director, actor_photo, actor, release, number, cover, website


def copyRenameJpgToBackdrop(option, path, number, c_word):
if option == 'plex':
shutil.copy(path + '/fanart.jpg', path + '/Backdrop.jpg')
shutil.copy(path + '/poster.png', path + '/thumb.png')
if option == 'emby':
shutil.copy(path + '/' + number + c_word + '.jpg', path + '/Backdrop.jpg')
if option == 'kodi':
shutil.copy(path + '/' + number + c_word + '-fanart.jpg', path + '/Backdrop.jpg')
return title, studio, year, outline, runtime, director, actor_photo, actor, release, tag, number, cover, website
33 changes: 25 additions & 8 deletions fanza.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@ def getActor(a): # //*[@id="center_column"]/div[2]/div[1]/div/table/tbody/tr[1]
return result


def getActorPhoto(actor): # //*[@id="star_qdt"]/li/a/img
actor = actor.split(',')
d = {}
for i in actor:
if ',' not in i:
p = {i: ''}
d.update(p)
return d


def getStudio(a):
html = etree.fromstring(a, etree.HTMLParser()) # //table/tr[1]/td[1]/text()
try:
Expand All @@ -41,9 +51,9 @@ def getRuntime(a):
def getLabel(a):
html = etree.fromstring(a, etree.HTMLParser()) # //table/tr[1]/td[1]/text()
try:
result1 = html.xpath("//td[contains(text(),'シリーズ:')]/following-sibling::td/a/text()")[0]
result1 = html.xpath("//td[contains(text(),'レーベル:')]/following-sibling::td/a/text()")[0]
except:
result1 = html.xpath("//td[contains(text(),'シリーズ:')]/following-sibling::td/text()")[0]
result1 = html.xpath("//td[contains(text(),'レーベル:')]/following-sibling::td/text()")[0]
return result1


Expand Down Expand Up @@ -110,31 +120,38 @@ def main(number):
htmlcode = get_html('https://www.dmm.co.jp/mono/dvd/-/detail/=/cid=' + number)
url = 'https://www.dmm.co.jp/mono/dvd/-/detail/=/cid=' + number
try:
actor = getActor(htmlcode)
dic = {
'title': getTitle(htmlcode).strip(getActor(htmlcode)),
'studio': getStudio(htmlcode),
'outline': getOutline(htmlcode),
'runtime': getRuntime(htmlcode),
'director': getDirector(htmlcode),
'actor': getActor(htmlcode),
'actor': actor,
'release': getRelease(htmlcode),
'number': getNum(htmlcode),
'cover': getCover(htmlcode, number),
'imagecut': 1,
'tag': getTag(htmlcode),
'label': getLabel(htmlcode),
'year': getYear(getRelease(htmlcode)), # str(re.search('\d{4}',getRelease(a)).group()),
'actor_photo': '',
'actor_photo': getActorPhoto(actor),
'website': url,
'source': 'siro.py',
}
except:
dic = {
'title': '',
}
if htmlcode == 'ProxyError':
dic = {
'title': '',
'website': 'timeout',
}
else:
dic = {
'title': '',
}
js = json.dumps(dic, ensure_ascii=False, sort_keys=True, indent=4, separators=(',', ':')) # .encode('UTF-8')
return js

# main('DV-1562')
# input("[+][+]Press enter key exit, you can check the error messge before you exit.\n[+][+]按回车键结束,你可以在结束之前查看和错误信息。")
# print(main('ssni00384'))
# print(main('ssni00684'))
33 changes: 24 additions & 9 deletions fc2fans_club.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@ def getActor(htmlcode):
return ''


def getActorPhoto(actor): # //*[@id="star_qdt"]/li/a/img
actor = actor.split('/')
d = {}
for i in actor:
p = {i: ''}
d.update(p)
return d


def getStudio(htmlcode): # 获取厂商
html = etree.fromstring(htmlcode, etree.HTMLParser())
result = str(html.xpath('/html/body/div[2]/div/div[1]/h5[3]/a[1]/text()')).strip(" ['']")
Expand Down Expand Up @@ -80,31 +89,37 @@ def main(number):
'http://adult.contents.fc2.com/article_search.php?id=' + number + '&utm_source=aff_php&utm_medium=source_code&utm_campaign=from_aff_php')
htmlcode = ADC_function.get_html('https://fc2club.com//html/FC2-' + number + '.html')
actor = getActor(htmlcode)
if getActor(htmlcode) == '':
if len(actor) == 0:
actor = 'FC2系列'
try:
dic = {
'title': getTitle(htmlcode),
'title': getTitle(htmlcode).replace(' ', '-'),
'studio': getStudio(htmlcode),
'year': '', # str(re.search('\d{4}',getRelease(number)).group()),
'outline': getOutline(htmlcode2),
'runtime': getYear(getRelease(htmlcode)),
'director': getStudio(htmlcode),
'actor': actor,
'actor': actor.replace('/', ','),
'release': getRelease(number),
'number': 'FC2-' + number,
'cover': getCover(htmlcode, number, htmlcode2),
'imagecut': 0,
'tag': getTag(htmlcode),
'actor_photo': '',
'actor_photo': getActorPhoto(actor),
'website': 'https://fc2club.com//html/FC2-' + number + '.html',
'source': 'https://fc2club.com//html/FC2-' + number + '.html',
'source': 'fc2fans_club.py',
}
except:
dic = {
'title': '',
}
if htmlcode2 == 'ProxyError':
dic = {
'title': '',
'website': 'timeout',
}
else:
dic = {
'title': '',
}
js = json.dumps(dic, ensure_ascii=False, sort_keys=True, indent=4, separators=(',', ':'), ) # .encode('UTF-8')
return js

# print(main('1051725'))
# print(main('1121040'))
58 changes: 39 additions & 19 deletions javbus.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,13 @@ def getOutline(htmlcode): # 获取演员

def getSerise(htmlcode):
html = etree.fromstring(htmlcode, etree.HTMLParser())
result = str(html.xpath('/html/body/div[5]/div[1]/div[2]/p[7]/a/text()')).strip(" ['']")
result = str(html.xpath('/html/body/div[5]/div[1]/div[2]/p[6]/a/text()')).strip(" ['']")
return result


def getSerise_uncensored(htmlcode):
html = etree.fromstring(htmlcode, etree.HTMLParser())
result = str(html.xpath('/html/body/div[5]/div[1]/div[2]/p[5]/a/text()')).strip(" ['']")
return result


Expand Down Expand Up @@ -141,23 +147,37 @@ def main_uncensored(number):
if getTitle(htmlcode) == '':
htmlcode = get_html('https://www.javbus.com/' + number.replace('-', '_'))
dww_htmlcode = get_html("https://www.dmm.co.jp/mono/dvd/-/detail/=/cid=" + number.replace("-", ''))
dic = {
'title': str(re.sub('\w+-\d+-', '', getTitle(htmlcode))).replace(getNum(htmlcode) + '-', ''),
'studio': getStudio(htmlcode),
'year': getYear(htmlcode),
'outline': getOutline(dww_htmlcode),
'runtime': getRuntime(htmlcode),
'director': getDirector(htmlcode),
'actor': getActor(htmlcode),
'release': getRelease(htmlcode),
'number': getNum(htmlcode),
'cover': getCover(htmlcode),
'tag': getTag(htmlcode),
'label': getSerise(htmlcode),
'imagecut': 0,
'actor_photo': '',
'website': 'https://www.javbus.com/' + number,
'source': 'javbus.py',
}
try:
dic = {
'title': str(re.sub('\w+-\d+-', '', getTitle(htmlcode))).replace(getNum(htmlcode) + '-', ''),
'studio': getStudio(htmlcode),
'year': getYear(htmlcode),
'outline': getOutline(dww_htmlcode),
'runtime': getRuntime(htmlcode),
'director': getDirector(htmlcode),
'actor': getActor(htmlcode),
'release': getRelease(htmlcode),
'number': getNum(htmlcode),
'cover': getCover(htmlcode),
'tag': getTag(htmlcode),
'label': getSerise_uncensored(htmlcode),
'imagecut': 0,
'actor_photo': getActorPhoto(htmlcode),
'website': 'https://www.javbus.com/' + number,
'source': 'javbus.py',
}
except:
if htmlcode == 'ProxyError':
dic = {
'title': '',
'website': 'timeout',
}
else:
dic = {
'title': '',
}
js = json.dumps(dic, ensure_ascii=False, sort_keys=True, indent=4, separators=(',', ':'), ) # .encode('UTF-8')
return js

# print(main('SSNI-658'))
# print(main_uncensored('050517_522'))
Loading

0 comments on commit 024dfa6

Please sign in to comment.