Update fc2.py

This commit is contained in:
Feng4
2020-12-26 23:45:11 +08:00
committed by GitHub
parent 0b729c3d5e
commit b35c87919d

View File

@@ -60,6 +60,29 @@ def getYear_fc2com(release):
except: except:
return '' return ''
def getExtrafanart(htmlcode): # 获取剧照
html_pather = re.compile(r'<ul class=\"items_article_SampleImagesArea\"[\s\S]*?</ul>')
html = html_pather.search(htmlcode)
if html:
html = html.group()
extrafanart_pather = re.compile(r'<a href=\"(.*?)\"')
extrafanart_imgs = extrafanart_pather.findall(html)
if extrafanart_imgs:
return extrafanart_imgs
return ''
def getTrailer(htmlcode):
video_pather = re.compile(r'\'[a-zA-Z0-9]{32}\'')
video = video_pather.findall(htmlcode)
if video:
video_url = video[0].replace('\'', '')
video_url = 'https://adult.contents.fc2.com/api/v2/videos/1603395/sample?key=' + video_url
url_json = eval(ADC_function.get_html(video_url))['path'].replace('\\', '')
else:
video_url = ''
return url_json
def main(number): def main(number):
try: try:
number = number.replace('FC2-', '').replace('fc2-', '') number = number.replace('FC2-', '').replace('fc2-', '')
@@ -70,7 +93,7 @@ def main(number):
dic = { dic = {
'title': getTitle_fc2com(htmlcode2), 'title': getTitle_fc2com(htmlcode2),
'studio': getStudio_fc2com(htmlcode2), 'studio': getStudio_fc2com(htmlcode2),
'year': str(re.search('\d{4}', getRelease_fc2com(htmlcode2)).group()), 'year': getYear_fc2com(getRelease_fc2com(htmlcode2)),
'outline': '', # getOutline_fc2com(htmlcode2), 'outline': '', # getOutline_fc2com(htmlcode2),
'runtime': '', 'runtime': '',
'director': getStudio_fc2com(htmlcode2), 'director': getStudio_fc2com(htmlcode2),
@@ -79,6 +102,8 @@ def main(number):
'number': 'FC2-' + number, 'number': 'FC2-' + number,
'label': '', 'label': '',
'cover': getCover_fc2com(htmlcode2), 'cover': getCover_fc2com(htmlcode2),
'extrafanart': getExtrafanart(htmlcode2),
"trailer": getTrailer(htmlcode2),
'imagecut': 0, 'imagecut': 0,
'tag': getTag_fc2com(number), 'tag': getTag_fc2com(number),
'actor_photo': '', 'actor_photo': '',
@@ -87,10 +112,11 @@ def main(number):
'series': '', 'series': '',
} }
except Exception as e: except Exception as e:
# print(e) print(e)
dic = {"title": ""} dic = {"title": ""}
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
if __name__ == '__main__': if __name__ == '__main__':
print(main('1228742')) print(main('FC2-1603395'))