-
Notifications
You must be signed in to change notification settings - Fork 45
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 new source + Tweak #1174
Add new source + Tweak #1174
Conversation
val doc = webClient.httpGet(fullUrl).parseHtml() | ||
|
||
val script = doc.selectFirst("script:containsData(const CHAPTER_ID)")?.data() | ||
?: throw Exception("Failed to get chapter id") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not use generic Exception
class
val script = doc.selectFirst("script:containsData(const CHAPTER_ID)")?.data() | ||
?: throw Exception("Failed to get chapter id") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
val script = doc.selectFirst("script:containsData(const CHAPTER_ID)")?.data() | |
?: throw Exception("Failed to get chapter id") | |
val script = doc.selectFirstOrThrow("script:containsData(const CHAPTER_ID)")?.data() |
val responseJson = webClient.httpGet(ajaxUrl).parseJson() | ||
|
||
if (!responseJson.optBoolean("status", false)) { | ||
throw Exception(responseJson.optString("msg")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
throw Exception(responseJson.optString("msg")) | |
throw IllegalStateException(responseJson.optString("msg")) |
return manga.copy( | ||
altTitle = doc.selectFirst("h2.other-name")?.text(), | ||
author = doc.selectFirst("div.summary-heading:contains(Tác giả) + div.summary-content")?.text(), | ||
tags = doc.select("div.genres-content a[rel=tag]").mapNotNullToSet { a -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tags = doc.select("div.genres-content a[rel=tag]").mapNotNullToSet { a -> | |
tags = doc.select("div.genres-content a[rel=tag]").mapToSet { a -> |
tags = doc.select("div.genres-content a[rel=tag]").mapNotNullToSet { a -> | ||
MangaTag( | ||
key = a.attr("href").substringAfterLast("/"), | ||
title = a.text(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
title = a.text(), | |
title = a.text().toTitleCase(sourceLocale), |
author = doc.selectFirst("div.summary-heading:contains(Tác giả) + div.summary-content")?.text(), | ||
tags = doc.select("div.genres-content a[rel=tag]").mapNotNullToSet { a -> | ||
MangaTag( | ||
key = a.attr("href").substringAfterLast("/"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
key = a.attr("href").substringAfterLast("/"), | |
key = a.attr("href").substringAfterLast('/'), |
return tagsCache.get() ?: run { | ||
val tags = webClient.httpGet("https://$domain/genre").parseHtml() | ||
.select("ul.page-genres li a") | ||
.mapNotNullToSet { a -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.mapNotNullToSet { a -> | |
.mapToSet { a -> |
val tags = webClient.httpGet("https://$domain/genre").parseHtml() | ||
.select("ul.page-genres li a") | ||
.mapNotNullToSet { a -> | ||
val title = a.ownText().trim() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
val title = a.ownText().trim() | |
val title = a.ownText().toTitleCase(sourceLocale) |
Add SayHentai (#1172), tweak DocTruyen5s and update sources domain