WPMangaStream - add Manga Raw (#2636)
This commit is contained in:
parent
b8a4865f45
commit
bee6c44417
|
@ -5,7 +5,7 @@ ext {
|
||||||
appName = 'Tachiyomi: WP Manga Stream'
|
appName = 'Tachiyomi: WP Manga Stream'
|
||||||
pkgNameSuffix = 'all.wpmangastream'
|
pkgNameSuffix = 'all.wpmangastream'
|
||||||
extClass = '.WPMangaStreamFactory'
|
extClass = '.WPMangaStreamFactory'
|
||||||
extVersionCode = 6
|
extVersionCode = 7
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ import org.jsoup.nodes.Document
|
||||||
import org.jsoup.nodes.Element
|
import org.jsoup.nodes.Element
|
||||||
import uy.kohesive.injekt.Injekt
|
import uy.kohesive.injekt.Injekt
|
||||||
import uy.kohesive.injekt.api.get
|
import uy.kohesive.injekt.api.get
|
||||||
|
import java.lang.UnsupportedOperationException
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
|
|
||||||
abstract class WPMangaStream(override val name: String, override val baseUrl: String, override val lang: String) : ConfigurableSource, ParsedHttpSource() {
|
abstract class WPMangaStream(override val name: String, override val baseUrl: String, override val lang: String) : ConfigurableSource, ParsedHttpSource() {
|
||||||
|
@ -131,7 +132,7 @@ abstract class WPMangaStream(override val name: String, override val baseUrl: St
|
||||||
|
|
||||||
override fun popularMangaFromElement(element: Element): SManga {
|
override fun popularMangaFromElement(element: Element): SManga {
|
||||||
val manga = SManga.create()
|
val manga = SManga.create()
|
||||||
manga.thumbnail_url = element.select("div.limit img").attr("src")
|
manga.thumbnail_url = element.select("div.limit img").attr("abs:src")
|
||||||
element.select("div.bsx > a").first().let {
|
element.select("div.bsx > a").first().let {
|
||||||
manga.setUrlWithoutDomain(it.attr("href"))
|
manga.setUrlWithoutDomain(it.attr("href"))
|
||||||
manga.title = it.attr("title")
|
manga.title = it.attr("title")
|
||||||
|
@ -148,19 +149,13 @@ abstract class WPMangaStream(override val name: String, override val baseUrl: St
|
||||||
|
|
||||||
override fun mangaDetailsParse(document: Document): SManga {
|
override fun mangaDetailsParse(document: Document): SManga {
|
||||||
val infoElement = document.select("div.spe").first()
|
val infoElement = document.select("div.spe").first()
|
||||||
val descElement = document.select(".infox > div.desc").first()
|
|
||||||
val sepName = infoElement.select(".spe > span:contains(Author)").last()
|
val sepName = infoElement.select(".spe > span:contains(Author)").last()
|
||||||
val manga = SManga.create()
|
val manga = SManga.create()
|
||||||
manga.author = sepName?.ownText() ?:"N/A"
|
manga.author = sepName?.ownText() ?:"N/A"
|
||||||
manga.artist = sepName?.ownText() ?:"N/A"
|
manga.artist = sepName?.ownText() ?:"N/A"
|
||||||
val genres = mutableListOf<String>()
|
manga.genre = infoElement.select(".spe > span:nth-child(1) > a").joinToString { it.text() }
|
||||||
infoElement.select(".spe > span:nth-child(1) > a").forEach { element ->
|
|
||||||
val genre = element.text()
|
|
||||||
genres.add(genre)
|
|
||||||
}
|
|
||||||
manga.genre = genres.joinToString(", ")
|
|
||||||
manga.status = parseStatus(infoElement.select(".spe > span:nth-child(2)").text())
|
manga.status = parseStatus(infoElement.select(".spe > span:nth-child(2)").text())
|
||||||
manga.description = descElement.select("p").text()
|
manga.description = document.select(".infox > div.desc").first().select("p").text()
|
||||||
manga.thumbnail_url = document.select(".thumb > img:nth-child(1)").attr("src")
|
manga.thumbnail_url = document.select(".thumb > img:nth-child(1)").attr("src")
|
||||||
|
|
||||||
return manga
|
return manga
|
||||||
|
@ -199,7 +194,7 @@ abstract class WPMangaStream(override val name: String, override val baseUrl: St
|
||||||
val pages = mutableListOf<Page>()
|
val pages = mutableListOf<Page>()
|
||||||
var i = 0
|
var i = 0
|
||||||
document.select("div#readerarea img").forEach { element ->
|
document.select("div#readerarea img").forEach { element ->
|
||||||
val url = element.attr("src")
|
val url = element.attr("abs:src")
|
||||||
i++
|
i++
|
||||||
if (url.isNotEmpty()) {
|
if (url.isNotEmpty()) {
|
||||||
pages.add(Page(i, "", url))
|
pages.add(Page(i, "", url))
|
||||||
|
@ -208,7 +203,7 @@ abstract class WPMangaStream(override val name: String, override val baseUrl: St
|
||||||
return pages
|
return pages
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun imageUrlParse(document: Document) = ""
|
override fun imageUrlParse(document: Document): String = throw UnsupportedOperationException("Not used")
|
||||||
|
|
||||||
override fun imageRequest(page: Page): Request {
|
override fun imageRequest(page: Page): Request {
|
||||||
val headers = Headers.Builder()
|
val headers = Headers.Builder()
|
||||||
|
@ -226,19 +221,13 @@ abstract class WPMangaStream(override val name: String, override val baseUrl: St
|
||||||
return GET(getImageUrl(page.imageUrl!!, getShowThumbnail()), headers.build())
|
return GET(getImageUrl(page.imageUrl!!, getShowThumbnail()), headers.build())
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getImageUrl(baseUrl: String, quality: Int): String {
|
private fun getImageUrl(originalUrl: String, quality: Int): String {
|
||||||
var url = baseUrl
|
val url = originalUrl.substringAfter("//")
|
||||||
when(quality){
|
return when (quality) {
|
||||||
LOW_QUALITY -> {
|
LOW_QUALITY -> "https://images.weserv.nl/?w=300&q=70&url=$url"
|
||||||
url = url.replace("https://", "")
|
MID_QUALITY -> "https://images.weserv.nl/?w=600&q=70&url=$url"
|
||||||
url = "https://images.weserv.nl/?w=300&q=70&url=" + url
|
else -> originalUrl
|
||||||
}
|
|
||||||
MID_QUALITY -> {
|
|
||||||
url = url.replace("https://", "")
|
|
||||||
url = "https://images.weserv.nl/?w=600&q=70&url=" + url
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return url
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class AuthorFilter : Filter.Text("Author")
|
private class AuthorFilter : Filter.Text("Author")
|
||||||
|
|
|
@ -2,17 +2,24 @@ package eu.kanade.tachiyomi.extension.all.wpmangastream
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import eu.kanade.tachiyomi.network.GET
|
import eu.kanade.tachiyomi.network.GET
|
||||||
|
import eu.kanade.tachiyomi.network.asObservableSuccess
|
||||||
import eu.kanade.tachiyomi.source.Source
|
import eu.kanade.tachiyomi.source.Source
|
||||||
import eu.kanade.tachiyomi.source.SourceFactory
|
import eu.kanade.tachiyomi.source.SourceFactory
|
||||||
import eu.kanade.tachiyomi.source.model.*
|
import eu.kanade.tachiyomi.source.model.*
|
||||||
import eu.kanade.tachiyomi.util.asJsoup
|
import eu.kanade.tachiyomi.util.asJsoup
|
||||||
import okhttp3.*
|
import okhttp3.OkHttpClient
|
||||||
|
import okhttp3.Request
|
||||||
|
import okhttp3.Response
|
||||||
|
import okhttp3.Interceptor
|
||||||
|
import okhttp3.HttpUrl
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import org.jsoup.nodes.Document
|
import org.jsoup.nodes.Document
|
||||||
import org.jsoup.nodes.Element
|
import org.jsoup.nodes.Element
|
||||||
|
import rx.Observable
|
||||||
import java.text.ParseException
|
import java.text.ParseException
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.*
|
import java.util.Locale
|
||||||
|
import java.util.Calendar
|
||||||
|
|
||||||
class WPMangaStreamFactory : SourceFactory {
|
class WPMangaStreamFactory : SourceFactory {
|
||||||
override fun createSources(): List<Source> = listOf(
|
override fun createSources(): List<Source> = listOf(
|
||||||
|
@ -25,12 +32,19 @@ class WPMangaStreamFactory : SourceFactory {
|
||||||
KomikIndo(),
|
KomikIndo(),
|
||||||
MaidManga(),
|
MaidManga(),
|
||||||
SekteKomik(),
|
SekteKomik(),
|
||||||
MangaSwat()
|
MangaSwat(),
|
||||||
|
MangaRaw()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
class SekteKomik() : WPMangaStream("Sekte Komik (WP Manga Stream)", "https://sektekomik.com", "id")
|
class SekteKomik : WPMangaStream("Sekte Komik (WP Manga Stream)", "https://sektekomik.com", "id")
|
||||||
class Kiryuu : WPMangaStream("Kiryuu (WP Manga Stream)", "https://kiryuu.co", "id")
|
class Kiryuu : WPMangaStream("Kiryuu (WP Manga Stream)", "https://kiryuu.co", "id") {
|
||||||
|
override fun pageListParse(document: Document): List<Page> {
|
||||||
|
return document.select("div#readerarea img").map { it.attr("abs:src") }
|
||||||
|
.filterNot { it.contains("/.filerun") }
|
||||||
|
.mapIndexed { i, image -> Page(i, "", image) }
|
||||||
|
}
|
||||||
|
}
|
||||||
class KomikAV : WPMangaStream("Komik AV (WP Manga Stream)", "https://komikav.com", "id")
|
class KomikAV : WPMangaStream("Komik AV (WP Manga Stream)", "https://komikav.com", "id")
|
||||||
class KomikStation : WPMangaStream("Komik Station (WP Manga Stream)", "https://komikstation.com", "id")
|
class KomikStation : WPMangaStream("Komik Station (WP Manga Stream)", "https://komikstation.com", "id")
|
||||||
class KomikCast : WPMangaStream("Komik Cast (WP Manga Stream)", "https://komikcast.com", "id") {
|
class KomikCast : WPMangaStream("Komik Cast (WP Manga Stream)", "https://komikcast.com", "id") {
|
||||||
|
@ -940,8 +954,6 @@ class MaidManga : WPMangaStream("Maid Manga (WP Manga Stream)", "https://www.mai
|
||||||
return pages
|
return pages
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun imageUrlParse(document: Document): String = throw UnsupportedOperationException("Not used")
|
|
||||||
|
|
||||||
override fun getFilterList() = FilterList(
|
override fun getFilterList() = FilterList(
|
||||||
Filter.Header("You can combine filter."),
|
Filter.Header("You can combine filter."),
|
||||||
Filter.Separator(),
|
Filter.Separator(),
|
||||||
|
@ -970,7 +982,7 @@ class MaidManga : WPMangaStream("Maid Manga (WP Manga Stream)", "https://www.mai
|
||||||
}
|
}
|
||||||
|
|
||||||
class MangaSwat : WPMangaStream("MangaSwat", "https://mangaswat.com", "ar") {
|
class MangaSwat : WPMangaStream("MangaSwat", "https://mangaswat.com", "ar") {
|
||||||
private class sucuri(): Interceptor {
|
private class Sucuri: Interceptor {
|
||||||
override fun intercept(chain: Interceptor.Chain): Response {
|
override fun intercept(chain: Interceptor.Chain): Response {
|
||||||
val originalRequest = chain.request()
|
val originalRequest = chain.request()
|
||||||
val response = chain.proceed(originalRequest)
|
val response = chain.proceed(originalRequest)
|
||||||
|
@ -978,16 +990,12 @@ class MangaSwat : WPMangaStream("MangaSwat", "https://mangaswat.com", "ar") {
|
||||||
return response
|
return response
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
override val client: OkHttpClient = super.client.newBuilder().addInterceptor(sucuri()).build()
|
override val client: OkHttpClient = super.client.newBuilder().addInterceptor(Sucuri()).build()
|
||||||
|
|
||||||
//Popular
|
|
||||||
//Latest
|
|
||||||
//Search
|
|
||||||
//Details
|
|
||||||
override fun mangaDetailsParse(document: Document): SManga = SManga.create().apply {
|
override fun mangaDetailsParse(document: Document): SManga = SManga.create().apply {
|
||||||
thumbnail_url = document.select("div.thumb img.lazyload").attr("data-src")
|
thumbnail_url = document.select("div.thumb img.lazyload").attr("data-src")
|
||||||
title = document.select("div.infox h1").text()
|
title = document.select("div.infox h1").text()
|
||||||
genre = document.select("div.spe [rel=tag]").map { it.text() }.joinToString(", ")
|
genre = document.select("div.spe [rel=tag]").joinToString(", ") { it.text() }
|
||||||
status = when (document.select("span:contains(الحالة)").text().substringAfter(":").trim()) {
|
status = when (document.select("span:contains(الحالة)").text().substringAfter(":").trim()) {
|
||||||
"Ongoing" -> SManga.ONGOING
|
"Ongoing" -> SManga.ONGOING
|
||||||
"Completed" -> SManga.COMPLETED
|
"Completed" -> SManga.COMPLETED
|
||||||
|
@ -997,9 +1005,6 @@ class MangaSwat : WPMangaStream("MangaSwat", "https://mangaswat.com", "ar") {
|
||||||
artist = author
|
artist = author
|
||||||
description = document.select("div[itemprop=articleBody]").text()
|
description = document.select("div[itemprop=articleBody]").text()
|
||||||
}
|
}
|
||||||
|
|
||||||
//Chapters
|
|
||||||
//Pages and Images
|
|
||||||
override fun pageListRequest(chapter: SChapter): Request {
|
override fun pageListRequest(chapter: SChapter): Request {
|
||||||
return GET(baseUrl + chapter.url + "?/", headers) //Bypass "linkvertise" ads
|
return GET(baseUrl + chapter.url + "?/", headers) //Bypass "linkvertise" ads
|
||||||
}
|
}
|
||||||
|
@ -1012,3 +1017,36 @@ class MangaSwat : WPMangaStream("MangaSwat", "https://mangaswat.com", "ar") {
|
||||||
return GET( page.imageUrl!! , headers)
|
return GET( page.imageUrl!! , headers)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class MangaRaw : WPMangaStream("Manga Raw", "https://mangaraw.org", "ja") {
|
||||||
|
override fun popularMangaRequest(page: Int): Request = GET("$baseUrl/search?order=popular&page=$page", headers)
|
||||||
|
override fun popularMangaSelector() = "div.bsx"
|
||||||
|
override fun popularMangaFromElement(element: Element): SManga {
|
||||||
|
return SManga.create().apply {
|
||||||
|
element.select("div.bigor > a").let {
|
||||||
|
setUrlWithoutDomain(it.attr("href"))
|
||||||
|
title = it.text()
|
||||||
|
}
|
||||||
|
thumbnail_url = element.select("img").attr("abs:src")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
override fun popularMangaNextPageSelector() = "a[rel=next]"
|
||||||
|
override fun latestUpdatesRequest(page: Int): Request = GET("$baseUrl/search?order=update&page=$page", headers)
|
||||||
|
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request
|
||||||
|
= GET("$baseUrl/search?s=$query&page=$page")
|
||||||
|
override fun searchMangaFromElement(element: Element): SManga = popularMangaFromElement(element)
|
||||||
|
override fun fetchPageList(chapter: SChapter): Observable<List<Page>> {
|
||||||
|
return client.newCall(pageListRequest(chapter))
|
||||||
|
.asObservableSuccess()
|
||||||
|
.map { response ->
|
||||||
|
pageListParse(response, baseUrl + chapter.url.removeSuffix("/"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private fun pageListParse(response: Response, chapterUrl: String): List<Page> {
|
||||||
|
return response.asJsoup().select("span.page-link").first().ownText().substringAfterLast(" ").toInt()
|
||||||
|
.let { lastNum -> IntRange(1, lastNum) }
|
||||||
|
.map { num -> Page(num, "$chapterUrl/$num") }
|
||||||
|
}
|
||||||
|
override fun imageUrlParse(document: Document) = document.select("a.img-block img").attr("abs:src")
|
||||||
|
override fun getFilterList(): FilterList = FilterList()
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue