Skip to content

Commit

Permalink
fix(pt/animesonline): Rename + Update baseUrl + Fix extractors (#3301)
Browse files Browse the repository at this point in the history
  • Loading branch information
Claudemirovsky authored Jun 9, 2024
1 parent 8c40d6b commit 81149e4
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 45 deletions.
10 changes: 5 additions & 5 deletions src/pt/animesgratis/build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
ext {
extName = 'AnimesOnline'
extClass = '.AnimesOnline'
extName = 'Bakashi'
extClass = '.Bakashi'
themePkg = 'dooplay'
baseUrl = 'https://animesonline.nz'
overrideVersionCode = 9
baseUrl = 'https://bakashi.tv'
overrideVersionCode = 10
}

apply from: "$rootDir/common.gradle"
Expand All @@ -14,4 +14,4 @@ dependencies {
implementation(project(":lib:streamwish-extractor"))
implementation(project(":lib:mixdrop-extractor"))
implementation(project(":lib:streamtape-extractor"))
}
}
Binary file modified src/pt/animesgratis/res/mipmap-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/pt/animesgratis/res/mipmap-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/pt/animesgratis/res/mipmap-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/pt/animesgratis/res/mipmap-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/pt/animesgratis/res/mipmap-xxxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package eu.kanade.tachiyomi.animeextension.pt.animesgratis

import eu.kanade.tachiyomi.animeextension.pt.animesgratis.extractors.AnimesOnlinePlayerExtractor
import eu.kanade.tachiyomi.animeextension.pt.animesgratis.extractors.NoaExtractor
import eu.kanade.tachiyomi.animeextension.pt.animesgratis.extractors.RuplayExtractor
import eu.kanade.tachiyomi.animesource.model.SEpisode
import eu.kanade.tachiyomi.animesource.model.Video
Expand All @@ -11,26 +11,24 @@ import eu.kanade.tachiyomi.lib.streamtapeextractor.StreamTapeExtractor
import eu.kanade.tachiyomi.lib.streamwishextractor.StreamWishExtractor
import eu.kanade.tachiyomi.multisrc.dooplay.DooPlay
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.network.POST
import eu.kanade.tachiyomi.util.asJsoup
import eu.kanade.tachiyomi.util.parallelCatchingFlatMapBlocking
import okhttp3.FormBody
import okhttp3.HttpUrl.Companion.toHttpUrl
import okhttp3.Response
import org.jsoup.nodes.Document
import org.jsoup.nodes.Element

class AnimesOnline : DooPlay(
class Bakashi : DooPlay(
"pt-BR",
"AnimesOnline",
"https://animesonline.nz",
"Bakashi",
"https://bakashi.tv",
) {

override val id: Long = 2969482460524685571L

// ============================== Popular ===============================
override fun popularAnimeSelector() = "div.sidebar.right article > a"
override fun popularAnimeRequest(page: Int) = GET("$baseUrl/animes/")
override fun popularAnimeSelector() = "div.items.featured article div.poster"
override fun popularAnimeRequest(page: Int) = GET("$baseUrl/animes/", headers)

// =============================== Search ===============================
override fun searchAnimeSelector() = "div.result-item article div.thumbnail > a"
Expand Down Expand Up @@ -64,7 +62,7 @@ class AnimesOnline : DooPlay(
override val prefQualityEntries = prefQualityValues

private val ruplayExtractor by lazy { RuplayExtractor(client) }
private val animesOnlineExtractor by lazy { AnimesOnlinePlayerExtractor(client) }
private val noaExtractor by lazy { NoaExtractor(client, headers) }
private val bloggerExtractor by lazy { BloggerExtractor(client) }
private val filemoonExtractor by lazy { FilemoonExtractor(client) }
private val streamTapeExtractor by lazy { StreamTapeExtractor(client) }
Expand All @@ -79,45 +77,29 @@ class AnimesOnline : DooPlay(
"streamwish" in name -> streamWishExtractor.videosFromUrl(url)
"filemoon" in name -> filemoonExtractor.videosFromUrl(url)
"mixdrop" in name -> mixDropExtractor.videoFromUrl(url)
"streamtape" in name ->
streamTapeExtractor.videoFromUrl(url)
?.let(::listOf)
?: emptyList()
"/player1/" in url || "/player2/" in url ->
animesOnlineExtractor.videosFromUrl(url)
"streamtape" in name -> streamTapeExtractor.videosFromUrl(url)
"/noance/" in url || "/noa" in url -> noaExtractor.videosFromUrl(url)
"/player/" in url -> bloggerExtractor.videosFromUrl(url, headers)
else -> emptyList()
}
}

private fun getPlayerUrl(player: Element): String? {
val body = FormBody.Builder()
.add("action", "doo_player_ajax")
.add("post", player.attr("data-post"))
.add("nume", player.attr("data-nume"))
.add("type", player.attr("data-type"))
.build()

return client.newCall(POST("$baseUrl/wp-admin/admin-ajax.php", headers, body))
.execute()
.let { response ->
response.body.string()
.substringAfter("\"embed_url\":\"")
.substringBefore("\",")
.replace("\\", "")
.takeIf(String::isNotBlank)
?.let {
when {
it.contains("$baseUrl/aviso/") ->
it.toHttpUrl().queryParameter("url")
else -> it
}
}
val playerId = player.attr("data-nume")
val iframe = player.root().selectFirst("div#source-player-$playerId iframe")

return iframe?.attr("src")?.takeIf(String::isNotBlank)
?.let {
when {
it.contains("/aviso/") ->
it.toHttpUrl().queryParameter("url")
else -> it
}
}
}

// ============================== Filters ===============================
override fun genresListRequest() = GET("$baseUrl/animes/")
override fun genresListRequest() = popularAnimeRequest(0)
override fun genresListSelector() = "div.filter > div.select:first-child option:not([disabled])"

override fun genresListParse(document: Document): Array<Pair<String, String>> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package eu.kanade.tachiyomi.animeextension.pt.animesgratis.extractors

import eu.kanade.tachiyomi.animesource.model.Video
import eu.kanade.tachiyomi.network.GET
import okhttp3.Headers
import okhttp3.OkHttpClient

class AnimesOnlinePlayerExtractor(private val client: OkHttpClient) {
class NoaExtractor(private val client: OkHttpClient, private val headers: Headers) {
fun videosFromUrl(url: String): List<Video> {
return client.newCall(GET(url)).execute()
.body.string()
Expand All @@ -18,7 +19,7 @@ class AnimesOnlinePlayerExtractor(private val client: OkHttpClient) {
.substringAfter(":\"")
.substringBefore('"')
.replace("\\", "")
Video(videoUrl, "Player - $label", videoUrl)
Video(videoUrl, "Player - $label", videoUrl, headers)
}
}
}

0 comments on commit 81149e4

Please sign in to comment.