diff --git a/src/pt/animesgratis/build.gradle b/src/pt/animesgratis/build.gradle index c794b9114a..d589054360 100644 --- a/src/pt/animesgratis/build.gradle +++ b/src/pt/animesgratis/build.gradle @@ -3,7 +3,7 @@ ext { extClass = '.Bakashi' themePkg = 'dooplay' baseUrl = 'https://bakashi.tv' - overrideVersionCode = 10 + overrideVersionCode = 11 } apply from: "$rootDir/common.gradle" diff --git a/src/pt/animesgratis/src/eu/kanade/tachiyomi/animeextension/pt/animesgratis/Bakashi.kt b/src/pt/animesgratis/src/eu/kanade/tachiyomi/animeextension/pt/animesgratis/Bakashi.kt index a10701cbd6..8cfa029ec6 100644 --- a/src/pt/animesgratis/src/eu/kanade/tachiyomi/animeextension/pt/animesgratis/Bakashi.kt +++ b/src/pt/animesgratis/src/eu/kanade/tachiyomi/animeextension/pt/animesgratis/Bakashi.kt @@ -17,6 +17,8 @@ import okhttp3.HttpUrl.Companion.toHttpUrl import okhttp3.Response import org.jsoup.nodes.Document import org.jsoup.nodes.Element +import java.text.SimpleDateFormat +import java.util.Locale class Bakashi : DooPlay( "pt-BR", @@ -26,6 +28,10 @@ class Bakashi : DooPlay( override val id: Long = 2969482460524685571L + override val dateFormatter by lazy { + SimpleDateFormat("dd/MM/yy", Locale("pt", "BR")) + } + // ============================== Popular =============================== override fun popularAnimeSelector() = "div.items.featured article div.poster" override fun popularAnimeRequest(page: Int) = GET("$baseUrl/animes/", headers) @@ -35,11 +41,18 @@ class Bakashi : DooPlay( override fun searchAnimeFromElement(element: Element) = popularAnimeFromElement(element) // ============================== Episodes ============================== - override fun episodeListParse(response: Response) = - getRealAnimeDoc(response.asJsoup()) - .select(episodeListSelector()) - .map(::episodeFromElement) - .reversed() + override fun getSeasonEpisodes(season: Element): List { + val seasonName = season.selectFirst("span.se-t")?.text() + return season.select(episodeListSelector()).mapNotNull { element -> + runCatching { + if (seasonName.isNullOrBlank()) { + episodeFromElement(element) + } else { + episodeFromElement(element, seasonName) + } + }.onFailure { it.printStackTrace() }.getOrNull() + } + } override fun episodeListSelector() = "ul.episodios > li > div.episodiotitle > a" @@ -49,6 +62,9 @@ class Bakashi : DooPlay( name = it episode_number = it.substringAfter(" ").toFloatOrNull() ?: 0F } + date_upload = element.parent()?.selectFirst(episodeDateSelector) + ?.text() + ?.toDate() ?: 0L } // ============================ Video Links ============================= @@ -93,6 +109,7 @@ class Bakashi : DooPlay( when { it.contains("/aviso/") -> it.toHttpUrl().queryParameter("url") + else -> it } } @@ -125,4 +142,18 @@ class Bakashi : DooPlay( .asJsoup() } ?: document } + + override fun List