FoolSlide: Update Hentai Cafe (#1522)

* Fix genres and artist parsing
* Set status as completed
* Set chapters number to 1
* Fix latest update load if there is no thumbnail

Signed-off-by: Rama Bondan Prakoso <ramanarubp@gmail.com>
This commit is contained in:
Rama Bondan Prakoso 2019-09-18 05:26:41 +07:00 committed by arkon
parent dd267e98eb
commit cd9f027909
2 changed files with 19 additions and 11 deletions

View File

@ -5,7 +5,7 @@ ext {
appName = 'Tachiyomi: FoolSlide' appName = 'Tachiyomi: FoolSlide'
pkgNameSuffix = 'all.foolslide' pkgNameSuffix = 'all.foolslide'
extClass = '.FoolSlideFactory' extClass = '.FoolSlideFactory'
extVersionCode = 24 extVersionCode = 25
libVersion = '1.2' libVersion = '1.2'
} }

View File

@ -20,8 +20,12 @@ class HentaiCafe : FoolSlide("Hentai Cafe", "https://hentai.cafe", "en", "/manga
override fun latestUpdatesFromElement(element: Element) = SManga.create().apply { override fun latestUpdatesFromElement(element: Element) = SManga.create().apply {
val urlElement = element.select(".entry-thumb").first() val urlElement = element.select(".entry-thumb").first()
setUrlWithoutDomain(urlElement.attr("href")) if (urlElement != null) {
thumbnail_url = urlElement.child(0).attr("src") setUrlWithoutDomain(urlElement.attr("href"))
thumbnail_url = urlElement.child(0).attr("src")
} else {
setUrlWithoutDomain(element.select(".entry-title a").attr("href"))
}
title = element.select(".entry-title").text().trim() title = element.select(".entry-title").text().trim()
} }
@ -35,13 +39,17 @@ class HentaiCafe : FoolSlide("Hentai Cafe", "https://hentai.cafe", "en", "/manga
title = document.select(".entry-title").text() title = document.select(".entry-title").text()
val contentElement = document.select(".entry-content").first() val contentElement = document.select(".entry-content").first()
thumbnail_url = contentElement.child(0).child(0).attr("src") thumbnail_url = contentElement.child(0).child(0).attr("src")
val genres = mutableListOf<String>()
fun filterableTagsOfType(type: String) = contentElement.select("a") document.select(".content a[rel=tag]").forEach { element ->
.filter { "$baseUrl/$type/" in it.attr("href") } if (!element.attr("href").contains("artist"))
.joinToString { it.text() } genres.add(element.text())
else {
genre = filterableTagsOfType("tag") artist = element.text()
artist = filterableTagsOfType("artist") author = element.text()
}
}
status = SManga.COMPLETED
genre = genres.joinToString(", ")
} }
// Note that the reader URL cannot be deduced from the manga URL all the time which is why // Note that the reader URL cannot be deduced from the manga URL all the time which is why
@ -51,7 +59,7 @@ class HentaiCafe : FoolSlide("Hentai Cafe", "https://hentai.cafe", "en", "/manga
SChapter.create().apply { SChapter.create().apply {
setUrlWithoutDomain(response.asJsoup().select("[title=Read]").attr("href")) setUrlWithoutDomain(response.asJsoup().select("[title=Read]").attr("href"))
name = "Chapter" name = "Chapter"
chapter_number = 0.0f chapter_number = 1f
} }
) )