diff --git a/multisrc/overrides/wpcomics/comiclatest/src/ComicLatest.kt b/multisrc/overrides/wpcomics/comiclatest/src/ComicLatest.kt new file mode 100644 index 000000000..b9ced9d8c --- /dev/null +++ b/multisrc/overrides/wpcomics/comiclatest/src/ComicLatest.kt @@ -0,0 +1,75 @@ +package eu.kanade.tachiyomi.extension.en.comiclatest + +import eu.kanade.tachiyomi.multisrc.wpcomics.WPComics +import eu.kanade.tachiyomi.network.GET +import eu.kanade.tachiyomi.source.model.Filter +import eu.kanade.tachiyomi.source.model.FilterList +import eu.kanade.tachiyomi.source.model.SChapter +import eu.kanade.tachiyomi.source.model.SManga +import eu.kanade.tachiyomi.util.asJsoup +import okhttp3.Request +import okhttp3.Response +import org.jsoup.nodes.Document +import org.jsoup.nodes.Element +import java.text.SimpleDateFormat +import java.util.Locale + +class ComicLatest : WPComics("ComicLatest", "https://comiclatest.com", "en", SimpleDateFormat("MM/dd/yyyy", Locale.US), null) { + // Hot only has one page + override val popularPath = "popular-comics" + + override fun popularMangaFromElement(element: Element) = SManga.create().apply { + element.select("h3 a").let { + title = it.text() + setUrlWithoutDomain(it.attr("href")) + } + thumbnail_url = element.select("img").attr("data-original") + } + + override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request { + filters.forEach { filter -> + when (filter) { + is AuthorFilter -> { + val author = filter.state.trim().replace(" ", "-").toLowerCase() + return GET("$baseUrl/author/$author?page=$page", headers) + } + } + } + + return GET("$baseUrl/search?keyword=$query&page=$page", headers) + } + + override fun searchMangaSelector() = "div.item div.box_img > a[title]" + + // For whatever reason, errors with author search if this isn't overridden + override fun searchMangaFromElement(element: Element): SManga { + return SManga.create().apply { + title = element.attr("title") + setUrlWithoutDomain(element.attr("href")) + } + } + + override fun chapterListParse(response: Response): List { + val chapters = mutableListOf() + + fun parseChapters(document: Document) { + document.select(chapterListSelector()).map { chapters.add(chapterFromElement(it)) } + document.select("ul.pagination a[rel=next]").firstOrNull()?.let { a -> + parseChapters(client.newCall(GET(a.attr("abs:href"), headers)).execute().asJsoup()) + } + } + + parseChapters(response.asJsoup()) + return chapters + } + + override fun pageListRequest(chapter: SChapter) = GET("$baseUrl${chapter.url}/all", headers) + + private class AuthorFilter : Filter.Text("Author") + + override fun getFilterList() = FilterList( + Filter.Header("NOTE: Cannot be used with search"), + Filter.Separator(), + AuthorFilter() + ) +} diff --git a/src/all/wpcomics/res/mipmap-hdpi/ic_launcher.png b/multisrc/overrides/wpcomics/default_res/mipmap-hdpi/ic_launcher.png similarity index 100% rename from src/all/wpcomics/res/mipmap-hdpi/ic_launcher.png rename to multisrc/overrides/wpcomics/default_res/mipmap-hdpi/ic_launcher.png diff --git a/src/all/wpcomics/res/mipmap-mdpi/ic_launcher.png b/multisrc/overrides/wpcomics/default_res/mipmap-mdpi/ic_launcher.png similarity index 100% rename from src/all/wpcomics/res/mipmap-mdpi/ic_launcher.png rename to multisrc/overrides/wpcomics/default_res/mipmap-mdpi/ic_launcher.png diff --git a/src/all/wpcomics/res/mipmap-xhdpi/ic_launcher.png b/multisrc/overrides/wpcomics/default_res/mipmap-xhdpi/ic_launcher.png similarity index 100% rename from src/all/wpcomics/res/mipmap-xhdpi/ic_launcher.png rename to multisrc/overrides/wpcomics/default_res/mipmap-xhdpi/ic_launcher.png diff --git a/src/all/wpcomics/res/mipmap-xxhdpi/ic_launcher.png b/multisrc/overrides/wpcomics/default_res/mipmap-xxhdpi/ic_launcher.png similarity index 100% rename from src/all/wpcomics/res/mipmap-xxhdpi/ic_launcher.png rename to multisrc/overrides/wpcomics/default_res/mipmap-xxhdpi/ic_launcher.png diff --git a/src/all/wpcomics/res/mipmap-xxxhdpi/ic_launcher.png b/multisrc/overrides/wpcomics/default_res/mipmap-xxxhdpi/ic_launcher.png similarity index 100% rename from src/all/wpcomics/res/mipmap-xxxhdpi/ic_launcher.png rename to multisrc/overrides/wpcomics/default_res/mipmap-xxxhdpi/ic_launcher.png diff --git a/src/all/wpcomics/res/web_hi_res_512.png b/multisrc/overrides/wpcomics/default_res/web_hi_res_512.png similarity index 100% rename from src/all/wpcomics/res/web_hi_res_512.png rename to multisrc/overrides/wpcomics/default_res/web_hi_res_512.png diff --git a/multisrc/overrides/wpcomics/mangasum/res/mipmap-hdpi/ic_launcher.png b/multisrc/overrides/wpcomics/mangasum/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 000000000..ba5fd658f Binary files /dev/null and b/multisrc/overrides/wpcomics/mangasum/res/mipmap-hdpi/ic_launcher.png differ diff --git a/multisrc/overrides/wpcomics/mangasum/res/mipmap-mdpi/ic_launcher.png b/multisrc/overrides/wpcomics/mangasum/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 000000000..5a0719ec1 Binary files /dev/null and b/multisrc/overrides/wpcomics/mangasum/res/mipmap-mdpi/ic_launcher.png differ diff --git a/multisrc/overrides/wpcomics/mangasum/res/mipmap-xhdpi/ic_launcher.png b/multisrc/overrides/wpcomics/mangasum/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 000000000..ec518a007 Binary files /dev/null and b/multisrc/overrides/wpcomics/mangasum/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/multisrc/overrides/wpcomics/mangasum/res/mipmap-xxhdpi/ic_launcher.png b/multisrc/overrides/wpcomics/mangasum/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 000000000..4398b0f84 Binary files /dev/null and b/multisrc/overrides/wpcomics/mangasum/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/multisrc/overrides/wpcomics/mangasum/res/mipmap-xxxhdpi/ic_launcher.png b/multisrc/overrides/wpcomics/mangasum/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 000000000..b164d1d18 Binary files /dev/null and b/multisrc/overrides/wpcomics/mangasum/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/multisrc/overrides/wpcomics/mangasum/res/web_hi_res_512.png b/multisrc/overrides/wpcomics/mangasum/res/web_hi_res_512.png new file mode 100644 index 000000000..aa9232d9e Binary files /dev/null and b/multisrc/overrides/wpcomics/mangasum/res/web_hi_res_512.png differ diff --git a/multisrc/overrides/wpcomics/mangasum/src/MangaSumFactory.kt b/multisrc/overrides/wpcomics/mangasum/src/MangaSumFactory.kt new file mode 100644 index 000000000..d4ff546b4 --- /dev/null +++ b/multisrc/overrides/wpcomics/mangasum/src/MangaSumFactory.kt @@ -0,0 +1,31 @@ +package eu.kanade.tachiyomi.extension.all.mangasum + +import eu.kanade.tachiyomi.multisrc.wpcomics.WPComics +import eu.kanade.tachiyomi.network.GET +import eu.kanade.tachiyomi.source.Source +import eu.kanade.tachiyomi.source.SourceFactory +import eu.kanade.tachiyomi.source.model.FilterList +import okhttp3.Request +import java.text.SimpleDateFormat +import java.util.Locale + +class MangaSumFactory : SourceFactory { + override fun createSources(): List = listOf( + MangaSum(), + MangaSumRAW(), + ) +} +class MangaSumRAW : WPComics("MangaSum RAW", "https://mangasum.com", "ja", SimpleDateFormat("MM/dd/yy", Locale.US), null) { + override fun popularMangaRequest(page: Int): Request { + return GET("$baseUrl/raw" + if (page > 1) "?page=$page" else "", headers) + } + override fun popularMangaSelector() = "div.items div.item" + override fun latestUpdatesRequest(page: Int) = popularMangaRequest(page) + override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request = GET("$baseUrl/genres?keyword=$query&page=$page", headers) + override fun searchMangaSelector() = "div.items div.item div.image a[title*=' - Raw']" +} + +class MangaSum : WPComics("MangaSum", "https://mangasum.com", "en", SimpleDateFormat("MM/dd/yy", Locale.US), null) { + override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request = GET("$baseUrl/genres?keyword=$query&page=$page", headers) + override fun searchMangaSelector() = "div.items div.item div.image a:not([title*=' - Raw'])" +} diff --git a/multisrc/overrides/wpcomics/manhuaes/res/mipmap-hdpi/ic_launcher.png b/multisrc/overrides/wpcomics/manhuaes/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 000000000..9eb3a6e27 Binary files /dev/null and b/multisrc/overrides/wpcomics/manhuaes/res/mipmap-hdpi/ic_launcher.png differ diff --git a/multisrc/overrides/wpcomics/manhuaes/res/mipmap-mdpi/ic_launcher.png b/multisrc/overrides/wpcomics/manhuaes/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 000000000..00b6abf7c Binary files /dev/null and b/multisrc/overrides/wpcomics/manhuaes/res/mipmap-mdpi/ic_launcher.png differ diff --git a/multisrc/overrides/wpcomics/manhuaes/res/mipmap-xhdpi/ic_launcher.png b/multisrc/overrides/wpcomics/manhuaes/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 000000000..aef02a98f Binary files /dev/null and b/multisrc/overrides/wpcomics/manhuaes/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/multisrc/overrides/wpcomics/manhuaes/res/mipmap-xxhdpi/ic_launcher.png b/multisrc/overrides/wpcomics/manhuaes/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 000000000..27bd57acd Binary files /dev/null and b/multisrc/overrides/wpcomics/manhuaes/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/multisrc/overrides/wpcomics/manhuaes/res/mipmap-xxxhdpi/ic_launcher.png b/multisrc/overrides/wpcomics/manhuaes/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 000000000..1b3497564 Binary files /dev/null and b/multisrc/overrides/wpcomics/manhuaes/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/multisrc/overrides/wpcomics/manhuaes/res/web_hi_res_512.png b/multisrc/overrides/wpcomics/manhuaes/res/web_hi_res_512.png new file mode 100644 index 000000000..4d49ec2fe Binary files /dev/null and b/multisrc/overrides/wpcomics/manhuaes/res/web_hi_res_512.png differ diff --git a/multisrc/overrides/wpcomics/manhuaes/src/ManhuaES.kt b/multisrc/overrides/wpcomics/manhuaes/src/ManhuaES.kt new file mode 100644 index 000000000..8fe85fc3b --- /dev/null +++ b/multisrc/overrides/wpcomics/manhuaes/src/ManhuaES.kt @@ -0,0 +1,57 @@ +package eu.kanade.tachiyomi.extension.en.manhuaes + +import eu.kanade.tachiyomi.multisrc.wpcomics.WPComics +import eu.kanade.tachiyomi.network.GET +import eu.kanade.tachiyomi.source.model.FilterList +import eu.kanade.tachiyomi.source.model.SManga +import okhttp3.Request +import org.jsoup.nodes.Document +import org.jsoup.nodes.Element +import java.text.SimpleDateFormat +import java.util.Locale + +class ManhuaES : WPComics("Manhua ES", "https://manhuaes.com", "en", SimpleDateFormat("HH:mm - dd/MM/yyyy Z", Locale.US), "+0700") { + override val popularPath = "category-comics/manga" + override fun popularMangaRequest(page: Int): Request { + return GET("$baseUrl/$popularPath" + if (page > 1) "/page/$page" else "", headers) + } + override fun latestUpdatesRequest(page: Int): Request { + return GET(baseUrl + if (page > 1) "/page/$page" else "", headers) + } + override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request { + return GET("$baseUrl/page/$page/?s=$query&post_type=comics") + } + override fun popularMangaNextPageSelector() = ".pagination li:last-child:not(.active)" + override fun popularMangaFromElement(element: Element): SManga { + return SManga.create().apply { + element.select("div.overlay a:has(h2)").let { + title = it.text() + setUrlWithoutDomain(it.attr("href")) + } + thumbnail_url = element.select("img").firstOrNull()?.attr("abs:src") + } + } + override fun mangaDetailsParse(document: Document): SManga { + return SManga.create().apply { + document.select("article#item-detail").let { info -> + author = info.select("li.author p.col-xs-8").text() + status = info.select("li.status p.col-xs-8").text().toStatus() + genre = info.select(".tags-genre a").joinToString { it.text() } + thumbnail_url = imageOrNull(info.select("div.col-image img").first()) + + val h3 = info.select(".detail-content h3").text() + val strong = info.select(".detail-content strong").text() + val showMoreFake = info.select(".detail-content .content-readmore").text() + val showMore = info.select(".detail-content .morelink").text() + val rawDesc = info.select("div.detail-content").text() + + if (showMoreFake == null || showMoreFake == "") { + description = rawDesc.substringAfter(h3).substringAfter(strong).substringBefore(showMore) + } else { + description = rawDesc.substringAfter(h3).substringAfter(strong).substringBefore(showMoreFake) + } + } + } + } + override val pageListSelector = "div.chapter-detail ul img, div.chapter-detail div:not(.container) > img, div.chapter-detail p > img" +} diff --git a/multisrc/overrides/wpcomics/nettruyen/src/NetTruyen.kt b/multisrc/overrides/wpcomics/nettruyen/src/NetTruyen.kt new file mode 100644 index 000000000..dd7bd71ad --- /dev/null +++ b/multisrc/overrides/wpcomics/nettruyen/src/NetTruyen.kt @@ -0,0 +1,19 @@ +package eu.kanade.tachiyomi.extension.vi.nettruyen + +import eu.kanade.tachiyomi.multisrc.wpcomics.WPComics +import eu.kanade.tachiyomi.network.GET +import eu.kanade.tachiyomi.source.model.FilterList +import eu.kanade.tachiyomi.source.model.Page +import okhttp3.Request +import java.text.SimpleDateFormat +import java.util.Locale + +class NetTruyen : WPComics("NetTruyen", "http://www.nettruyen.com", "vi", SimpleDateFormat("dd/MM/yy", Locale.getDefault()), null) { + override fun imageRequest(page: Page): Request = GET(page.imageUrl!!, headersBuilder().add("Referer", baseUrl).build()) + override fun getFilterList(): FilterList { + return FilterList( + StatusFilter(getStatusList()), + GenreFilter(getGenreList()) + ) + } +} diff --git a/multisrc/overrides/wpcomics/nhattruyen/src/NhatTruyen.kt b/multisrc/overrides/wpcomics/nhattruyen/src/NhatTruyen.kt new file mode 100644 index 000000000..54ece8aaa --- /dev/null +++ b/multisrc/overrides/wpcomics/nhattruyen/src/NhatTruyen.kt @@ -0,0 +1,14 @@ +package eu.kanade.tachiyomi.extension.vi.nhattruyen + +import eu.kanade.tachiyomi.multisrc.wpcomics.WPComics +import eu.kanade.tachiyomi.network.GET +import eu.kanade.tachiyomi.source.model.FilterList +import eu.kanade.tachiyomi.source.model.Page +import okhttp3.Request +import java.text.SimpleDateFormat +import java.util.Locale + +class NhatTruyen : WPComics("NhatTruyen", "http://nhattruyen.com", "vi", SimpleDateFormat("dd/MM/yy", Locale.getDefault()), null) { + override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request = GET("$baseUrl/the-loai?keyword=$query&page=$page", headers) + override fun imageRequest(page: Page): Request = GET(page.imageUrl!!, headersBuilder().add("Referer", baseUrl).build()) +} diff --git a/multisrc/overrides/wpcomics/truyenchon/src/TruyenChon.kt b/multisrc/overrides/wpcomics/truyenchon/src/TruyenChon.kt new file mode 100644 index 000000000..bfbd26b97 --- /dev/null +++ b/multisrc/overrides/wpcomics/truyenchon/src/TruyenChon.kt @@ -0,0 +1,20 @@ +package eu.kanade.tachiyomi.extension.vi.truyenchon + +import eu.kanade.tachiyomi.multisrc.wpcomics.WPComics +import eu.kanade.tachiyomi.network.GET +import eu.kanade.tachiyomi.source.model.FilterList +import eu.kanade.tachiyomi.source.model.Page +import okhttp3.Request +import java.text.SimpleDateFormat +import java.util.Locale + +class TruyenChon : WPComics("TruyenChon", "http://truyenchon.com", "vi", SimpleDateFormat("dd/MM/yy", Locale.getDefault()), null) { + override val searchPath = "the-loai" + override fun imageRequest(page: Page): Request = GET(page.imageUrl!!, headersBuilder().add("Referer", baseUrl).build()) + override fun getFilterList(): FilterList { + return FilterList( + StatusFilter(getStatusList()), + GenreFilter(getGenreList()) + ) + } +} diff --git a/multisrc/overrides/wpcomics/xoxocomics/src/XoxoComics.kt b/multisrc/overrides/wpcomics/xoxocomics/src/XoxoComics.kt new file mode 100644 index 000000000..486536cbe --- /dev/null +++ b/multisrc/overrides/wpcomics/xoxocomics/src/XoxoComics.kt @@ -0,0 +1,47 @@ +package eu.kanade.tachiyomi.extension.en.xoxocomics + +import eu.kanade.tachiyomi.multisrc.wpcomics.WPComics +import eu.kanade.tachiyomi.network.GET +import eu.kanade.tachiyomi.source.model.FilterList +import eu.kanade.tachiyomi.source.model.SChapter +import eu.kanade.tachiyomi.source.model.SManga +import eu.kanade.tachiyomi.util.asJsoup +import okhttp3.Request +import okhttp3.Response +import org.jsoup.nodes.Document +import org.jsoup.nodes.Element +import java.text.SimpleDateFormat +import java.util.Locale + +class XoxoComics : WPComics("XOXO Comics", "https://xoxocomics.com", "en", SimpleDateFormat("MM/dd/yy", Locale.US), null) { + override fun latestUpdatesRequest(page: Int): Request = GET("$baseUrl/comic-updates?page=$page", headers) + override fun latestUpdatesSelector() = "li.row" + override fun latestUpdatesFromElement(element: Element): SManga { + return SManga.create().apply { + element.select("h3 a").let { + title = it.text() + setUrlWithoutDomain(it.attr("href")) + } + thumbnail_url = element.select("img").attr("data-original") + } + } + override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request { + return GET("$baseUrl/search?keyword=$query&page=$page", headers) + } + + override fun chapterListParse(response: Response): List { + val chapters = mutableListOf() + + // recursively add chapters from paginated chapter list + fun parseChapters(document: Document) { + document.select(chapterListSelector()).map { chapters.add(chapterFromElement(it)) } + document.select("ul.pagination a[rel=next]").firstOrNull()?.let { a -> + parseChapters(client.newCall(GET(a.attr("abs:href"), headers)).execute().asJsoup()) + } + } + + parseChapters(response.asJsoup()) + return chapters + } + override fun pageListRequest(chapter: SChapter): Request = GET(baseUrl + "${chapter.url}/all") +} diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madara/MadaraGenerator.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madara/MadaraGenerator.kt index f9f07361f..56967cefd 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madara/MadaraGenerator.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/madara/MadaraGenerator.kt @@ -79,7 +79,6 @@ class MadaraGenerator : ThemeSourceGenerator { SingleLang("KlikManga", "https://klikmanga.com", "id"), SingleLang("Kissmanga.in", "https://kissmanga.in", "en", className= "KissmangaIn"), SingleLang("Kombatch", "https://kombatch.com", "id"), - SingleLang("KomikGo", "https://komikgo.com", "id"), SingleLang("Lily Manga", "https://lilymanga.com", "en"), SingleLang("LovableSubs", "https://lovablesubs.com", "tr"), SingleLang("Manga18 Fun", "https://manga18.fun", "en"), diff --git a/src/all/wpcomics/src/eu/kanade/tachiyomi/extension/all/wpcomics/WPComics.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/wpcomics/WPComics.kt similarity index 99% rename from src/all/wpcomics/src/eu/kanade/tachiyomi/extension/all/wpcomics/WPComics.kt rename to multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/wpcomics/WPComics.kt index c8941194e..dda9c1cbc 100644 --- a/src/all/wpcomics/src/eu/kanade/tachiyomi/extension/all/wpcomics/WPComics.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/wpcomics/WPComics.kt @@ -1,4 +1,4 @@ -package eu.kanade.tachiyomi.extension.all.wpcomics +package eu.kanade.tachiyomi.multisrc.wpcomics import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.source.model.Filter diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/wpcomics/WPComicsGenerator.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/wpcomics/WPComicsGenerator.kt new file mode 100644 index 000000000..7107a97df --- /dev/null +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/wpcomics/WPComicsGenerator.kt @@ -0,0 +1,31 @@ +package eu.kanade.tachiyomi.multisrc.wpcomics + +import eu.kanade.tachiyomi.multisrc.ThemeSourceData.SingleLang +import eu.kanade.tachiyomi.multisrc.ThemeSourceData.MultiLang +import eu.kanade.tachiyomi.multisrc.ThemeSourceGenerator + +class WPComicsGenerator : ThemeSourceGenerator { + + override val themePkg = "wpcomics" + + override val themeClass = "WPComics" + + override val baseVersionCode: Int = 1 + + override val sources = listOf( + SingleLang("ComicLatest", "https://comiclatest.com", "en"), + MultiLang("MangaSum", "https://mangasum.com", listOf("en", "ja")), + SingleLang("Manhua ES", "https://manhuaes.com", "en"), + SingleLang("NetTruyen", "http://www.nettruyen.com", "vi"), + SingleLang("NhatTruyen", "http://nhattruyen.com", "vi"), + SingleLang("TruyenChon", "http://truyenchon.com", "vi"), + SingleLang("XOXO Comics", "https://xoxocomics.com", "en", className = "XoxoComics"), + ) + + companion object { + @JvmStatic + fun main(args: Array) { + WPComicsGenerator().createAll() + } + } +} diff --git a/src/all/wpcomics/AndroidManifest.xml b/src/all/wpcomics/AndroidManifest.xml deleted file mode 100644 index 30deb7f79..000000000 --- a/src/all/wpcomics/AndroidManifest.xml +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/src/all/wpcomics/build.gradle b/src/all/wpcomics/build.gradle deleted file mode 100644 index 707442666..000000000 --- a/src/all/wpcomics/build.gradle +++ /dev/null @@ -1,12 +0,0 @@ -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' - -ext { - extName = 'WP-Comics' - pkgNameSuffix = 'all.wpcomics' - extClass = '.WPComicsFactory' - extVersionCode = 21 - libVersion = '1.2' -} - -apply from: "$rootDir/common.gradle" diff --git a/src/all/wpcomics/src/eu/kanade/tachiyomi/extension/all/wpcomics/WPComicsFactory.kt b/src/all/wpcomics/src/eu/kanade/tachiyomi/extension/all/wpcomics/WPComicsFactory.kt deleted file mode 100644 index fca74f44c..000000000 --- a/src/all/wpcomics/src/eu/kanade/tachiyomi/extension/all/wpcomics/WPComicsFactory.kt +++ /dev/null @@ -1,210 +0,0 @@ -package eu.kanade.tachiyomi.extension.all.wpcomics - -import eu.kanade.tachiyomi.network.GET -import eu.kanade.tachiyomi.source.Source -import eu.kanade.tachiyomi.source.SourceFactory -import eu.kanade.tachiyomi.source.model.Filter -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.util.asJsoup -import okhttp3.Request -import okhttp3.Response -import org.jsoup.nodes.Document -import org.jsoup.nodes.Element -import java.text.SimpleDateFormat -import java.util.Locale - -class WPComicsFactory : SourceFactory { - override fun createSources(): List = listOf( - ManhuaES(), - MangaSum(), - MangaSumRAW(), - XoxoComics(), - NhatTruyen(), - NetTruyen(), - TruyenChon(), - ComicLatest() - ) -} - -private class ManhuaES : WPComics("Manhua ES", "https://manhuaes.com", "en", SimpleDateFormat("HH:mm - dd/MM/yyyy Z", Locale.US), "+0700") { - override val popularPath = "category-comics/manga" - override fun popularMangaRequest(page: Int): Request { - return GET("$baseUrl/$popularPath" + if (page > 1) "/page/$page" else "", headers) - } - override fun latestUpdatesRequest(page: Int): Request { - return GET(baseUrl + if (page > 1) "/page/$page" else "", headers) - } - override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request { - return GET("$baseUrl/page/$page/?s=$query&post_type=comics") - } - override fun popularMangaNextPageSelector() = ".pagination li:last-child:not(.active)" - override fun popularMangaFromElement(element: Element): SManga { - return SManga.create().apply { - element.select("div.overlay a:has(h2)").let { - title = it.text() - setUrlWithoutDomain(it.attr("href")) - } - thumbnail_url = element.select("img").firstOrNull()?.attr("abs:src") - } - } - override fun mangaDetailsParse(document: Document): SManga { - return SManga.create().apply { - document.select("article#item-detail").let { info -> - author = info.select("li.author p.col-xs-8").text() - status = info.select("li.status p.col-xs-8").text().toStatus() - genre = info.select(".tags-genre a").joinToString { it.text() } - thumbnail_url = imageOrNull(info.select("div.col-image img").first()) - - val h3 = info.select(".detail-content h3").text() - val strong = info.select(".detail-content strong").text() - val showMoreFake = info.select(".detail-content .content-readmore").text() - val showMore = info.select(".detail-content .morelink").text() - val rawDesc = info.select("div.detail-content").text() - - if (showMoreFake == null || showMoreFake == "") { - description = rawDesc.substringAfter(h3).substringAfter(strong).substringBefore(showMore) - } else { - description = rawDesc.substringAfter(h3).substringAfter(strong).substringBefore(showMoreFake) - } - } - } - } - override val pageListSelector = "div.chapter-detail ul img, div.chapter-detail div:not(.container) > img, div.chapter-detail p > img" -} - -private class MangaSumRAW : WPComics("MangaSum RAW", "https://mangasum.com", "ja", SimpleDateFormat("MM/dd/yy", Locale.US), null) { - override fun popularMangaRequest(page: Int): Request { - return GET("$baseUrl/raw" + if (page > 1) "?page=$page" else "", headers) - } - override fun popularMangaSelector() = "div.items div.item" - override fun latestUpdatesRequest(page: Int) = popularMangaRequest(page) - override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request = GET("$baseUrl/genres?keyword=$query&page=$page", headers) - override fun searchMangaSelector() = "div.items div.item div.image a[title*=' - Raw']" -} - -private class MangaSum : WPComics("MangaSum", "https://mangasum.com", "en", SimpleDateFormat("MM/dd/yy", Locale.US), null) { - override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request = GET("$baseUrl/genres?keyword=$query&page=$page", headers) - override fun searchMangaSelector() = "div.items div.item div.image a:not([title*=' - Raw'])" -} - -private class XoxoComics : WPComics("XOXO Comics", "https://xoxocomics.com", "en", SimpleDateFormat("MM/dd/yy", Locale.US), null) { - override fun latestUpdatesRequest(page: Int): Request = GET("$baseUrl/comic-updates?page=$page", headers) - override fun latestUpdatesSelector() = "li.row" - override fun latestUpdatesFromElement(element: Element): SManga { - return SManga.create().apply { - element.select("h3 a").let { - title = it.text() - setUrlWithoutDomain(it.attr("href")) - } - thumbnail_url = element.select("img").attr("data-original") - } - } - override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request { - return GET("$baseUrl/search?keyword=$query&page=$page", headers) - } - - override fun chapterListParse(response: Response): List { - val chapters = mutableListOf() - - // recursively add chapters from paginated chapter list - fun parseChapters(document: Document) { - document.select(chapterListSelector()).map { chapters.add(chapterFromElement(it)) } - document.select("ul.pagination a[rel=next]").firstOrNull()?.let { a -> - parseChapters(client.newCall(GET(a.attr("abs:href"), headers)).execute().asJsoup()) - } - } - - parseChapters(response.asJsoup()) - return chapters - } - override fun pageListRequest(chapter: SChapter): Request = GET(baseUrl + "${chapter.url}/all") -} - -private class NhatTruyen : WPComics("NhatTruyen", "http://nhattruyen.com", "vi", SimpleDateFormat("dd/MM/yy", Locale.getDefault()), null) { - override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request = GET("$baseUrl/the-loai?keyword=$query&page=$page", headers) - override fun imageRequest(page: Page): Request = GET(page.imageUrl!!, headersBuilder().add("Referer", baseUrl).build()) -} - -private class NetTruyen : WPComics("NetTruyen", "http://www.nettruyen.com", "vi", SimpleDateFormat("dd/MM/yy", Locale.getDefault()), null) { - override fun imageRequest(page: Page): Request = GET(page.imageUrl!!, headersBuilder().add("Referer", baseUrl).build()) - override fun getFilterList(): FilterList { - return FilterList( - StatusFilter(getStatusList()), - GenreFilter(getGenreList()) - ) - } -} - -private class TruyenChon : WPComics("TruyenChon", "http://truyenchon.com", "vi", SimpleDateFormat("dd/MM/yy", Locale.getDefault()), null) { - override val searchPath = "the-loai" - override fun imageRequest(page: Page): Request = GET(page.imageUrl!!, headersBuilder().add("Referer", baseUrl).build()) - override fun getFilterList(): FilterList { - return FilterList( - StatusFilter(getStatusList()), - GenreFilter(getGenreList()) - ) - } -} - -private class ComicLatest : WPComics("ComicLatest", "https://comiclatest.com", "en", SimpleDateFormat("MM/dd/yyyy", Locale.US), null) { - // Hot only has one page - override val popularPath = "popular-comics" - - override fun popularMangaFromElement(element: Element) = SManga.create().apply { - element.select("h3 a").let { - title = it.text() - setUrlWithoutDomain(it.attr("href")) - } - thumbnail_url = element.select("img").attr("data-original") - } - - override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request { - filters.forEach { filter -> - when (filter) { - is AuthorFilter -> { - val author = filter.state.trim().replace(" ", "-").toLowerCase() - return GET("$baseUrl/author/$author?page=$page", headers) - } - } - } - - return GET("$baseUrl/search?keyword=$query&page=$page", headers) - } - - override fun searchMangaSelector() = "div.item div.box_img > a[title]" - - // For whatever reason, errors with author search if this isn't overridden - override fun searchMangaFromElement(element: Element): SManga { - return SManga.create().apply { - title = element.attr("title") - setUrlWithoutDomain(element.attr("href")) - } - } - - override fun chapterListParse(response: Response): List { - val chapters = mutableListOf() - - fun parseChapters(document: Document) { - document.select(chapterListSelector()).map { chapters.add(chapterFromElement(it)) } - document.select("ul.pagination a[rel=next]").firstOrNull()?.let { a -> - parseChapters(client.newCall(GET(a.attr("abs:href"), headers)).execute().asJsoup()) - } - } - - parseChapters(response.asJsoup()) - return chapters - } - - override fun pageListRequest(chapter: SChapter) = GET("$baseUrl${chapter.url}/all", headers) - - private class AuthorFilter : Filter.Text("Author") - - override fun getFilterList() = FilterList( - Filter.Header("NOTE: Cannot be used with search"), - Filter.Separator(), - AuthorFilter() - ) -}