Skip to content

Commit

Permalink
Add metadata to hentainexus: circle, event, title_conventional. (#661)
Browse files Browse the repository at this point in the history
  • Loading branch information
mo-han authored Mar 31, 2020
1 parent 3ed72f8 commit 6f81cac
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions gallery_dl/extractor/hentainexus.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,39 @@ def metadata(self, page):
"title" : extr('<h1 class="title">', '</h1>'),
"artist" : rmve(extr('viewcolumn">Artist</td>' , '</td>')),
"book" : rmve(extr('viewcolumn">Book</td>' , '</td>')),
"circle" : rmve(extr('viewcolumn">Circle</td>' , '</td>')),
"event" : rmve(extr('viewcolumn">Event</td>' , '</td>')),
"language" : rmve(extr('viewcolumn">Language</td>' , '</td>')),
"magazine" : rmve(extr('viewcolumn">Magazine</td>' , '</td>')),
"parody" : rmve(extr('viewcolumn">Parody</td>' , '</td>')),
"publisher" : rmve(extr('viewcolumn">Publisher</td>' , '</td>')),
"description": rmve(extr('viewcolumn">Description</td>', '</td>')),
}
data["lang"] = util.language_to_code(data["language"])
data["type"] = "Doujinshi" if 'doujin' in data["tags"] else "Manga"
data["title_conventional"] = self.join_title(
data["event"], data["circle"], data["artist"], data["title"], data["parody"], data["book"], data["magazine"]
)
return data

@staticmethod
def join_title(event, circle, artist, title, parody, book, magazine):
jt = ''
if event:
jt += '({}) '.format(event)
if circle:
jt += '[{} ({})] '.format(circle, artist)
else:
jt += '[{}] '.format(artist)
jt += title
if parody.lower() != 'original work':
jt += ' ({})'.format(parody)
if book:
jt += ' ({})'.format(book)
if magazine:
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)
Expand Down

0 comments on commit 6f81cac

Please sign in to comment.