From dd2fb8a9a6d395ca9e457bba48da409d19d13dd7 Mon Sep 17 00:00:00 2001 From: Mike <51273546+SnakeDoc83@users.noreply.github.com> Date: Mon, 8 Jul 2019 07:51:59 -0400 Subject: [PATCH] Check if Mangahere manga is licensed (#1275) --- src/en/mangahere/build.gradle | 4 +++- .../eu/kanade/tachiyomi/extension/en/mangahere/Mangahere.kt | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/en/mangahere/build.gradle b/src/en/mangahere/build.gradle index 61240ef78..4e694a982 100644 --- a/src/en/mangahere/build.gradle +++ b/src/en/mangahere/build.gradle @@ -5,12 +5,14 @@ ext { appName = 'Tachiyomi: Mangahere' pkgNameSuffix = 'en.mangahere' extClass = '.Mangahere' - extVersionCode = 9 + extVersionCode = 10 libVersion = '1.2' } dependencies { compileOnly project(':duktape-stub') + sourceCompatibility = "1.6" + targetCompatibility = "1.6" } apply from: "$rootDir/common.gradle" diff --git a/src/en/mangahere/src/eu/kanade/tachiyomi/extension/en/mangahere/Mangahere.kt b/src/en/mangahere/src/eu/kanade/tachiyomi/extension/en/mangahere/Mangahere.kt index 4ef544c80..effbcc461 100644 --- a/src/en/mangahere/src/eu/kanade/tachiyomi/extension/en/mangahere/Mangahere.kt +++ b/src/en/mangahere/src/eu/kanade/tachiyomi/extension/en/mangahere/Mangahere.kt @@ -4,6 +4,7 @@ import com.squareup.duktape.Duktape import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.source.model.* import eu.kanade.tachiyomi.source.online.ParsedHttpSource +import eu.kanade.tachiyomi.util.asJsoup import okhttp3.* import org.jsoup.nodes.Document import org.jsoup.nodes.Element @@ -147,6 +148,11 @@ class Mangahere : ParsedHttpSource() { } } + // Get a chapter, check if the manga is licensed. + val aChapterURL = chapterFromElement(document.select(chapterListSelector()).first()).url + val aChapterDocument = client.newCall(GET("$baseUrl$aChapterURL", headers)).execute().asJsoup() + if (aChapterDocument.select("p.detail-block-content").hasText()) manga.status = SManga.LICENSED + return manga }