Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add metadata to hentainexus: circle, event, title_conventional. #661

Merged
merged 1 commit into from
Mar 31, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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