From 3b84877a53273c75237394a44b44474bc58054cf Mon Sep 17 00:00:00 2001 From: Yoshiko <42309414+yoshiko2@users.noreply.github.com> Date: Sun, 15 Dec 2019 20:30:20 +0800 Subject: [PATCH] Update 1.8 --- ADC_function.py | 14 ++++---------- fc2fans_club.py | 6 +++--- javbus.py | 3 ++- siro.py | 15 ++++++++------- 4 files changed, 17 insertions(+), 21 deletions(-) diff --git a/ADC_function.py b/ADC_function.py index a7dc831..d807061 100755 --- a/ADC_function.py +++ b/ADC_function.py @@ -8,6 +8,9 @@ import re import time import sys from lxml import etree +import sys +import io +sys.stdout = io.TextIOWrapper(sys.stdout.buffer, errors = 'replace', line_buffering = True) config_file='config.ini' config = ConfigParser() @@ -103,16 +106,7 @@ def get_html(url,cookies = None):#网页请求核心 getweb = requests.get(str(url), headers=headers, timeout=timeout, cookies=cookies) getweb.encoding = 'utf-8' return getweb.text - except requests.exceptions.RequestException: - i += 1 - print('[-]Connect retry '+str(i)+'/'+str(retry_count)) - except requests.exceptions.ConnectionError: - i += 1 - print('[-]Connect retry '+str(i)+'/'+str(retry_count)) - except requests.exceptions.ProxyError: - i += 1 - print('[-]Connect retry '+str(i)+'/'+str(retry_count)) - except requests.exceptions.ConnectTimeout: + except: i += 1 print('[-]Connect retry '+str(i)+'/'+str(retry_count)) print('[-]Connect Failed! Please check your Proxy or Network!') diff --git a/fc2fans_club.py b/fc2fans_club.py index 689b51a..86451e1 100755 --- a/fc2fans_club.py +++ b/fc2fans_club.py @@ -51,6 +51,8 @@ def getYear(release): def main(number): number=number.replace('PPV','').replace('ppv','').strip('fc2_').strip('fc2-').strip('ppv-').strip('PPV-').strip('FC2_').strip('FC2-').strip('ppv-').strip('PPV-').replace('fc2ppv-','').replace('FC2PPV-','') htmlcode2 = ADC_function.get_html('http://adult.contents.fc2.com/article_search.php?id='+str(number).lstrip("FC2-").lstrip("fc2-").lstrip("fc2_").lstrip("fc2-")+'') + print('http://adult.contents.fc2.com/article_search.php?id='+str(number).lstrip("FC2-").lstrip("fc2-").lstrip("fc2_").lstrip("fc2-")+'') + print(htmlcode2) #htmlcode = ADC_function.get_html('http://fc2fans.club/html/FC2-' + number + '.html') dic = { 'title': getTitle(htmlcode2), @@ -70,6 +72,4 @@ def main(number): 'source': 'fc2fans_club.py', } js = json.dumps(dic, ensure_ascii=False, sort_keys=True, indent=4, separators=(',', ':'),)#.encode('UTF-8') - return js - -#print(main('1145465')) \ No newline at end of file + return js \ No newline at end of file diff --git a/javbus.py b/javbus.py index 457d380..aa18d2a 100755 --- a/javbus.py +++ b/javbus.py @@ -134,4 +134,5 @@ def main_uncensored(number): 'source': 'javbus.py', } js = json.dumps(dic, ensure_ascii=False, sort_keys=True, indent=4, separators=(',', ':'), ) # .encode('UTF-8') - return js \ No newline at end of file + return js + diff --git a/siro.py b/siro.py index 9b9d69a..a1e93bc 100755 --- a/siro.py +++ b/siro.py @@ -7,7 +7,7 @@ from ADC_function import * def getTitle(a): try: html = etree.fromstring(a, etree.HTMLParser()) - result = str(html.xpath('//*[@id="center_column"]/div[2]/h1/text()')).strip(" ['']") + result = str(html.xpath('//*[@id="center_column"]/div[1]/h1/text()')).strip(" ['']") return result.replace('/', ',') except: return '' @@ -62,7 +62,8 @@ def getTag(a): return str(result1 + result2).strip('+').replace("', '\\n",",").replace("', '","").replace('"','') def getCover(htmlcode): html = etree.fromstring(htmlcode, etree.HTMLParser()) - result = str(html.xpath('//*[@id="center_column"]/div[2]/div[1]/div/div/h2/img/@src')).strip(" ['']") + result = str(html.xpath('//*[@id="center_column"]/div[1]/div[1]/div/div/h2/img/@src')).strip(" ['']") + # /html/body/div[2]/article[2]/div[1]/div[1]/div/div/h2/img/@src return result def getDirector(a): html = etree.fromstring(a, etree.HTMLParser()) # //table/tr[1]/td[1]/text() @@ -77,7 +78,7 @@ def getOutline(htmlcode): return result def main(number2): number=number2.upper() - htmlcode=get_html('https://www.mgstage.com/product/product_detail/'+str(number)+'/',cookies={'adc':'1'}) + htmlcode=str(get_html('https://www.mgstage.com/product/product_detail/'+str(number)+'/',cookies={'adc':'1'})) soup = BeautifulSoup(htmlcode, 'lxml') a = str(soup.find(attrs={'class': 'detail_data'})).replace('\n ','').replace(' ','').replace('\n ','').replace('\n ','') dic = { @@ -98,7 +99,7 @@ def main(number2): 'website':'https://www.mgstage.com/product/product_detail/'+str(number)+'/', 'source': 'siro.py', } - js = json.dumps(dic, ensure_ascii=False, sort_keys=True, indent=4, separators=(',', ':'),)#.encode('UTF-8') - return js - -#print(main('300maan-373')) \ No newline at end of file + js = json.dumps(dic, ensure_ascii=False, sort_keys=True, indent=4, separators=(',', ':'), ) # .encode('UTF-8') + print(js) + #print(htmlcode) + return js \ No newline at end of file