forked from mvdctop/Movie_Data_Capture
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
388 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import requests | ||
|
||
def get_html(url):#网页请求核心 | ||
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36'} | ||
getweb = requests.get(str(url),timeout=5,headers=headers) | ||
getweb.encoding='utf-8' | ||
try: | ||
return getweb.text | ||
except: | ||
print("[-]Connect Failed! Please check your Proxy.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import re | ||
from lxml import etree#need install | ||
import json | ||
import ADC_function | ||
|
||
def getTitle(htmlcode): #获取厂商 | ||
#print(htmlcode) | ||
html = etree.fromstring(htmlcode,etree.HTMLParser()) | ||
result = str(html.xpath('/html/body/div[2]/div/div[1]/h3/text()')).strip(" ['']") | ||
return result | ||
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(" ['']") | ||
return result | ||
def getNum(htmlcode): #获取番号 | ||
html = etree.fromstring(htmlcode, etree.HTMLParser()) | ||
result = str(html.xpath('/html/body/div[5]/div[1]/div[2]/p[1]/span[2]/text()')).strip(" ['']") | ||
return result | ||
def getRelease(number): | ||
a=ADC_function.get_html('http://adult.contents.fc2.com/article_search.php?id='+str(number).lstrip("FC2-").lstrip("fc2-").lstrip("fc2_").lstrip("fc2-")+'&utm_source=aff_php&utm_medium=source_code&utm_campaign=from_aff_php') | ||
html=etree.fromstring(a,etree.HTMLParser()) | ||
result = str(html.xpath('//*[@id="container"]/div[1]/div/article/section[1]/div/div[2]/dl/dd[4]/text()')).strip(" ['']") | ||
return result | ||
def getCover(htmlcode,number): #获取厂商 | ||
a = ADC_function.get_html('http://adult.contents.fc2.com/article_search.php?id=' + str(number).lstrip("FC2-").lstrip("fc2-").lstrip("fc2_").lstrip("fc2-") + '&utm_source=aff_php&utm_medium=source_code&utm_campaign=from_aff_php') | ||
html = etree.fromstring(a, etree.HTMLParser()) | ||
result = str(html.xpath('//*[@id="container"]/div[1]/div/article/section[1]/div/div[1]/a/img/@src')).strip(" ['']") | ||
return 'http:'+result | ||
def getOutline(htmlcode,number): #获取番号 | ||
a = ADC_function.get_html('http://adult.contents.fc2.com/article_search.php?id=' + str(number).lstrip("FC2-").lstrip("fc2-").lstrip("fc2_").lstrip("fc2-") + '&utm_source=aff_php&utm_medium=source_code&utm_campaign=from_aff_php') | ||
html = etree.fromstring(a, etree.HTMLParser()) | ||
result = str(html.xpath('//*[@id="container"]/div[1]/div/article/section[4]/p/text()')).replace("\\n",'',10000).strip(" ['']").replace("'",'',10000) | ||
return result | ||
|
||
def main(number): | ||
str(number).lstrip("FC2-").lstrip("fc2-").lstrip("fc2_").lstrip("fc2-") | ||
htmlcode = ADC_function.get_html('http://fc2fans.club/html/FC2-' + number + '.html') | ||
dic = { | ||
'title': getTitle(htmlcode), | ||
'studio': getStudio(htmlcode), | ||
'year': getRelease(number), | ||
'outline': getOutline(htmlcode,number), | ||
'runtime': '', | ||
'director': getStudio(htmlcode), | ||
'actor': '', | ||
'release': getRelease(number), | ||
'number': number, | ||
'cover': getCover(htmlcode,number), | ||
'imagecut': 0, | ||
} | ||
js = json.dumps(dic, ensure_ascii=False, sort_keys=True, indent=4, separators=(',', ':'),)#.encode('UTF-8') | ||
return js |
Oops, something went wrong.