Update Genoanime (#148)

This commit is contained in:
senjou69
2021-10-30 16:41:26 -01:00
committed by GitHub
parent c1a40520ac
commit 1ff8b299df
8 changed files with 69 additions and 36 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'GenoAnime'
pkgNameSuffix = 'en.genoanime'
extClass = '.GenoAnime'
extVersionCode = 1
extVersionCode = 2
libVersion = '12'
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 159 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.5 KiB

After

Width:  |  Height:  |  Size: 161 KiB

View File

@ -14,7 +14,6 @@ import okhttp3.OkHttpClient
import okhttp3.Request
import org.jsoup.nodes.Document
import org.jsoup.nodes.Element
import java.lang.Exception
class GenoAnime : ParsedAnimeHttpSource() {
@ -27,24 +26,33 @@ class GenoAnime : ParsedAnimeHttpSource() {
private val weserv = "https://images.weserv.nl/?w=400&q=60&url="
// Popular Anime
override fun popularAnimeRequest(page: Int): Request = GET("$baseUrl/browse?sort=top_rated&page=$page")
override fun popularAnimeSelector(): String = "div.trending__product div.col-lg-10 div.row"
override fun popularAnimeNextPageSelector(): String = "div.text-center a i.fa.fa-angle-double-right"
override fun popularAnimeRequest(page: Int): Request =
GET("$baseUrl/browse?sort=top_rated&page=$page")
override fun popularAnimeSelector(): String = "div.trending__product div.col-lg-10 div.row div.col-lg-3.col-6"
override fun popularAnimeNextPageSelector(): String =
"div.text-center a i.fa.fa-angle-double-right"
override fun popularAnimeFromElement(element: Element): SAnime {
val anime = SAnime.create()
val tempurl = "$baseUrl/" + element.select("div.product__item a").attr("href").removePrefix("./")
val tempurl =
"$baseUrl/" + element.select("div.product__item a").attr("href").removePrefix("./")
anime.setUrlWithoutDomain(tempurl)
anime.title = element.select("div.product__item__text h5 a:nth-of-type(2)").first().text()
val thumburl = element.select("div.product__item__pic").attr("data-setbg").removePrefix("./")
val thumburl =
element.select("div.product__item__pic").attr("data-setbg").removePrefix("./")
anime.thumbnail_url = "$weserv$baseUrl/$thumburl"
return anime
}
// Latest Anime
override fun latestUpdatesRequest(page: Int): Request = GET("$baseUrl/browse?sort=latest&page=$page", headers)
override fun latestUpdatesRequest(page: Int): Request =
GET("$baseUrl/browse?sort=latest&page=$page", headers)
override fun latestUpdatesSelector(): String = popularAnimeSelector()
override fun latestUpdatesNextPageSelector(): String = popularAnimeNextPageSelector()
override fun latestUpdatesFromElement(element: Element): SAnime = popularAnimeFromElement(element)
override fun latestUpdatesFromElement(element: Element): SAnime =
popularAnimeFromElement(element)
// Search Anime
override fun searchAnimeRequest(page: Int, query: String, filters: AnimeFilterList): Request {
@ -57,12 +65,17 @@ class GenoAnime : ParsedAnimeHttpSource() {
.build()
return POST("$baseUrl/data/searchdata.php", newHeaders, formBody)
}
override fun searchAnimeSelector(): String = "div.col-lg-3"
override fun searchAnimeNextPageSelector(): String = "div.text-center.product__pagination a.search-page i.fa.fa-angle-double-right"
override fun searchAnimeNextPageSelector(): String =
"div.text-center.product__pagination a.search-page i.fa.fa-angle-double-left"
override fun searchAnimeFromElement(element: Element): SAnime {
val anime = SAnime.create()
val tempurl = "$baseUrl/" + element.select("a").attr("href").removePrefix("./")
val thumburl = element.select("div.product__item div.product__item__pic.set-bg").attr("data-setbg").removePrefix("./")
val thumburl =
element.select("div.product__item div.product__item__pic.set-bg").attr("data-setbg")
.removePrefix("./")
anime.setUrlWithoutDomain(tempurl)
anime.title = element.select("div.product__item__text h5 a:nth-of-type(2)").text()
anime.thumbnail_url = "$weserv$baseUrl/$thumburl"
@ -83,11 +96,14 @@ class GenoAnime : ParsedAnimeHttpSource() {
// Video
override fun videoUrlParse(document: Document): String = throw Exception("Not used.")
override fun videoListSelector() = "section.details.spad div.container div.row:nth-of-type(1) div.col-lg-12:nth-of-type(1)"
override fun videoListSelector() =
"section.details.spad div.container div.row:nth-of-type(1) div.col-lg-12:nth-of-type(1)"
override fun videoFromElement(element: Element): Video {
val baaseurl = element.select("iframe#iframeplayer").attr("src")
val baaseurl = element.select("div#video iframe#iframe-to-load").attr("src")
Log.d(name, "BaseUrl: $baaseurl")
if (baaseurl.contains("https://genoanime.com/doodplayer.php")) {
val baseurl = videoidgrab(element.select("iframe#iframeplayer").attr("src"))
val baseurl = videoidgrab(element.select("div#video iframe#iframe-to-load").attr("src"))
Log.d(name, "Dood True: $baseurl")
val a = doodUrlParse(baseurl)
Log.d(name, "Dood parsed: $a")
@ -98,57 +114,74 @@ class GenoAnime : ParsedAnimeHttpSource() {
null,
Headers.headersOf("Referer", baseurl)
)
} else return try {
} else {
Log.d(name, "Dood False: " + element.select("video source").attr("src"))
Video(
return Video(
element.select("video source").attr("src"),
"Unknown quality",
element.select("video source").attr("src"),
null,
Headers.headersOf("Referer", baseUrl),
)
} catch (e: Exception) {
throw Exception("Doodstream mirror unavailable.")
}
}
// Anime window
override fun animeDetailsParse(document: Document): SAnime {
val anime = SAnime.create()
val thumburl = document.select("div.anime__details__pic").attr("data-setbg").removePrefix("./")
val thumburl =
document.select("div.anime__details__pic").attr("data-setbg").removePrefix("./")
anime.thumbnail_url = "$baseUrl/$thumburl"
anime.title = document.select("div.anime__details__title h3").text()
anime.genre = document.select("div.col-lg-6.col-md-6:nth-of-type(1) ul li:nth-of-type(3)").joinToString(", ") { it.text() }
anime.genre = document.select("div.col-lg-6.col-md-6:nth-of-type(1) ul li:nth-of-type(3)")
.joinToString(", ") { it.text() }.replace("Genre:", "")
anime.description = document.select("div.anime__details__title span").text()
document.select("div.col-lg-6.col-md-6:nth-of-type(2) ul li:nth-of-type(2)").text()?.also { statusText ->
when {
statusText.contains("Ongoing", true) -> anime.status = SAnime.ONGOING
statusText.contains("Completed", true) -> anime.status = SAnime.COMPLETED
else -> anime.status = SAnime.UNKNOWN
document.select("div.col-lg-6.col-md-6:nth-of-type(2) ul li:nth-of-type(2)").text()
?.also { statusText ->
when {
statusText.contains("Ongoing", true) -> anime.status = SAnime.ONGOING
statusText.contains("Completed", true) -> anime.status = SAnime.COMPLETED
else -> anime.status = SAnime.UNKNOWN
}
}
}
// if (anime.status == SAnime.ONGOING) {
// val(aiiringat, epiisode, animeid) = next_ep_ween(anime.title)
// Log.d("$name status.ONGOING", anime.title)
// Log.d("$name airingat", aiiringat.toString())
// anime.next_ep_wen = airingmsg(epiisode, aiiringat)
// }
return anime
}
// Custom Fun
private fun doodUrlParse(url: String): String? {
private fun doodUrlParse(url: String): String {
val response = client.newCall(GET(url.replace("/e/", "/d/"))).execute()
val content = response.body!!.string()
val md5 = content.substringAfter("/download/").substringBefore("\"")
val tmpdl = "https://dood.ws/download/$md5"
val token = client.newCall(
var abc = doodreq(url, md5)
while (abc.contains("""<b class="err">Security error</b>""")) {
Log.d(name, "Dood bs. Trying again.")
abc = doodreq(url, md5)
}
return abc
}
private fun doodreq(url: String, md5: String): String {
return client.newCall(
GET(
tmpdl,
Headers.headersOf("referer", url.replace("/e/", "/d/"))
"https://dood.ws/download/$md5",
Headers.headersOf("referer", url)
)
).execute().body!!.string().substringAfter("window.open('").substringBefore("\'")
return token
}
private fun videoidgrab(url: String): String {
val uwrl = "https://goload.one/streaming.php?id=" + url.substringAfter("&vidid=")
val response = client.newCall(GET(uwrl)).execute()
val content = response.body!!.string()
return "https://dood" + content.substringAfter("dood").substringBefore("\"")
Log.d(name, "given url: $url")
val uwrl = """https://goload.one/streaming.php?id=${url.substringAfter("&vidid=")}"""
Log.d(name, "golandUrl: $uwrl")
val content = client.newCall(GET(uwrl)).execute().body!!.string().substringAfter("dood").substringBefore("\"")
Log.d(name, "doodUrl: https://dood$content")
return "https://dood$content"
}
}