Fix search fuction for javdb source
This commit is contained in:
@@ -221,6 +221,7 @@ def main(number):
|
|||||||
elif cdays != 9999:
|
elif cdays != 9999:
|
||||||
print('[!]Cookies file ' + cookie_json + ' was updated ' + str(cdays) +
|
print('[!]Cookies file ' + cookie_json + ' was updated ' + str(cdays) +
|
||||||
' days ago, it will not be used for HTTP requests.')
|
' days ago, it will not be used for HTTP requests.')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
javdb_url = 'https://' + javdb_site + '.com/search?q=' + number + '&f=all'
|
javdb_url = 'https://' + javdb_site + '.com/search?q=' + number + '&f=all'
|
||||||
query_result = get_html(javdb_url, cookies=javdb_cookies)
|
query_result = get_html(javdb_url, cookies=javdb_cookies)
|
||||||
@@ -236,7 +237,11 @@ def main(number):
|
|||||||
correct_url = urls[0]
|
correct_url = urls[0]
|
||||||
else:
|
else:
|
||||||
ids =html.xpath('//*[@id="videos"]/div/div/a/div[contains(@class, "uid")]/text()')
|
ids =html.xpath('//*[@id="videos"]/div/div/a/div[contains(@class, "uid")]/text()')
|
||||||
correct_url = urls[ids.index(number)]
|
try:
|
||||||
|
correct_url = urls[ids.index(number)]
|
||||||
|
except:
|
||||||
|
# if input number is "STAR438" not "STAR-438", use first search result.
|
||||||
|
correct_url = urls[0]
|
||||||
try:
|
try:
|
||||||
javdb_detail_url = 'https://' + javdb_site + '.com' + correct_url
|
javdb_detail_url = 'https://' + javdb_site + '.com' + correct_url
|
||||||
detail_page = get_html(javdb_detail_url, cookies=javdb_cookies)
|
detail_page = get_html(javdb_detail_url, cookies=javdb_cookies)
|
||||||
@@ -249,7 +254,11 @@ def main(number):
|
|||||||
if re.search(r'[a-zA-Z]+\.\d{2}\.\d{2}\.\d{2}', number):
|
if re.search(r'[a-zA-Z]+\.\d{2}\.\d{2}\.\d{2}', number):
|
||||||
cover_small = getCover_small(query_result)
|
cover_small = getCover_small(query_result)
|
||||||
else:
|
else:
|
||||||
cover_small = getCover_small(query_result, index=ids.index(number))
|
try:
|
||||||
|
cover_small = getCover_small(query_result, index=ids.index(number))
|
||||||
|
except:
|
||||||
|
# if input number is "STAR438" not "STAR-438", use first search result.
|
||||||
|
cover_small = getCover_small(query_result)
|
||||||
if 'placeholder' in cover_small:
|
if 'placeholder' in cover_small:
|
||||||
# replace wit normal cover and cut it
|
# replace wit normal cover and cut it
|
||||||
imagecut = 1
|
imagecut = 1
|
||||||
@@ -297,4 +306,4 @@ if __name__ == "__main__":
|
|||||||
# print(main('AGAV-042'))
|
# print(main('AGAV-042'))
|
||||||
print(main('BANK-022'))
|
print(main('BANK-022'))
|
||||||
print(main('FC2-735670'))
|
print(main('FC2-735670'))
|
||||||
print(main('MVSD-439'))
|
print(main('MVSD-439'))
|
||||||
Reference in New Issue
Block a user