parent
e7ec260b70
commit
cc07b759d7
|
@ -5,8 +5,12 @@ ext {
|
||||||
appName = 'Tachiyomi: Manga.ae'
|
appName = 'Tachiyomi: Manga.ae'
|
||||||
pkgNameSuffix = 'ar.mangaae'
|
pkgNameSuffix = 'ar.mangaae'
|
||||||
extClass = '.MangaAe'
|
extClass = '.MangaAe'
|
||||||
extVersionCode = 3
|
extVersionCode = 4
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation project(':lib-ratelimit')
|
||||||
|
}
|
||||||
|
|
||||||
apply from: "$rootDir/common.gradle"
|
apply from: "$rootDir/common.gradle"
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
package eu.kanade.tachiyomi.extension.ar.mangaae
|
package eu.kanade.tachiyomi.extension.ar.mangaae
|
||||||
|
|
||||||
import android.util.Log
|
import eu.kanade.tachiyomi.lib.ratelimit.RateLimitInterceptor
|
||||||
import eu.kanade.tachiyomi.network.GET
|
import eu.kanade.tachiyomi.network.GET
|
||||||
import eu.kanade.tachiyomi.source.model.*
|
import eu.kanade.tachiyomi.source.model.*
|
||||||
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
|
import eu.kanade.tachiyomi.source.online.ParsedHttpSource
|
||||||
|
import okhttp3.Headers
|
||||||
import okhttp3.HttpUrl
|
import okhttp3.HttpUrl
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
|
@ -20,27 +21,34 @@ class MangaAe : ParsedHttpSource() {
|
||||||
|
|
||||||
override val supportsLatest = true
|
override val supportsLatest = true
|
||||||
|
|
||||||
override val client: OkHttpClient = network.cloudflareClient
|
private val rateLimitInterceptor = RateLimitInterceptor(2)
|
||||||
|
|
||||||
|
override val client: OkHttpClient = network.cloudflareClient.newBuilder()
|
||||||
|
.addNetworkInterceptor(rateLimitInterceptor)
|
||||||
|
.build()
|
||||||
|
|
||||||
|
override fun headersBuilder(): Headers.Builder = Headers.Builder()
|
||||||
|
.add("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:54.0) Gecko/20100101 Firefox/73.0")
|
||||||
|
.add("Referer", baseUrl)
|
||||||
|
|
||||||
// Popular
|
// Popular
|
||||||
override fun popularMangaRequest(page: Int): Request {
|
override fun popularMangaRequest(page: Int): Request {
|
||||||
return GET("$baseUrl/manga", headers)
|
return GET("$baseUrl/manga/page:$page", headers)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun popularMangaNextPageSelector() = "div.pagination a:last-child:not(.active)"
|
||||||
|
|
||||||
override fun popularMangaSelector() = "div.mangacontainer"
|
override fun popularMangaSelector() = "div.mangacontainer"
|
||||||
|
|
||||||
override fun popularMangaFromElement(element: Element): SManga {
|
override fun popularMangaFromElement(element: Element): SManga = SManga.create().apply {
|
||||||
val manga = SManga.create()
|
val lazysrc = element.select("img").attr("data-pagespeed-lazy-src")
|
||||||
manga.thumbnail_url = element.select("img").first().attr("src")
|
thumbnail_url = if (lazysrc.isNullOrEmpty()) { element.select("img").attr("src") } else { lazysrc }
|
||||||
element.select("a.manga")[1].let {
|
element.select("div.mangacontainer a.manga")[0].let {
|
||||||
manga.setUrlWithoutDomain(it.attr("href"))
|
title = it.text()
|
||||||
manga.title = it.text()
|
setUrlWithoutDomain(it.attr("abs:href"))
|
||||||
}
|
}
|
||||||
return manga
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun popularMangaNextPageSelector() = "div.pagination a.active"
|
|
||||||
|
|
||||||
// Latest
|
// Latest
|
||||||
override fun latestUpdatesRequest(page: Int): Request {
|
override fun latestUpdatesRequest(page: Int): Request {
|
||||||
return GET(baseUrl, headers)
|
return GET(baseUrl, headers)
|
||||||
|
@ -48,16 +56,13 @@ class MangaAe : ParsedHttpSource() {
|
||||||
|
|
||||||
override fun latestUpdatesSelector(): String = "div.popular-manga-container"
|
override fun latestUpdatesSelector(): String = "div.popular-manga-container"
|
||||||
|
|
||||||
override fun latestUpdatesFromElement(element: Element): SManga {
|
override fun latestUpdatesFromElement(element: Element): SManga = SManga.create().apply {
|
||||||
val manga = SManga.create()
|
val lazysrc = element.select("img").attr("data-pagespeed-lazy-src")
|
||||||
val img = element.select("img").first()
|
thumbnail_url = if (lazysrc.isNullOrEmpty()) { element.select("img").attr("src") } else { lazysrc }
|
||||||
element.select("a").first().let {
|
element.select("a")[2].let {
|
||||||
manga.setUrlWithoutDomain(it.attr("href"))
|
setUrlWithoutDomain(it.attr("abs:href"))
|
||||||
manga.title = img.attr("alt")
|
title = it.text()
|
||||||
.split("مانجا ")[1].split(" ch")[0]
|
|
||||||
}
|
}
|
||||||
manga.thumbnail_url = img.attr("src")
|
|
||||||
return manga
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun latestUpdatesNextPageSelector(): String? = null
|
override fun latestUpdatesNextPageSelector(): String? = null
|
||||||
|
@ -85,18 +90,15 @@ class MangaAe : ParsedHttpSource() {
|
||||||
override fun searchMangaNextPageSelector() = popularMangaNextPageSelector()
|
override fun searchMangaNextPageSelector() = popularMangaNextPageSelector()
|
||||||
|
|
||||||
// Manga summary page
|
// Manga summary page
|
||||||
override fun mangaDetailsParse(document: Document): SManga {
|
override fun mangaDetailsParse(document: Document): SManga = SManga.create().apply {
|
||||||
val infoElement = document.select("div.indexcontainer").first()
|
val infoElement = document.select("div.indexcontainer").first()
|
||||||
val manga = SManga.create()
|
title = infoElement.select("h1.EnglishName").text().removeSurrounding("(",")")
|
||||||
manga.title = infoElement.select("div.main").first().ownText()
|
author = infoElement.select("div.manga-details-author h4")[0].text()
|
||||||
manga.author = infoElement.select("div.manga-details-author a")[1].ownText()
|
artist = author
|
||||||
val status = infoElement.select("div.manga-details-extended h4")[1].ownText()
|
status = parseStatus(infoElement.select("div.manga-details-extended h4")[1].text())
|
||||||
manga.status = parseStatus(status)
|
genre = infoElement.select("div.manga-details-extended a[href*=tag]").map { it.text() }.joinToString(", ")
|
||||||
manga.genre = infoElement.select("ul > li").mapNotNull{ it.text() }.joinToString(", ")
|
description = infoElement.select("div.manga-details-extended h4")[2].text()
|
||||||
manga.description = infoElement.select("div.manga-details-extended h4")[2].ownText()
|
thumbnail_url = infoElement.select("img.manga-cover").attr("src")
|
||||||
manga.thumbnail_url = infoElement.select("img.manga-cover").attr("src")
|
|
||||||
|
|
||||||
return manga
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun parseStatus(status: String?) = when {
|
private fun parseStatus(status: String?) = when {
|
||||||
|
@ -115,10 +117,8 @@ class MangaAe : ParsedHttpSource() {
|
||||||
// use full pages for easier links
|
// use full pages for easier links
|
||||||
chapter.setUrlWithoutDomain(it.attr("href")
|
chapter.setUrlWithoutDomain(it.attr("href")
|
||||||
.replace("/1/", "/0/full"))
|
.replace("/1/", "/0/full"))
|
||||||
chapter.name = it.text()
|
chapter.name = "\u061C" + it.text() //Add unicode ARABIC LETTER MARK to ensure all titles are right to left
|
||||||
}
|
}
|
||||||
chapter.date_upload = 0
|
|
||||||
|
|
||||||
return chapter
|
return chapter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue