fixed the title without authorization, the cover from the mirror (#6948)

This commit is contained in:
Eugene 2021-05-10 16:47:26 +05:00 committed by GitHub
parent 5da79f54a0
commit 25b1fd6997
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'MangaLib' extName = 'MangaLib'
pkgNameSuffix = 'ru.libmanga' pkgNameSuffix = 'ru.libmanga'
extClass = '.LibManga' extClass = '.LibManga'
extVersionCode = 43 extVersionCode = 44
libVersion = '1.2' libVersion = '1.2'
} }

View File

@ -56,6 +56,7 @@ class LibManga : ConfigurableSource, HttpSource() {
// The mirror is used because the main site "mangalib.me" in application returns error 403 // The mirror is used because the main site "mangalib.me" in application returns error 403
override val baseUrl: String = "https://mangalib.org" override val baseUrl: String = "https://mangalib.org"
private val baseOrigUrl: String = "https://mangalib.me"
override fun headersBuilder() = Headers.Builder().apply { override fun headersBuilder() = Headers.Builder().apply {
add("User-Agent", "Mozilla/5.0 (Windows NT 6.3; WOW64)") add("User-Agent", "Mozilla/5.0 (Windows NT 6.3; WOW64)")
@ -86,7 +87,7 @@ class LibManga : ConfigurableSource, HttpSource() {
element.select("a").first().let { link -> element.select("a").first().let { link ->
manga.setUrlWithoutDomain(link.attr("href")) manga.setUrlWithoutDomain(link.attr("href"))
manga.title = element.select(".updates__name_rus").first().text() manga.title = if (element.select(".updates__name_rus").isNullOrEmpty()) { element.select("h4").first().text() } else element.select(".updates__name_rus").first().text()
} }
return manga return manga
} }
@ -172,7 +173,7 @@ class LibManga : ConfigurableSource, HttpSource() {
val genres = document.select(".media-tags > a").map { it.text() } val genres = document.select(".media-tags > a").map { it.text() }
manga.title = document.select(".media-name__alt").text() manga.title = document.select(".media-name__alt").text()
manga.thumbnail_url = document.select(".media-sidebar__cover > img").attr("src") manga.thumbnail_url = baseUrl + document.select(".media-sidebar__cover > img").attr("src").substringAfter(baseOrigUrl)
manga.author = body.select("div.media-info-list__title:contains(Автор) + div").text() manga.author = body.select("div.media-info-list__title:contains(Автор) + div").text()
manga.artist = body.select("div.media-info-list__title:contains(Художник) + div").text() manga.artist = body.select("div.media-info-list__title:contains(Художник) + div").text()
manga.status = when ( manga.status = when (