diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangamainac/MangaMainac.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangamainac/MangaMainac.kt deleted file mode 100644 index 59a48a5a7..000000000 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangamainac/MangaMainac.kt +++ /dev/null @@ -1,159 +0,0 @@ -package eu.kanade.tachiyomi.multisrc.mangamainac - -import eu.kanade.tachiyomi.network.GET -import eu.kanade.tachiyomi.source.model.FilterList -import eu.kanade.tachiyomi.source.model.Page -import eu.kanade.tachiyomi.source.model.SChapter -import eu.kanade.tachiyomi.source.model.SManga -import eu.kanade.tachiyomi.source.online.ParsedHttpSource -import eu.kanade.tachiyomi.util.asJsoup -import okhttp3.OkHttpClient -import okhttp3.Request -import okhttp3.Response -import org.jsoup.nodes.Document -import org.jsoup.nodes.Element -import java.util.Calendar - -// Based On TCBScans sources -// MangaManiac is a network of sites built by Animemaniac.co. - -abstract class MangaMainac( - override val name: String, - override val baseUrl: String, - override val lang: String, -) : ParsedHttpSource() { - override val supportsLatest = false - override val client: OkHttpClient = network.cloudflareClient - - // popular - override fun popularMangaRequest(page: Int): Request { - return GET(baseUrl) - } - - override fun popularMangaSelector() = "#page" - - override fun popularMangaFromElement(element: Element): SManga { - val manga = SManga.create() - manga.thumbnail_url = element.select(".mangainfo_body > img").attr("src") - manga.url = "" // element.select("#primary-menu .menu-item:first-child").attr("href") - manga.title = element.select(".intro_content h2").text() - return manga - } - - override fun popularMangaNextPageSelector(): String? = null - - // latest - override fun latestUpdatesRequest(page: Int): Request = throw UnsupportedOperationException() - override fun latestUpdatesSelector(): String = throw UnsupportedOperationException() - override fun latestUpdatesFromElement(element: Element): SManga = throw UnsupportedOperationException() - override fun latestUpdatesNextPageSelector(): String? = throw UnsupportedOperationException() - - // search - override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request = throw UnsupportedOperationException() - override fun searchMangaSelector(): String = throw UnsupportedOperationException() - override fun searchMangaFromElement(element: Element): SManga = throw UnsupportedOperationException() - override fun searchMangaNextPageSelector(): String? = throw UnsupportedOperationException() - - // manga details - override fun mangaDetailsParse(document: Document) = SManga.create().apply { - val info = document.select(".intro_content").text() - thumbnail_url = document.select(".mangainfo_body > img").attr("src") - title = document.select(".intro_content h2").text() - author = if ("Author" in info) substringextract(info, "Author(s):", "Released") else null - artist = author - genre = if ("Genre" in info) substringextract(info, "Genre(s):", "Status") else null - status = parseStatus(document.select(".intro_content").text()) - description = if ("Description" in info) info.substringAfter("Description:").trim() else null - } - - private fun substringextract(text: String, start: String, end: String): String = text.substringAfter(start).substringBefore(end).trim() - - private fun parseStatus(element: String): Int = when { - element.lowercase().contains("ongoing (pub") -> SManga.ONGOING - element.lowercase().contains("completed (pub") -> SManga.COMPLETED - else -> SManga.UNKNOWN - } - - // chapters - override fun chapterListSelector() = "table.chap_tab tr" - - override fun chapterFromElement(element: Element): SChapter { - val urlElement = element.select("a").first()!! - val chapter = SChapter.create() - chapter.setUrlWithoutDomain(urlElement.attr("href")) - chapter.name = element.select("a").text() - chapter.date_upload = element.select("#time i").last()?.text()?.let { parseChapterDate(it) } - ?: 0 - return chapter - } - - private fun parseChapterDate(date: String): Long { - val dateWords: List = date.split(" ") - if (dateWords.size == 3) { - val timeAgo = Integer.parseInt(dateWords[0]) - val dates: Calendar = Calendar.getInstance() - when { - dateWords[1].contains("minute") -> { - dates.add(Calendar.MINUTE, -timeAgo) - } - dateWords[1].contains("hour") -> { - dates.add(Calendar.HOUR_OF_DAY, -timeAgo) - } - dateWords[1].contains("day") -> { - dates.add(Calendar.DAY_OF_YEAR, -timeAgo) - } - dateWords[1].contains("week") -> { - dates.add(Calendar.WEEK_OF_YEAR, -timeAgo) - } - dateWords[1].contains("month") -> { - dates.add(Calendar.MONTH, -timeAgo) - } - dateWords[1].contains("year") -> { - dates.add(Calendar.YEAR, -timeAgo) - } - } - return dates.timeInMillis - } - return 0L - } - - override fun chapterListParse(response: Response): List { - val document = response.asJsoup() - val chapterList = document.select(chapterListSelector()).map { chapterFromElement(it) } - - return if (hasCountdown(chapterList[0])) { - chapterList.subList(1, chapterList.size) - } else { - chapterList - } - } - - private fun hasCountdown(chapter: SChapter): Boolean { - val document = client.newCall( - GET( - baseUrl + chapter.url, - headersBuilder().build(), - ), - ).execute().asJsoup() - - return document - .select("iframe[src^=https://free.timeanddate.com/countdown/]") - .isNotEmpty() - } - - // pages - override fun pageListParse(document: Document): List { - val pages = mutableListOf() - var i = 0 - document.select(".container .img_container center img").forEach { element -> - val url = element.attr("src") - i++ - if (url.isNotEmpty()) { - pages.add(Page(i, "", url)) - } - } - return pages - } - - override fun imageUrlParse(document: Document) = "" -} diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangamainac/MangaMainacGenerator.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangamainac/MangaMainacGenerator.kt deleted file mode 100644 index c32e372be..000000000 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/mangamainac/MangaMainacGenerator.kt +++ /dev/null @@ -1,32 +0,0 @@ -package eu.kanade.tachiyomi.multisrc.mangamainac - -import generator.ThemeSourceData.SingleLang -import generator.ThemeSourceGenerator - -class MangaMainacGenerator : ThemeSourceGenerator { - - override val themePkg = "mangamainac" - - override val themeClass = "MangaMainac" - - override val baseVersionCode: Int = 1 - - override val sources = listOf( - SingleLang("Read Boku No Hero Academia Manga Online", "https://w23.readheroacademia.com/", "en"), - SingleLang("Read One Punch Man Manga Online", "https://w23.readonepunchman.net/", "en", overrideVersionCode = 1), - SingleLang("Read Solo Leveling", "https://mysololeveling.com/", "en", overrideVersionCode = 1), - SingleLang("Read Berserk Manga Online", "https://berserkmanga.net/", "en"), - SingleLang("Read Domestic Girlfriend Manga", "https://domesticgirlfriend.net/", "en"), - SingleLang("Read Black Clover Manga", "https://w6.blackclovermanga2.com/", "en", overrideVersionCode = 1), - SingleLang("Read Shingeki no Kyojin Manga", "https://readshingekinokyojin.com/", "en"), - SingleLang("Read Nanatsu no Taizai Manga", "https://w2.readnanatsutaizai.net/", "en", overrideVersionCode = 1), - SingleLang("Read Rent a Girlfriend Manga", "https://kanojo-okarishimasu.com/", "en"), - ) - - companion object { - @JvmStatic - fun main(args: Array) { - MangaMainacGenerator().createAll() - } - } -}