aniage: Many fixes

- Parsing all voices, wew
- Fix poster url
- Fix url for WebView
- etc
This commit is contained in:
CakesTwix 2023-12-09 21:53:04 +02:00
parent ad3ba33814
commit 28a5cb4326
Signed by: CakesTwix
GPG key ID: 7B11051D5CE19825
3 changed files with 48 additions and 56 deletions

View file

@ -1,5 +1,5 @@
// use an integer for version numbers // use an integer for version numbers
version = 9 version = 10
dependencies{ dependencies{
implementation("com.google.code.gson:gson:2.9.0") implementation("com.google.code.gson:gson:2.9.0")

View file

@ -132,7 +132,6 @@ class AniageProvider : MainAPI() {
// https://www.aniage.net/_next/data/IfKYt_B-o41irAex5hZoV/watch.json?wid=96dcb9ce-e4bc-4248-8ed3-29c3d14aedfc // https://www.aniage.net/_next/data/IfKYt_B-o41irAex5hZoV/watch.json?wid=96dcb9ce-e4bc-4248-8ed3-29c3d14aedfc
// Log.d("CakesTwix-Debug", "$mainUrl/_next/data/$buildId/watch.json?wid=$animeID") // Log.d("CakesTwix-Debug", "$mainUrl/_next/data/$buildId/watch.json?wid=$animeID")
val animeJSON = Gson().fromJson(app.get("$mainUrl/_next/data/$buildId/watch.json?wid=$animeID").text, AnimeDetail::class.java) val animeJSON = Gson().fromJson(app.get("$mainUrl/_next/data/$buildId/watch.json?wid=$animeID").text, AnimeDetail::class.java)
// Log.d("CakesTwix-Debug", animeJSON.pageProps.title) // Log.d("CakesTwix-Debug", animeJSON.pageProps.title)
val showStatus = with(animeJSON.pageProps.titleStatus){ val showStatus = with(animeJSON.pageProps.titleStatus){
@ -162,7 +161,7 @@ class AniageProvider : MainAPI() {
contains("https://iframe.mediadelivery.net/embed") -> contains("https://iframe.mediadelivery.net/embed") ->
app.get(this).document.select("source[type*=application/x-mpegURL]").attr("src") app.get(this).document.select("source[type*=application/x-mpegURL]").attr("src")
else -> else ->
this null
} }
} }
@ -171,42 +170,25 @@ class AniageProvider : MainAPI() {
// Log.d("CakesTwix-Debug", app.get("https://master.api.aniage.net/anime/episodes?animeId=$animeID&page=1&pageSize=30&sortOrder=ASC&teamId=${animeJSON.pageProps.teams[0].teamId}&volume=1").url) // Log.d("CakesTwix-Debug", app.get("https://master.api.aniage.net/anime/episodes?animeId=$animeID&page=1&pageSize=30&sortOrder=ASC&teamId=${animeJSON.pageProps.teams[0].teamId}&volume=1").url)
if(animeJSON.pageProps.teams.isNotEmpty()){ if(animeJSON.pageProps.teams.isNotEmpty()){
Gson().fromJson<List<EpisodesModel>>(app.get("https://master.api.aniage.net/anime/episodes?animeId=$animeID&page=1&pageSize=30&sortOrder=ASC&teamId=${animeJSON.pageProps.teams[0].teamId}&volume=1").text, listEpisodeModel).map { Gson().fromJson<List<EpisodesModel>>(app.get("$apiUrl/anime/episodes?animeId=$animeID&page=1&pageSize=30&sortOrder=ASC&teamId=${animeJSON.pageProps.teams[0].teamId}&volume=1").text, listEpisodeModel).map {
val episodeName = if(it.title == ".") "Серія ${it.episodeNum}" else it.title val episodeName = if(it.title == "." || it.title == it.episodeNum.toString()) "Серія ${it.episodeNum}" else it.title
if(it.s3VideoSource != null){ episodes.add(Episode
// Episode (
// Log.d("CakesTwix-Debug", "Episode ${it.episodeNum}") "${it.animeId}, ${it.episodeNum}",
episodes.add(Episode episodeName,
( episode = it.episodeNum,
"${it.animeId}, ${it.episodeNum}", // posterUrl = "$imageUrl/main/${it.previewPath}",
episodeName,
episode = it.episodeNum,
posterUrl = "$imageUrl/${it.s3VideoSource.previewPath}",
)
) )
} )
else if(it.videoSource != null) { return@map
// Movie
// Log.d("CakesTwix-Debug", app.get(it.playPath).document.select("source").attr("src"))
episodes.add(Episode
(
"${it.animeId}, ${app.get(it.playPath).document.select("source").attr("src")}",
episodeName,
episode = it.episodeNum,
posterUrl = "$imageUrl/main/${it.videoSource.previewPath}",
)
)
} else {
}
} }
} }
return newAnimeLoadResponse( return newAnimeLoadResponse(
animeJSON.pageProps.title, animeJSON.pageProps.title,
"$mainUrl/$animeID", "$mainUrl/watch?wid=$animeID",
tvType, tvType,
) { ) {
this.posterUrl = "$imageUrl/main/${animeJSON.pageProps.posterId}" this.posterUrl = "$imageUrl/main/${animeJSON.pageProps.posterId}?optimize=image&width=296"
this.engName = animeJSON.pageProps.alternativeTitle this.engName = animeJSON.pageProps.alternativeTitle
this.tags = animeJSON.pageProps.genres.map { it } this.tags = animeJSON.pageProps.genres.map { it }
this.plot = animeJSON.pageProps.description this.plot = animeJSON.pageProps.description
@ -235,32 +217,42 @@ class AniageProvider : MainAPI() {
val animeJSON = Gson().fromJson(app.get("$mainUrl/_next/data/$buildId/watch.json?wid=${dataList[0]}").text, AnimeDetail::class.java) val animeJSON = Gson().fromJson(app.get("$mainUrl/_next/data/$buildId/watch.json?wid=${dataList[0]}").text, AnimeDetail::class.java)
// Parse list, by episode var stringTeam = "$apiUrl/anime/teams/by-ids?"
animeJSON.pageProps.teams.map { teams -> animeJSON.pageProps.teams.map { teams ->
val TeamsList = Gson().fromJson<List<TeamsModel>>(app.get("$apiUrl/anime/teams/by-ids?ids=${teams.teamId}").text, listTeamsModel)[0] stringTeam += "ids=${teams.teamId}&"
// Log.d("CakesTwix-Debug", app.get("https://master.api.aniage.net/anime/episodes?animeId=${dataList[0]}&page=1&pageSize=30&sortOrder=ASC&teamId=${teams.teamId}&volume=1").url) }
Gson().fromJson<List<EpisodesModel>>(app.get("https://master.api.aniage.net/anime/episodes?animeId=${dataList[0]}&page=1&pageSize=30&sortOrder=ASC&teamId=${teams.teamId}&volume=1").text, listEpisodeModel).map { // /anime/teams/by-ids?ids=e6bff5dc-354b-4fda-98b3-c29c12931070&ids=31d156c3-1596-4dd0-8736-a01f7793c5de
// Movie // /anime/teams/by-ids?ids=e6bff5dc-354b-4fda-98b3-c29c12931070ids=31d156c3-1596-4dd0-8736-a01f7793c5deids=c7ea3994-2841-4798-b39d-5d9389409f59
// Log.d("CakesTwix-Debug", dataList[1])
if(dataList[1].toIntOrNull() == null){ // For names
M3u8Helper.generateM3u8( Gson().fromJson<List<TeamsModel>>(app.get(stringTeam).text, listTeamsModel).forEach { teamName ->
source = TeamsList.name, Gson().fromJson<List<EpisodesModel>>(app.get("$apiUrl/anime/episodes?animeId=${dataList[0]}&page=1&pageSize=30&sortOrder=ASC&teamId=${teamName.id}&volume=1").text, listEpisodeModel).map {
streamUrl = dataList[1].replace("}", ""), if(it.episodeNum == dataList[1].toIntOrNull()){
referer = mainUrl when{
).forEach(callback) it.playPath != null ->
return true M3u8Helper.generateM3u8(
} source = teamName.name,
// Episode streamUrl = app.get(it.playPath).document.select("source").attr("src"),
if(it.episodeNum == dataList[1].toInt()){ referer = mainUrl
// Log.d("CakesTwix-Debug", "$videoCdn${it.s3VideoSource.playlistPath}") ).forEach(callback)
M3u8Helper.generateM3u8(
source = TeamsList.name, it.s3VideoSource != null ->
streamUrl = "$videoCdn${it.s3VideoSource.playlistPath}", M3u8Helper.generateM3u8(
referer = mainUrl source = teamName.name,
).forEach(callback) streamUrl = "$videoCdn${it.s3VideoSource.playlistPath}",
referer = apiUrl
).forEach(callback)
it.videoSource != null ->
M3u8Helper.generateM3u8(
source = teamName.name,
streamUrl = app.get(it.videoSource.playPath).document.select("source").attr("src"),
referer = mainUrl
).forEach(callback)
}
} }
} }
} }
return true return true
} }

View file

@ -17,8 +17,8 @@ data class EpisodesModel(
@SerializedName("playPath") val playPath : String, @SerializedName("playPath") val playPath : String,
@SerializedName("title") val title : String, @SerializedName("title") val title : String,
@SerializedName("previewPath") val previewPath : String, @SerializedName("previewPath") val previewPath : String,
@SerializedName("videoSource") val videoSource : VideoSource, @SerializedName("videoSource") val videoSource : VideoSource?,
@SerializedName("s3VideoSource") val s3VideoSource : S3VideoSource @SerializedName("s3VideoSource") val s3VideoSource : S3VideoSource?
) )
data class VideoSource ( data class VideoSource (