1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-22 18:53:21 +01:00

[hentainexus] fix flake8 issues (#787)

This commit is contained in:
Mike Fährmann 2020-05-28 22:45:08 +02:00
parent a63682a9c0
commit 2bff8dd465
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

View File

@ -57,23 +57,32 @@ class HentainexusGalleryExtractor(GalleryExtractor):
data['type'] = 'Illustration'
else:
data['type'] = 'Manga'
data["title_conventional"] = self.join_title(data)
data["title_conventional"] = self._join_title(data)
return data
def images(self, page):
url = "{}/read/{}".format(self.root, self.gallery_id)
extr = text.extract_from(self.request(url).text)
urls = extr("initReader(", "]") + "]"
return [(url, None) for url in json.loads(urls)]
@staticmethod
def join_title(data):
event = data['event']
circle = data['circle']
artist = data['artist']
title = data['title']
parody = data['parody']
book = data['book']
def _join_title(data):
event = data['event']
artist = data['artist']
circle = data['circle']
title = data['title']
parody = data['parody']
book = data['book']
magazine = data['magazine']
# a very few galleries have large number of artists or parodies, replaced with "Various" in the title string
if len(artist.split(',')) > 3:
# a few galleries have a large number of artists or parodies,
# which get replaced with "Various" in the title string
if artist.count(',') >= 3:
artist = 'Various'
if len(parody.split(',')) > 3:
if parody.count(',') >= 3:
parody = 'Various'
jt = ''
if event:
jt += '({}) '.format(event)
@ -90,12 +99,6 @@ class HentainexusGalleryExtractor(GalleryExtractor):
jt += ' ({})'.format(magazine)
return jt
def images(self, page):
url = "{}/read/{}".format(self.root, self.gallery_id)
extr = text.extract_from(self.request(url).text)
urls = extr("initReader(", "]") + "]"
return [(url, None) for url in json.loads(urls)]
class HentainexusSearchExtractor(Extractor):
"""Extractor for search results on hentainexus.com"""