Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
70f1b16b3c | ||
|
|
0b5d68732f | ||
|
|
241ff00a0b | ||
|
|
4131b00965 | ||
|
|
6f6ed31b31 | ||
|
|
c073a1e253 | ||
|
|
3545705283 | ||
|
|
9c71e5976a | ||
|
|
e25da134da | ||
|
|
b990c974b6 |
+1
-1
@@ -14,7 +14,7 @@ os.chdir(os.getcwd())
|
|||||||
|
|
||||||
# ============global var===========
|
# ============global var===========
|
||||||
|
|
||||||
version='2.0'
|
version='2.2'
|
||||||
|
|
||||||
config = ConfigParser()
|
config = ConfigParser()
|
||||||
config.read(config_file, encoding='UTF-8')
|
config.read(config_file, encoding='UTF-8')
|
||||||
|
|||||||
@@ -71,16 +71,16 @@ def getTag(a): # 获取演员
|
|||||||
return d
|
return d
|
||||||
|
|
||||||
def main(number):
|
def main(number):
|
||||||
a = get_html('https://avsox.asia/cn/search/' + number)
|
a = get_html('https://avsox.host/cn/search/' + number)
|
||||||
html = etree.fromstring(a, etree.HTMLParser()) # //table/tr[1]/td[1]/text()
|
html = etree.fromstring(a, etree.HTMLParser()) # //table/tr[1]/td[1]/text()
|
||||||
result1 = str(html.xpath('//*[@id="waterfall"]/div/a/@href')).strip(" ['']")
|
result1 = str(html.xpath('//*[@id="waterfall"]/div/a/@href')).strip(" ['']")
|
||||||
if result1 == '' or result1 == 'null' or result1 == 'None':
|
if result1 == '' or result1 == 'null' or result1 == 'None':
|
||||||
a = get_html('https://avsox.asia/cn/search/' + number.replace('-', '_'))
|
a = get_html('https://avsox.host/cn/search/' + number.replace('-', '_'))
|
||||||
print(a)
|
print(a)
|
||||||
html = etree.fromstring(a, etree.HTMLParser()) # //table/tr[1]/td[1]/text()
|
html = etree.fromstring(a, etree.HTMLParser()) # //table/tr[1]/td[1]/text()
|
||||||
result1 = str(html.xpath('//*[@id="waterfall"]/div/a/@href')).strip(" ['']")
|
result1 = str(html.xpath('//*[@id="waterfall"]/div/a/@href')).strip(" ['']")
|
||||||
if result1 == '' or result1 == 'null' or result1 == 'None':
|
if result1 == '' or result1 == 'null' or result1 == 'None':
|
||||||
a = get_html('https://avsox.asia/cn/search/' + number.replace('_', ''))
|
a = get_html('https://avsox.host/cn/search/' + number.replace('_', ''))
|
||||||
print(a)
|
print(a)
|
||||||
html = etree.fromstring(a, etree.HTMLParser()) # //table/tr[1]/td[1]/text()
|
html = etree.fromstring(a, etree.HTMLParser()) # //table/tr[1]/td[1]/text()
|
||||||
result1 = str(html.xpath('//*[@id="waterfall"]/div/a/@href')).strip(" ['']")
|
result1 = str(html.xpath('//*[@id="waterfall"]/div/a/@href')).strip(" ['']")
|
||||||
@@ -109,4 +109,4 @@ def main(number):
|
|||||||
js = json.dumps(dic, ensure_ascii=False, sort_keys=True, indent=4, separators=(',', ':'), ) # .encode('UTF-8')
|
js = json.dumps(dic, ensure_ascii=False, sort_keys=True, indent=4, separators=(',', ':'), ) # .encode('UTF-8')
|
||||||
return js
|
return js
|
||||||
|
|
||||||
#print(main('041516_541'))
|
#print(main('012717_472'))
|
||||||
@@ -140,7 +140,7 @@ def getDataFromJSON(file_number): # 从JSON返回元数据
|
|||||||
json_data = json.loads(javbus.main(file_number))
|
json_data = json.loads(javbus.main(file_number))
|
||||||
if getDataState(json_data) == 0: # 如果元数据获取失败,请求番号至其他网站抓取
|
if getDataState(json_data) == 0: # 如果元数据获取失败,请求番号至其他网站抓取
|
||||||
json_data = json.loads(avsox.main(file_number))
|
json_data = json.loads(avsox.main(file_number))
|
||||||
elif getDataState(json_data) == 0: # 如果元数据获取失败,请求番号至其他网站抓取
|
if getDataState(json_data) == 0: # 如果元数据获取失败,请求番号至其他网站抓取
|
||||||
json_data = json.loads(javdb.main(file_number))
|
json_data = json.loads(javdb.main(file_number))
|
||||||
|
|
||||||
# ================================================网站规则添加结束================================================
|
# ================================================网站规则添加结束================================================
|
||||||
@@ -183,6 +183,7 @@ def getDataFromJSON(file_number): # 从JSON返回元数据
|
|||||||
title = title.replace('<', '')
|
title = title.replace('<', '')
|
||||||
title = title.replace('>', '')
|
title = title.replace('>', '')
|
||||||
title = title.replace('|', '')
|
title = title.replace('|', '')
|
||||||
|
release = release.replace('/', '-')
|
||||||
tmpArr = cover_small.split(',')
|
tmpArr = cover_small.split(',')
|
||||||
if len(tmpArr) > 0:
|
if len(tmpArr) > 0:
|
||||||
cover_small = tmpArr[0].strip('\"').strip('\'')
|
cover_small = tmpArr[0].strip('\"').strip('\'')
|
||||||
@@ -346,7 +347,7 @@ def PrintFiles():
|
|||||||
for key, value in actor_photo.items():
|
for key, value in actor_photo.items():
|
||||||
print(" <actor>", file=code)
|
print(" <actor>", file=code)
|
||||||
print(" <name>" + key + "</name>", file=code)
|
print(" <name>" + key + "</name>", file=code)
|
||||||
if not actor_photo == '': # or actor_photo == []:
|
if not value == '': # or actor_photo == []:
|
||||||
print(" <thumb>" + value + "</thumb>", file=code)
|
print(" <thumb>" + value + "</thumb>", file=code)
|
||||||
print(" </actor>", file=code)
|
print(" </actor>", file=code)
|
||||||
except:
|
except:
|
||||||
@@ -393,7 +394,7 @@ def PrintFiles():
|
|||||||
for key, value in actor_photo.items():
|
for key, value in actor_photo.items():
|
||||||
print(" <actor>", file=code)
|
print(" <actor>", file=code)
|
||||||
print(" <name>" + key + "</name>", file=code)
|
print(" <name>" + key + "</name>", file=code)
|
||||||
if not actor_photo == '': # or actor_photo == []:
|
if not value == '': # or actor_photo == []:
|
||||||
print(" <thumb>" + value + "</thumb>", file=code)
|
print(" <thumb>" + value + "</thumb>", file=code)
|
||||||
print(" </actor>", file=code)
|
print(" </actor>", file=code)
|
||||||
except:
|
except:
|
||||||
@@ -416,7 +417,7 @@ def PrintFiles():
|
|||||||
if cn_sub == '1':
|
if cn_sub == '1':
|
||||||
print(" <genre>中文字幕</genre>", file=code)
|
print(" <genre>中文字幕</genre>", file=code)
|
||||||
print(" <num>" + number + "</num>", file=code)
|
print(" <num>" + number + "</num>", file=code)
|
||||||
print(" <release>" + release + "</release>", file=code)
|
print(" <premiered>" + release + "</premiered>", file=code)
|
||||||
print(" <cover>" + cover + "</cover>", file=code)
|
print(" <cover>" + cover + "</cover>", file=code)
|
||||||
print(" <website>" + "https://www.javbus.com/" + number + "</website>", file=code)
|
print(" <website>" + "https://www.javbus.com/" + number + "</website>", file=code)
|
||||||
print("</movie>", file=code)
|
print("</movie>", file=code)
|
||||||
@@ -439,7 +440,7 @@ def PrintFiles():
|
|||||||
for key, value in actor_photo.items():
|
for key, value in actor_photo.items():
|
||||||
print(" <actor>", file=code)
|
print(" <actor>", file=code)
|
||||||
print(" <name>" + key + "</name>", file=code)
|
print(" <name>" + key + "</name>", file=code)
|
||||||
if not actor_photo == '': # or actor_photo == []:
|
if not value == '': # or actor_photo == []:
|
||||||
print(" <thumb>" + value + "</thumb>", file=code)
|
print(" <thumb>" + value + "</thumb>", file=code)
|
||||||
print(" </actor>", file=code)
|
print(" </actor>", file=code)
|
||||||
except:
|
except:
|
||||||
|
|||||||
@@ -3,6 +3,9 @@ from lxml import etree
|
|||||||
import json
|
import json
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
from ADC_function import *
|
from ADC_function import *
|
||||||
|
# import sys
|
||||||
|
# import io
|
||||||
|
# sys.stdout = io.TextIOWrapper(sys.stdout.buffer, errors = 'replace', line_buffering = True)
|
||||||
|
|
||||||
def getTitle(a):
|
def getTitle(a):
|
||||||
try:
|
try:
|
||||||
@@ -16,10 +19,17 @@ def getActor(a): #//*[@id="center_column"]/div[2]/div[1]/div/table/tbody/tr[1]/t
|
|||||||
result1 = str(html.xpath('//strong[contains(text(),"演員")]/../following-sibling::span/text()')).strip(" ['']")
|
result1 = str(html.xpath('//strong[contains(text(),"演員")]/../following-sibling::span/text()')).strip(" ['']")
|
||||||
result2 = str(html.xpath('//strong[contains(text(),"演員")]/../following-sibling::span/a/text()')).strip(" ['']")
|
result2 = str(html.xpath('//strong[contains(text(),"演員")]/../following-sibling::span/a/text()')).strip(" ['']")
|
||||||
return str(result1 + result2).strip('+').replace(",\\xa0", "").replace("'", "").replace(' ', '').replace(',,', '').lstrip(',').replace(',', ', ')
|
return str(result1 + result2).strip('+').replace(",\\xa0", "").replace("'", "").replace(' ', '').replace(',,', '').lstrip(',').replace(',', ', ')
|
||||||
|
def getActorPhoto(actor): #//*[@id="star_qdt"]/li/a/img
|
||||||
|
a = actor.split(',')
|
||||||
|
d={}
|
||||||
|
for i in a:
|
||||||
|
p={i:''}
|
||||||
|
d.update(p)
|
||||||
|
return d
|
||||||
def getStudio(a):
|
def getStudio(a):
|
||||||
html = etree.fromstring(a, etree.HTMLParser()) # //table/tr[1]/td[1]/text()
|
html = etree.fromstring(a, etree.HTMLParser()) # //table/tr[1]/td[1]/text()
|
||||||
result1 = str(html.xpath('//strong[contains(text(),"製作")]/../following-sibling::span/text()')).strip(" ['']")
|
result1 = str(html.xpath('//strong[contains(text(),"片商")]/../following-sibling::span/text()')).strip(" ['']")
|
||||||
result2 = str(html.xpath('//strong[contains(text(),"製作")]/../following-sibling::span/a/text()')).strip(" ['']")
|
result2 = str(html.xpath('//strong[contains(text(),"片商")]/../following-sibling::span/a/text()')).strip(" ['']")
|
||||||
return str(result1 + result2).strip('+').replace("', '", '').replace('"', '')
|
return str(result1 + result2).strip('+').replace("', '", '').replace('"', '')
|
||||||
def getRuntime(a):
|
def getRuntime(a):
|
||||||
html = etree.fromstring(a, etree.HTMLParser()) # //table/tr[1]/td[1]/text()
|
html = etree.fromstring(a, etree.HTMLParser()) # //table/tr[1]/td[1]/text()
|
||||||
@@ -35,7 +45,7 @@ def getNum(a):
|
|||||||
html = etree.fromstring(a, etree.HTMLParser())
|
html = etree.fromstring(a, etree.HTMLParser())
|
||||||
result1 = str(html.xpath('//strong[contains(text(),"番號")]/../following-sibling::span/text()')).strip(" ['']")
|
result1 = str(html.xpath('//strong[contains(text(),"番號")]/../following-sibling::span/text()')).strip(" ['']")
|
||||||
result2 = str(html.xpath('//strong[contains(text(),"番號")]/../following-sibling::span/a/text()')).strip(" ['']")
|
result2 = str(html.xpath('//strong[contains(text(),"番號")]/../following-sibling::span/a/text()')).strip(" ['']")
|
||||||
return str(result1 + result2).strip('+')
|
return str(result2 + result1).strip('+')
|
||||||
def getYear(getRelease):
|
def getYear(getRelease):
|
||||||
try:
|
try:
|
||||||
result = str(re.search('\d{4}', getRelease).group())
|
result = str(re.search('\d{4}', getRelease).group())
|
||||||
@@ -52,11 +62,15 @@ def getTag(a):
|
|||||||
result1 = str(html.xpath('//strong[contains(text(),"类别")]/../following-sibling::span/text()')).strip(" ['']")
|
result1 = str(html.xpath('//strong[contains(text(),"类别")]/../following-sibling::span/text()')).strip(" ['']")
|
||||||
result2 = str(html.xpath('//strong[contains(text(),"类别")]/../following-sibling::span/a/text()')).strip(" ['']")
|
result2 = str(html.xpath('//strong[contains(text(),"类别")]/../following-sibling::span/a/text()')).strip(" ['']")
|
||||||
return str(result1 + result2).strip('+').replace(",\\xa0", "").replace("'", "").replace(' ', '').replace(',,', '').lstrip(',')
|
return str(result1 + result2).strip('+').replace(",\\xa0", "").replace("'", "").replace(' ', '').replace(',,', '').lstrip(',')
|
||||||
|
def getCover_small(a):
|
||||||
|
html = etree.fromstring(a, etree.HTMLParser()) # //table/tr[1]/td[1]/text()
|
||||||
|
result = html.xpath("//div[@class='item-image fix-scale-cover']/img/@src")[0]
|
||||||
|
if not 'https' in result:
|
||||||
|
result = 'https:' + result
|
||||||
|
return result
|
||||||
def getCover(htmlcode):
|
def getCover(htmlcode):
|
||||||
html = etree.fromstring(htmlcode, etree.HTMLParser())
|
html = etree.fromstring(htmlcode, etree.HTMLParser())
|
||||||
result = str(html.xpath('/html/body/section/div/div[2]/div[1]/a/img/@src')).strip(" ['']")
|
result = str(html.xpath("//div[@class='column column-video-cover']/a/img/@src")).strip(" ['']")
|
||||||
if result == '':
|
|
||||||
result = str(html.xpath('/html/body/section/div/div[3]/div[1]/a/img/@src')).strip(" ['']")
|
|
||||||
return result
|
return result
|
||||||
def getDirector(a):
|
def getDirector(a):
|
||||||
html = etree.fromstring(a, etree.HTMLParser()) # //table/tr[1]/td[1]/text()
|
html = etree.fromstring(a, etree.HTMLParser()) # //table/tr[1]/td[1]/text()
|
||||||
@@ -68,16 +82,17 @@ def getOutline(htmlcode):
|
|||||||
result = str(html.xpath('//*[@id="introduction"]/dd/p[1]/text()')).strip(" ['']")
|
result = str(html.xpath('//*[@id="introduction"]/dd/p[1]/text()')).strip(" ['']")
|
||||||
return result
|
return result
|
||||||
def main(number):
|
def main(number):
|
||||||
|
number = number.upper()
|
||||||
try:
|
try:
|
||||||
a = get_html('https://javdb.com/search?q=' + number + '&f=all').replace(u'\xa0', u' ')
|
a = get_html('https://javdb.com/search?q=' + number + '&f=all').replace(u'\xa0', u' ')
|
||||||
html = etree.fromstring(a, etree.HTMLParser()) # //table/tr[1]/td[1]/text()
|
html = etree.fromstring(a, etree.HTMLParser()) # //table/tr[1]/td[1]/text()
|
||||||
result1 = str(html.xpath('//*[@id="videos"]/div/div/a/@href')).strip(" ['']")
|
result1 = html.xpath('//*[@id="videos"]/div/div/a/@href')[0]
|
||||||
b = get_html('https://javdb.com' + result1).replace(u'\xa0', u' ')
|
b = get_html('https://javdb.com' + result1).replace(u'\xa0', u' ')
|
||||||
dic = {
|
dic = {
|
||||||
'actor': getActor(a),
|
'actor': getActor(b),
|
||||||
'title': getTitle(b).replace("\\n", '').replace(' ', '').replace(getActor(a), '').replace(getNum(a),
|
'title': getTitle(b).replace("\\n", '').replace(' ', '').replace(getActor(a), '').replace(getNum(a),
|
||||||
'').replace(
|
'').replace(
|
||||||
'无码', '').replace('有码', '').lstrip(' '),
|
'无码', '').replace('有码', '').lstrip(' ').replace(number,''),
|
||||||
'studio': getStudio(b),
|
'studio': getStudio(b),
|
||||||
'outline': getOutline(b),
|
'outline': getOutline(b),
|
||||||
'runtime': getRuntime(b),
|
'runtime': getRuntime(b),
|
||||||
@@ -85,27 +100,32 @@ def main(number):
|
|||||||
'release': getRelease(b),
|
'release': getRelease(b),
|
||||||
'number': getNum(b),
|
'number': getNum(b),
|
||||||
'cover': getCover(b),
|
'cover': getCover(b),
|
||||||
'imagecut': 0,
|
'cover_small': getCover_small(a),
|
||||||
|
'imagecut': 3,
|
||||||
'tag': getTag(b),
|
'tag': getTag(b),
|
||||||
'label': getLabel(b),
|
'label': getLabel(b),
|
||||||
'year': getYear(getRelease(b)), # str(re.search('\d{4}',getRelease(a)).group()),
|
'year': getYear(getRelease(b)), # str(re.search('\d{4}',getRelease(a)).group()),
|
||||||
'actor_photo': '',
|
'actor_photo': getActorPhoto(getActor(b)),
|
||||||
'website': 'https://javdb.com' + result1,
|
'website': 'https://javdb.com' + result1,
|
||||||
'source': 'javdb.py',
|
'source': 'javdb.py',
|
||||||
}
|
}
|
||||||
|
if getNum(b) != number: # 与搜索到的番号不匹配
|
||||||
|
dic['title'] = ''
|
||||||
|
dic['number'] = ''
|
||||||
js = json.dumps(dic, ensure_ascii=False, sort_keys=True, indent=4, separators=(',', ':'), ) # .encode('UTF-8')
|
js = json.dumps(dic, ensure_ascii=False, sort_keys=True, indent=4, separators=(',', ':'), ) # .encode('UTF-8')
|
||||||
return js
|
return js
|
||||||
except:
|
except:
|
||||||
a = get_html('https://javdb.com/search?q=' + number + '&f=all').replace(u'\xa0', u' ')
|
a = get_html('https://javdb.com/search?q=' + number + '&f=all').replace(u'\xa0', u' ')
|
||||||
html = etree.fromstring(a, etree.HTMLParser()) # //table/tr[1]/td[1]/text()
|
html = etree.fromstring(a, etree.HTMLParser()) # //table/tr[1]/td[1]/text()
|
||||||
result1 = str(html.xpath('//*[@id="videos"]/div/div/a/@href')).strip(" ['']")
|
result1 = html.xpath('//*[@id="videos"]/div/div/a/@href')[0]
|
||||||
|
print(html.xpath('//*[@id="videos"]/div/div/a/@href'))
|
||||||
b = get_html('https://javdb.com' + result1).replace(u'\xa0', u' ')
|
b = get_html('https://javdb.com' + result1).replace(u'\xa0', u' ')
|
||||||
dic = {
|
dic = {
|
||||||
'actor': getActor(b),
|
'actor': getActor(b),
|
||||||
'title': getTitle(b).replace("\\n", '').replace(' ', '').replace(getActor(a), '').replace(
|
'title': getTitle(b).replace("\\n", '').replace(' ', '').replace(getActor(a), '').replace(
|
||||||
getNum(b),
|
getNum(b),
|
||||||
'').replace(
|
'').replace(
|
||||||
'无码', '').replace('有码', '').lstrip(' '),
|
'无码', '').replace('有码', '').lstrip(' ').replace(number,''),
|
||||||
'studio': getStudio(b),
|
'studio': getStudio(b),
|
||||||
'outline': getOutline(b),
|
'outline': getOutline(b),
|
||||||
'runtime': getRuntime(b),
|
'runtime': getRuntime(b),
|
||||||
@@ -113,15 +133,21 @@ def main(number):
|
|||||||
'release': getRelease(b),
|
'release': getRelease(b),
|
||||||
'number': getNum(b),
|
'number': getNum(b),
|
||||||
'cover': getCover(b),
|
'cover': getCover(b),
|
||||||
'imagecut': 0,
|
'cover_small': getCover_small(a),
|
||||||
|
'imagecut': 3,
|
||||||
'tag': getTag(b),
|
'tag': getTag(b),
|
||||||
'label': getLabel(b),
|
'label': getLabel(b),
|
||||||
'year': getYear(getRelease(b)), # str(re.search('\d{4}',getRelease(a)).group()),
|
'year': getYear(getRelease(b)), # str(re.search('\d{4}',getRelease(a)).group()),
|
||||||
'actor_photo': '',
|
'actor_photo': getActorPhoto(getActor(b)),
|
||||||
'website': 'https://javdb.com' + result1,
|
'website': 'https://javdb3.com' + result1,
|
||||||
'source': 'javdb.py',
|
'source': 'javdb.py',
|
||||||
}
|
}
|
||||||
|
if getNum(b) != number: # 与搜索到的番号不匹配
|
||||||
|
dic['title'] = ''
|
||||||
|
dic['number'] = ''
|
||||||
js = json.dumps(dic, ensure_ascii=False, sort_keys=True, indent=4, separators=(',', ':'), ) # .encode('UTF-8')
|
js = json.dumps(dic, ensure_ascii=False, sort_keys=True, indent=4, separators=(',', ':'), ) # .encode('UTF-8')
|
||||||
return js
|
return js
|
||||||
|
|
||||||
#print(get_html('https://javdb1.com/v/WwZ0Q'))
|
# main('DV-1562')
|
||||||
|
# input("[+][+]Press enter key exit, you can check the error messge before you exit.\n[+][+]按回车键结束,你可以在结束之前查看和错误信息。")
|
||||||
|
# print(main('YMDD-178'))
|
||||||
|
|||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"version": "2.0",
|
"version": "2.2",
|
||||||
"version_show":"2.0",
|
"version_show":"2.2",
|
||||||
"download": "https://github.com/yoshiko2/AV_Data_Capture/releases"
|
"download": "https://github.com/yoshiko2/AV_Data_Capture/releases"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user