SuperStream: Add Latest (#1013)
This commit is contained in:
@ -6,7 +6,7 @@ ext {
|
|||||||
extName = 'SuperStream'
|
extName = 'SuperStream'
|
||||||
pkgNameSuffix = 'en.superstream'
|
pkgNameSuffix = 'en.superstream'
|
||||||
extClass = '.SuperStream'
|
extClass = '.SuperStream'
|
||||||
extVersionCode = 3
|
extVersionCode = 4
|
||||||
libVersion = '13'
|
libVersion = '13'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ class SuperStream : ConfigurableAnimeSource, AnimeHttpSource() {
|
|||||||
|
|
||||||
override val lang = "en"
|
override val lang = "en"
|
||||||
|
|
||||||
override val supportsLatest = false
|
override val supportsLatest = true
|
||||||
|
|
||||||
private val json: Json by injectLazy()
|
private val json: Json by injectLazy()
|
||||||
|
|
||||||
@ -87,6 +87,11 @@ class SuperStream : ConfigurableAnimeSource, AnimeHttpSource() {
|
|||||||
|
|
||||||
override fun episodeListParse(response: Response) = throw Exception("not used")
|
override fun episodeListParse(response: Response) = throw Exception("not used")
|
||||||
|
|
||||||
|
override fun fetchLatestUpdates(page: Int): Observable<AnimesPage> {
|
||||||
|
val animes = superStreamAPI.getLatest(page)
|
||||||
|
return Observable.just(animes)
|
||||||
|
}
|
||||||
|
|
||||||
override fun latestUpdatesParse(response: Response) = throw Exception("not used")
|
override fun latestUpdatesParse(response: Response) = throw Exception("not used")
|
||||||
|
|
||||||
override fun latestUpdatesRequest(page: Int) = throw Exception("not used")
|
override fun latestUpdatesRequest(page: Int) = throw Exception("not used")
|
||||||
@ -143,7 +148,8 @@ class SuperStream : ConfigurableAnimeSource, AnimeHttpSource() {
|
|||||||
}
|
}
|
||||||
ani.description = movie.description
|
ani.description = movie.description
|
||||||
ani.status = SAnime.COMPLETED
|
ani.status = SAnime.COMPLETED
|
||||||
ani.author = movie.writer!!.substringBefore("\n")
|
ani.author = movie.writer!!.substringBefore("\n").split(",").distinct().joinToString { it }
|
||||||
|
ani.artist = movie.director!!.substringBefore("\n").split(",").distinct().joinToString { it }
|
||||||
|
|
||||||
val releasedDate = "Released: "
|
val releasedDate = "Released: "
|
||||||
movie.released?.let { date ->
|
movie.released?.let { date ->
|
||||||
@ -162,7 +168,8 @@ class SuperStream : ConfigurableAnimeSource, AnimeHttpSource() {
|
|||||||
}
|
}
|
||||||
ani.description = it.description
|
ani.description = it.description
|
||||||
ani.status = SAnime.UNKNOWN
|
ani.status = SAnime.UNKNOWN
|
||||||
ani.author = it.writer!!.substringBefore("\n")
|
ani.author = it.writer!!.substringBefore("\n").split(",").distinct().joinToString()
|
||||||
|
ani.artist = it.director!!.substringBefore("\n").split(",").distinct().joinToString()
|
||||||
|
|
||||||
val releasedDate = "Released: "
|
val releasedDate = "Released: "
|
||||||
it.released?.let { date ->
|
it.released?.let { date ->
|
||||||
|
@ -866,10 +866,7 @@ class SuperStreamAPI(val json: Json) {
|
|||||||
private val appId = base64Decode("Y29tLnRkby5zaG93Ym94")
|
private val appId = base64Decode("Y29tLnRkby5zaG93Ym94")
|
||||||
|
|
||||||
fun getMainPage(page: Int): AnimesPage {
|
fun getMainPage(page: Int): AnimesPage {
|
||||||
val json = queryApi(
|
val json = sendQuery(page)
|
||||||
"""{"childmode":"$hideNsfw","app_version":"11.5","appid":"$appId","module":"Home_list_type_v2","channel":"Website","page":"$page","lang":"en","type":"all","pagelimit":"10","expired_date":"${getExpiryDate()}","platform":"android"}
|
|
||||||
""".trimIndent()
|
|
||||||
).body!!.string()
|
|
||||||
val animes = mutableListOf<SAnime>()
|
val animes = mutableListOf<SAnime>()
|
||||||
|
|
||||||
// Cut off the first row (featured)
|
// Cut off the first row (featured)
|
||||||
@ -888,6 +885,31 @@ class SuperStreamAPI(val json: Json) {
|
|||||||
return AnimesPage(animes, animes.isNotEmpty())
|
return AnimesPage(animes, animes.isNotEmpty())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getLatest(page: Int): AnimesPage {
|
||||||
|
val json = sendQuery(page)
|
||||||
|
val animes = mutableListOf<SAnime>()
|
||||||
|
|
||||||
|
parseJson<DataJSON>(json).data.let { it.filter { item -> item.type == "newupload" || item.type == "newupdate" } }
|
||||||
|
.mapNotNull {
|
||||||
|
it.list.mapNotNull second@{ post ->
|
||||||
|
animes.add(
|
||||||
|
SAnime.create().apply {
|
||||||
|
url = LoadData(post.id ?: return@mapNotNull null, post.box_type).toJson()
|
||||||
|
thumbnail_url = post.poster ?: post.poster_2
|
||||||
|
title = post.title ?: return@second null
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return AnimesPage(animes, animes.isNotEmpty())
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun sendQuery(page: Int): String {
|
||||||
|
return queryApi(
|
||||||
|
"""{"childmode":"$hideNsfw","app_version":"11.5","appid":"$appId","module":"Home_list_type_v2","channel":"Website","page":"$page","lang":"en","type":"all","pagelimit":"20","expired_date":"${getExpiryDate()}","platform":"android"}""".trimIndent()
|
||||||
|
).body!!.string()
|
||||||
|
}
|
||||||
|
|
||||||
private fun Data.toSearchResponse(): SAnime? {
|
private fun Data.toSearchResponse(): SAnime? {
|
||||||
val it = this
|
val it = this
|
||||||
return SAnime.create().apply {
|
return SAnime.create().apply {
|
||||||
@ -989,9 +1011,9 @@ class SuperStreamAPI(val json: Json) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e: Error) {}
|
} catch (_: Error) {}
|
||||||
|
|
||||||
linkData.data!!.list.forEach {
|
linkData.data.list.forEach {
|
||||||
if (it.path.isNullOrBlank().not()) {
|
if (it.path.isNullOrBlank().not()) {
|
||||||
val videoUrl = it.path?.replace("\\/", "") ?: ""
|
val videoUrl = it.path?.replace("\\/", "") ?: ""
|
||||||
try {
|
try {
|
||||||
|
Reference in New Issue
Block a user