1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-23 03:02:50 +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' data['type'] = 'Illustration'
else: else:
data['type'] = 'Manga' data['type'] = 'Manga'
data["title_conventional"] = self.join_title(data) data["title_conventional"] = self._join_title(data)
return 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 @staticmethod
def join_title(data): def _join_title(data):
event = data['event'] event = data['event']
circle = data['circle'] artist = data['artist']
artist = data['artist'] circle = data['circle']
title = data['title'] title = data['title']
parody = data['parody'] parody = data['parody']
book = data['book'] book = data['book']
magazine = data['magazine'] 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' artist = 'Various'
if len(parody.split(',')) > 3: if parody.count(',') >= 3:
parody = 'Various' parody = 'Various'
jt = '' jt = ''
if event: if event:
jt += '({}) '.format(event) jt += '({}) '.format(event)
@ -90,12 +99,6 @@ class HentainexusGalleryExtractor(GalleryExtractor):
jt += ' ({})'.format(magazine) jt += ' ({})'.format(magazine)
return jt 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): class HentainexusSearchExtractor(Extractor):
"""Extractor for search results on hentainexus.com""" """Extractor for search results on hentainexus.com"""