Skip to content

Commit

Permalink
fix(pt/animesgratis): Change domain/name for pt/Bakashi to pt/Q1N (#171)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dark25 authored Jan 6, 2025
1 parent 33ec684 commit 28a3508
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 19 deletions.
8 changes: 4 additions & 4 deletions src/pt/animesgratis/build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
ext {
extName = 'Bakashi'
extClass = '.Bakashi'
extName = 'Q1N'
extClass = '.Q1N'
themePkg = 'dooplay'
baseUrl = 'https://bakashi.tv'
overrideVersionCode = 14
baseUrl = 'https://q1n.net'
overrideVersionCode = 15
}

apply from: "$rootDir/common.gradle"
Expand Down
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
Expand Up @@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.animeextension.pt.animesgratis

import eu.kanade.tachiyomi.animeextension.pt.animesgratis.extractors.NoaExtractor
import eu.kanade.tachiyomi.animeextension.pt.animesgratis.extractors.RuplayExtractor
import eu.kanade.tachiyomi.animesource.model.SAnime
import eu.kanade.tachiyomi.animesource.model.SEpisode
import eu.kanade.tachiyomi.animesource.model.Video
import eu.kanade.tachiyomi.lib.bloggerextractor.BloggerExtractor
Expand All @@ -20,10 +21,10 @@ import org.jsoup.nodes.Element
import java.text.SimpleDateFormat
import java.util.Locale

class Bakashi : DooPlay(
class Q1N : DooPlay(
"pt-BR",
"Bakashi",
"https://bakashi.net",
"Q1N",
"https://q1n.net",
) {

override val id: Long = 2969482460524685571L
Expand All @@ -34,12 +35,45 @@ class Bakashi : DooPlay(

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

// =============================== Latest ===============================
override val latestUpdatesPath = "e"

// =============================== Search ===============================
override fun searchAnimeSelector() = "div.result-item article div.thumbnail > a"
override fun searchAnimeFromElement(element: Element) = popularAnimeFromElement(element)

// =========================== Anime Details ============================
override val additionalInfoSelector = "div.wp-content"

override fun animeDetailsParse(document: Document): SAnime {
val doc = getRealAnimeDoc(document)
val sheader = doc.selectFirst("div.sheader")!!
return SAnime.create().apply {
setUrlWithoutDomain(doc.location())
sheader.selectFirst("div.poster > img")!!.let {
thumbnail_url = it.getImageUrl()
title = it.attr("alt").ifEmpty {
sheader.selectFirst("div.data > h1")!!.text()
}
}

genre = sheader.select("div.data div.sgeneros > a")
.eachText()
.joinToString()

doc.selectFirst("div#info")?.let { info ->
description = buildString {
append(doc.getDescription())
additionalInfoItems.forEach {
info.getInfo(it)?.let(::append)
}
}
}
}
}

// ============================== Episodes ==============================
override fun getSeasonEpisodes(season: Element): List<SEpisode> {
val seasonName = season.selectFirst("span.se-t")?.text()
Expand Down Expand Up @@ -94,7 +128,7 @@ class Bakashi : DooPlay(
"filemoon" in name -> filemoonExtractor.videosFromUrl(url)
"mixdrop" in name -> mixDropExtractor.videoFromUrl(url)
"streamtape" in name -> streamTapeExtractor.videosFromUrl(url)
"/noance/" in url || "/noa" in url || "/ao/" in url -> noaExtractor.videosFromUrl(url)
"noa" in name -> noaExtractor.videosFromUrl(url)
"/player/" in url -> bloggerExtractor.videosFromUrl(url, headers)
else -> emptyList()
}
Expand Down Expand Up @@ -135,7 +169,7 @@ class Bakashi : DooPlay(

// ============================= Utilities ==============================
override fun getRealAnimeDoc(document: Document): Document {
if (!document.location().contains("/episodio/")) return document
if (!document.location().contains("/e/")) return document

return document.selectFirst("div.pag_episodes div.item > a:has(i.fa-th)")?.let {
client.newCall(GET(it.attr("href"), headers)).execute()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,35 @@ import okhttp3.OkHttpClient

class NoaExtractor(private val client: OkHttpClient, private val headers: Headers) {
fun videosFromUrl(url: String): List<Video> {
return client.newCall(GET(url)).execute()
val body = client.newCall(GET(url)).execute()
.body.string()
.substringAfter("sources: [")
.substringBefore("]")
.split("{")
.drop(1)
.map {
val label = it.substringAfter("label").substringAfter(":\"").substringBefore('"')
val videoUrl = it.substringAfter("file")

return when {
"file: jw.file" in body -> {
val videoUrl = body.substringAfter("file")
.substringAfter(":\"")
.substringBefore('"')
.replace("\\", "")
Video(videoUrl, "Player - $label", videoUrl, headers)
listOf(Video(videoUrl, "NOA", videoUrl, headers))
}

"sources:" in body -> {
body.substringAfter("sources: [")
.substringBefore("]")
.split("{")
.drop(1)
.map {
val label =
it.substringAfter("label").substringAfter(":\"").substringBefore('"')
val videoUrl = it.substringAfter("file")
.substringAfter(":\"")
.substringBefore('"')
.replace("\\", "")
Video(videoUrl, "NOA - $label", videoUrl, headers)
}
}

else -> emptyList()
}
}
}

0 comments on commit 28a3508

Please sign in to comment.