Update fanza.py

This commit is contained in:
Wayne.S.Lui
2022-08-30 22:56:54 +08:00
parent 75aedf8601
commit f848a4ec24

View File

@@ -139,35 +139,24 @@ class Fanza(Parser):
return result return result
def getExtrafanart(self, htmltree): def getExtrafanart(self, htmltree):
html_parent = re.compile(r'<div id=\"sample-image-block\"[\s\S]*?<br></div>\s*?</div>') htmltext = re.search(r'<div id=\"sample-image-block\"[\s\S]*?<br></div>\s*?</div>', self.htmlcode).group()
html = html_parent.search( if htmltext:
self.htmlcode) extrafanart_images = re.findall(r'<img.*?src=\"(.*?)\"', htmltext)
if html:
html = html.group()
extrafanart_parent = re.compile(r'<img.*?src=\"(.*?)\"')
extrafanart_images = extrafanart_parent.findall(html)
if extrafanart_images: if extrafanart_images:
sheet = [] sheet = []
for img_url in extrafanart_images: for img_url in extrafanart_images:
img_urls = img_url.rsplit('-', 1) url_cuts = img_url.rsplit('-', 1)
img_url = img_urls[0] + 'jp-' + img_urls[1] sheet.append(url_cuts[0] + 'jp-' + url_cuts[1])
sheet.append(img_url)
return sheet return sheet
return '' return ''
def getTrailer(self, htmltree): def getTrailer(self, htmltree):
html_parent = re.compile(r'<script type=\"application/ld\+json\">[\s\S].*}\s*?</script>') htmltext = re.search(r'<script type=\"application/ld\+json\">[\s\S].*}\s*?</script>', self.htmlcode).group()
html = html_parent.search( if htmltext:
self.htmlcode) url = re.search(r'\"contentUrl\":\"(.*?)\"', htmltext).group(1)
if html: if url:
html = html.group() url = url.rsplit('_', 2)[0] + '_mhb_w.mp4'
trailer_parent = re.compile(r'\"contentUrl\":\"(.*?)\"') return url
trailer_url = trailer_parent.search(html)
if trailer_url:
trailer_url = trailer_url.group(1)
trailer_cuts = trailer_url.rsplit('_', 2)
trailer_url = trailer_cuts[0] + '_mhb_w.mp4'
return trailer_url
return '' return ''
def getFanzaString(self, expr): def getFanzaString(self, expr):