refactor: Fix some codefactor warnings (#2406)
This commit is contained in:
@ -27,7 +27,7 @@ object JsUnpacker {
|
||||
val count = args[3].toInt()
|
||||
val origList = args[4].split("|")
|
||||
|
||||
val replaceMap = (0..(count - 1)).map {
|
||||
val replaceMap = (0..count - 1).map {
|
||||
val key = convert(base, it)
|
||||
key to try { origList[it] } catch (e: Exception) { key }
|
||||
}.toMap()
|
||||
|
@ -770,9 +770,6 @@ class AutoEmbedExtractor(private val client: OkHttpClient) {
|
||||
videoUrl.contains("rabbitstream") -> {
|
||||
RabbitStreamExtractor(client).videosFromUrl(videoUrl, headers = videoHeaders, prefix = prefix)
|
||||
}
|
||||
videoUrl.contains("mixdrop") -> {
|
||||
MixDropExtractor(client).videoFromUrl(videoUrl, prefix = prefix)
|
||||
}
|
||||
videoUrl.contains("https://dood") -> {
|
||||
DoodExtractor(client).videoFromUrl(videoUrl, server.name, false)
|
||||
?.let(::listOf)
|
||||
@ -863,7 +860,7 @@ class AutoEmbedExtractor(private val client: OkHttpClient) {
|
||||
private fun getCaptchaToken(url: String, key: String): String? {
|
||||
return runCatching {
|
||||
val httpUrl = url.toHttpUrl()
|
||||
val pureDomain = (httpUrl.scheme + "://" + httpUrl.host + ":443")
|
||||
val pureDomain = httpUrl.scheme + "://" + httpUrl.host + ":443"
|
||||
val domain = Base64.encodeToString(pureDomain.encodeToByteArray(), Base64.DEFAULT)
|
||||
.replace("\n", "")
|
||||
.replace("=", ".")
|
||||
|
@ -663,60 +663,59 @@ class Jellyfin(private val suffix: String) : ConfigurableAnimeSource, AnimeHttpS
|
||||
}
|
||||
|
||||
private fun medialibPreference(screen: PreferenceScreen) =
|
||||
(
|
||||
object : MediaLibPreference(screen.context) {
|
||||
override fun reload() {
|
||||
this.apply {
|
||||
key = JFConstants.MEDIALIB_KEY
|
||||
title = JFConstants.MEDIALIB_TITLE
|
||||
summary = "%s"
|
||||
object : MediaLibPreference(screen.context) {
|
||||
override fun reload() {
|
||||
this.apply {
|
||||
key = JFConstants.MEDIALIB_KEY
|
||||
title = JFConstants.MEDIALIB_TITLE
|
||||
summary = "%s"
|
||||
|
||||
Thread {
|
||||
try {
|
||||
val mediaLibsResponse = client.newCall(
|
||||
GET("$baseUrl/Users/$userId/Items?api_key=$apiKey"),
|
||||
).execute()
|
||||
val mediaJson = mediaLibsResponse.body.let { json.decodeFromString<ItemsResponse>(it.string()) }?.Items
|
||||
Thread {
|
||||
try {
|
||||
val mediaLibsResponse = client.newCall(
|
||||
GET("$baseUrl/Users/$userId/Items?api_key=$apiKey"),
|
||||
).execute()
|
||||
val mediaJson = mediaLibsResponse.body.let { json.decodeFromString<ItemsResponse>(it.string()) }?.Items
|
||||
|
||||
val entriesArray = mutableListOf<String>()
|
||||
val entriesValueArray = mutableListOf<String>()
|
||||
val entriesArray = mutableListOf<String>()
|
||||
val entriesValueArray = mutableListOf<String>()
|
||||
|
||||
if (mediaJson != null) {
|
||||
for (media in mediaJson) {
|
||||
entriesArray.add(media.Name)
|
||||
entriesValueArray.add(media.Id)
|
||||
}
|
||||
if (mediaJson != null) {
|
||||
for (media in mediaJson) {
|
||||
entriesArray.add(media.Name)
|
||||
entriesValueArray.add(media.Id)
|
||||
}
|
||||
|
||||
entries = entriesArray.toTypedArray()
|
||||
entryValues = entriesValueArray.toTypedArray()
|
||||
} catch (ex: Exception) {
|
||||
entries = emptyArray()
|
||||
entryValues = emptyArray()
|
||||
}
|
||||
}.start()
|
||||
|
||||
setOnPreferenceChangeListener { _, newValue ->
|
||||
val selected = newValue as String
|
||||
val index = findIndexOfValue(selected)
|
||||
val entry = entryValues[index] as String
|
||||
parentId = entry
|
||||
preferences.edit().putString(key, entry).commit()
|
||||
entries = entriesArray.toTypedArray()
|
||||
entryValues = entriesValueArray.toTypedArray()
|
||||
} catch (ex: Exception) {
|
||||
entries = emptyArray()
|
||||
entryValues = emptyArray()
|
||||
}
|
||||
}.start()
|
||||
|
||||
setOnPreferenceChangeListener { _, newValue ->
|
||||
val selected = newValue as String
|
||||
val index = findIndexOfValue(selected)
|
||||
val entry = entryValues[index] as String
|
||||
parentId = entry
|
||||
preferences.edit().putString(key, entry).commit()
|
||||
}
|
||||
}
|
||||
}
|
||||
).apply { reload() }
|
||||
}.apply { reload() }
|
||||
|
||||
private fun getSummary(isPassword: Boolean, value: String, placeholder: String) = when {
|
||||
isPassword && value.isNotEmpty() || !isPassword && value.isEmpty() -> placeholder
|
||||
else -> value
|
||||
}
|
||||
|
||||
private fun PreferenceScreen.editTextPreference(key: String, title: String, default: String, value: String, isPassword: Boolean = false, placeholder: String, mediaLibPref: MediaLibPreference): EditTextPreference {
|
||||
return EditTextPreference(context).apply {
|
||||
this.key = key
|
||||
this.title = title
|
||||
summary = if ((isPassword && value.isNotEmpty()) || (!isPassword && value.isEmpty())) {
|
||||
placeholder
|
||||
} else {
|
||||
value
|
||||
}
|
||||
summary = getSummary(isPassword, value, placeholder)
|
||||
this.setDefaultValue(default)
|
||||
dialogTitle = title
|
||||
|
||||
@ -732,11 +731,7 @@ class Jellyfin(private val suffix: String) : ConfigurableAnimeSource, AnimeHttpS
|
||||
try {
|
||||
val newValueString = newValue as String
|
||||
val res = preferences.edit().putString(key, newValueString).commit()
|
||||
summary = if ((isPassword && newValueString.isNotEmpty()) || (!isPassword && newValueString.isEmpty())) {
|
||||
placeholder
|
||||
} else {
|
||||
newValueString
|
||||
}
|
||||
summary = getSummary(isPassword, newValueString, placeholder)
|
||||
val loginRes = login(true, context)
|
||||
if (loginRes == true) {
|
||||
mediaLibPref.reload()
|
||||
|
@ -379,7 +379,7 @@ class Yomiroll : ConfigurableAnimeSource, AnimeHttpSource() {
|
||||
}
|
||||
) +
|
||||
(
|
||||
if ((series_metadata?.audio_locales?.size ?: 0) > 1 ||
|
||||
if (series_metadata?.audio_locales?.size ?: 0 > 1 ||
|
||||
movie_metadata?.is_dubbed == true
|
||||
) {
|
||||
" Dub"
|
||||
@ -501,33 +501,31 @@ class Yomiroll : ConfigurableAnimeSource, AnimeHttpSource() {
|
||||
}
|
||||
|
||||
private fun localSubsPreference(screen: PreferenceScreen) =
|
||||
(
|
||||
object : LocalSubsPreference(screen.context) {
|
||||
override fun reload() {
|
||||
this.apply {
|
||||
key = PREF_USE_LOCAL_TOKEN_KEY
|
||||
title = PREF_USE_LOCAL_TOKEN_TITLE
|
||||
summary = runBlocking {
|
||||
withContext(Dispatchers.IO) { getTokenDetail() }
|
||||
}
|
||||
setDefaultValue(false)
|
||||
setOnPreferenceChangeListener { _, newValue ->
|
||||
val new = newValue as Boolean
|
||||
preferences.edit().putBoolean(key, new).commit().also {
|
||||
Thread {
|
||||
summary = runBlocking {
|
||||
withContext(Dispatchers.IO) { getTokenDetail(true) }
|
||||
}
|
||||
}.start()
|
||||
}
|
||||
object : LocalSubsPreference(screen.context) {
|
||||
override fun reload() {
|
||||
this.apply {
|
||||
key = PREF_USE_LOCAL_TOKEN_KEY
|
||||
title = PREF_USE_LOCAL_TOKEN_TITLE
|
||||
summary = runBlocking {
|
||||
withContext(Dispatchers.IO) { getTokenDetail() }
|
||||
}
|
||||
setDefaultValue(false)
|
||||
setOnPreferenceChangeListener { _, newValue ->
|
||||
val new = newValue as Boolean
|
||||
preferences.edit().putBoolean(key, new).commit().also {
|
||||
Thread {
|
||||
summary = runBlocking {
|
||||
withContext(Dispatchers.IO) { getTokenDetail(true) }
|
||||
}
|
||||
}.start()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
).apply { reload() }
|
||||
}.apply { reload() }
|
||||
|
||||
// From Dopebox
|
||||
private fun <A, B> Iterable<A>.parallelMap(f: suspend (A) -> B): List<B> =
|
||||
private inline fun <A, B> Iterable<A>.parallelMap(crossinline f: suspend (A) -> B): List<B> =
|
||||
runBlocking {
|
||||
map { async(Dispatchers.Default) { f(it) } }.awaitAll()
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ class Akwam : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
episode.setUrlWithoutDomain(element.attr("href"))
|
||||
episode.name = element.text()
|
||||
episode.episode_number = when {
|
||||
(epNum.isNotEmpty()) -> epNum.toFloat()
|
||||
epNum.isNotEmpty() -> epNum.toFloatOrNull() ?: 1F
|
||||
else -> 1F
|
||||
}
|
||||
return episode
|
||||
|
@ -97,7 +97,7 @@ class Anime4Up : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
episode.setUrlWithoutDomain(element.select("div.episodes-card-container div.episodes-card div.ehover6 h3 a").attr("href"))
|
||||
// episode.episode_number = element.select("span:nth-child(3)").text().replace(" - ", "").toFloat()
|
||||
episode.episode_number = when {
|
||||
(epNum.isNotEmpty()) -> epNum.toFloat()
|
||||
epNum.isNotEmpty() -> epNum.toFloatOrNull() ?: 1F
|
||||
else -> 1F
|
||||
}
|
||||
episode.name = element.select("div.episodes-card-container div.episodes-card div.ehover6 h3 a").text()
|
||||
|
@ -1,33 +0,0 @@
|
||||
package eu.kanade.tachiyomi.animeextension.ar.anime4up.extractors
|
||||
|
||||
import android.util.Log
|
||||
import eu.kanade.tachiyomi.animesource.model.Video
|
||||
import eu.kanade.tachiyomi.network.GET
|
||||
import eu.kanade.tachiyomi.util.asJsoup
|
||||
import okhttp3.Headers
|
||||
import okhttp3.OkHttpClient
|
||||
|
||||
class MoshahdaExtractor(private val client: OkHttpClient) {
|
||||
fun videosFromUrl(url: String, headers: Headers): List<Video> {
|
||||
val callPlayer = client.newCall(GET(url, headers)).execute().asJsoup()
|
||||
Log.i("embeddd", "$callPlayer")
|
||||
|
||||
val data = callPlayer.data().substringAfter("sources: [").substringBefore("],")
|
||||
val sources = data.split("file: \"").drop(1)
|
||||
val videoList = mutableListOf<Video>()
|
||||
for (source in sources) {
|
||||
val masterUrl = source.substringBefore("\"}")
|
||||
val masterPlaylist = client.newCall(GET(masterUrl)).execute().body.string()
|
||||
val videoList = mutableListOf<Video>()
|
||||
masterPlaylist.substringAfter("#EXT-X-STREAM-INF:").split("#EXT-X-STREAM-INF:")
|
||||
.forEach {
|
||||
val quality = it.substringAfter("RESOLUTION=").substringAfter("x")
|
||||
.substringBefore(",") + "p"
|
||||
val videoUrl = it.substringAfter("\n").substringBefore("\n")
|
||||
videoList.add(Video(videoUrl, quality, videoUrl))
|
||||
}
|
||||
return videoList
|
||||
}
|
||||
return videoList
|
||||
}
|
||||
}
|
@ -131,7 +131,7 @@ class AnimeBlkom : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
val eptitle = element.selectFirst("span:nth-child(3)")!!.text()
|
||||
val epNum = eptitle.filter { it.isDigit() }
|
||||
episode_number = when {
|
||||
(epNum.isNotEmpty()) -> epNum.toFloatOrNull() ?: 1F
|
||||
epNum.isNotEmpty() -> epNum.toFloatOrNull() ?: 1F
|
||||
else -> 1F
|
||||
}
|
||||
name = eptitle + " :" + element.selectFirst("span:nth-child(1)")!!.text()
|
||||
|
@ -68,7 +68,7 @@ class AnimeLek : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
name = text
|
||||
val epNum = text.filter { it.isDigit() }
|
||||
episode_number = when {
|
||||
(epNum.isNotEmpty()) -> epNum.toFloatOrNull() ?: 1F
|
||||
epNum.isNotEmpty() -> epNum.toFloatOrNull() ?: 1F
|
||||
else -> 1F
|
||||
}
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ class MyCima : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
episode.setUrlWithoutDomain(if (type == "mSeries") element.select("a").attr("href") else element.attr("abs:href"))
|
||||
if (type == "series") {
|
||||
episode.episode_number = when {
|
||||
(epNum.isNotEmpty()) -> epNum.toFloat()
|
||||
epNum.isNotEmpty() -> epNum.toFloatOrNull() ?: 1F
|
||||
else -> 1F
|
||||
}
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ class Okanime : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
}
|
||||
|
||||
override fun searchAnimeRequest(page: Int, query: String, filters: AnimeFilterList) =
|
||||
("$baseUrl/search/?s=$query")
|
||||
"$baseUrl/search/?s=$query"
|
||||
.let { if (page > 1) "$it&page=$page" else it }
|
||||
.let(::GET)
|
||||
|
||||
@ -165,7 +165,7 @@ class Okanime : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
private fun extractVideosFromUrl(url: String, quality: String, selection: Set<String>): List<Video> {
|
||||
return runCatching {
|
||||
when {
|
||||
("https://doo" in url && "/e/" in url) && selection.contains("Dood") -> {
|
||||
"https://doo" in url && "/e/" in url && selection.contains("Dood") -> {
|
||||
doodExtractor.videoFromUrl(url, "DoodStream - $quality")
|
||||
?.let(::listOf)
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ class XsAnime : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
episode.setUrlWithoutDomain(element.attr("abs:href"))
|
||||
episode.name = element.select("a > em").text()
|
||||
episode.episode_number = when {
|
||||
(epNum.isNotEmpty()) -> epNum.toFloat()
|
||||
epNum.isNotEmpty() -> epNum.toFloatOrNull() ?: 1F
|
||||
else -> 1F
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ class JsUnpacker(packedJS: String?) {
|
||||
*/
|
||||
fun unpack(): String? {
|
||||
val js = packedJS
|
||||
try {
|
||||
runCatching {
|
||||
var p =
|
||||
Pattern.compile("""\}\s*\('(.*)',\s*(.*?),\s*(\d+),\s*'(.*?)'\.split\('\|'\)""", Pattern.DOTALL)
|
||||
var m = p.matcher(js)
|
||||
@ -35,16 +35,8 @@ class JsUnpacker(packedJS: String?) {
|
||||
val radixStr = m.group(2)
|
||||
val countStr = m.group(3)
|
||||
val symtab = m.group(4).split("\\|".toRegex()).toTypedArray()
|
||||
var radix = 36
|
||||
var count = 0
|
||||
try {
|
||||
radix = radixStr.toInt()
|
||||
} catch (e: Exception) {
|
||||
}
|
||||
try {
|
||||
count = countStr.toInt()
|
||||
} catch (e: Exception) {
|
||||
}
|
||||
val radix = radixStr.toIntOrNull() ?: 36
|
||||
val count = countStr.toIntOrNull() ?: 0
|
||||
if (symtab.size != count) {
|
||||
throw Exception("Unknown p.a.c.k.e.r. encoding")
|
||||
}
|
||||
@ -67,7 +59,6 @@ class JsUnpacker(packedJS: String?) {
|
||||
}
|
||||
return decoded.toString()
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ class JsUnpacker(packedJS: String?) {
|
||||
*/
|
||||
fun unpack(): String? {
|
||||
val js = packedJS
|
||||
try {
|
||||
runCatching {
|
||||
var p =
|
||||
Pattern.compile("""\}\s*\('(.*)',\s*(.*?),\s*(\d+),\s*'(.*?)'\.split\('\|'\)""", Pattern.DOTALL)
|
||||
var m = p.matcher(js)
|
||||
@ -35,16 +35,8 @@ class JsUnpacker(packedJS: String?) {
|
||||
val radixStr = m.group(2)
|
||||
val countStr = m.group(3)
|
||||
val symtab = m.group(4).split("\\|".toRegex()).toTypedArray()
|
||||
var radix = 36
|
||||
var count = 0
|
||||
try {
|
||||
radix = radixStr.toInt()
|
||||
} catch (e: Exception) {
|
||||
}
|
||||
try {
|
||||
count = countStr.toInt()
|
||||
} catch (e: Exception) {
|
||||
}
|
||||
val radix = radixStr.toIntOrNull() ?: 36
|
||||
val count = countStr.toIntOrNull() ?: 0
|
||||
if (symtab.size != count) {
|
||||
throw Exception("Unknown p.a.c.k.e.r. encoding")
|
||||
}
|
||||
@ -67,7 +59,6 @@ class JsUnpacker(packedJS: String?) {
|
||||
}
|
||||
return decoded.toString()
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ class MoflixStream : ConfigurableAnimeSource, AnimeHttpSource() {
|
||||
val pagination = response.parseAs<PopularPaginationDto>().pagination
|
||||
|
||||
val animeList = pagination.data.parseItems()
|
||||
val hasNextPage = pagination.current_page < (pagination.next_page ?: 1)
|
||||
val hasNextPage = pagination.current_page < pagination.next_page ?: 1
|
||||
return AnimesPage(animeList, hasNextPage)
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ class StreamCloud : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
when {
|
||||
li.text().contains("streamtape.com") && hosterSelection?.contains("stape") == true -> {
|
||||
val url = li.attr("data-link")
|
||||
try {
|
||||
runCatching {
|
||||
with(
|
||||
client.newCall(GET(url, headers = Headers.headersOf("Referer", baseUrl, "Cookie", "Fuck Streamtape because they add concatenation to fuck up scrapers")))
|
||||
.execute().asJsoup(),
|
||||
@ -108,7 +108,6 @@ class StreamCloud : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
videoList.add(Video(videoUrl, quality, videoUrl))
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -430,7 +430,9 @@ class AllAnime : ConfigurableAnimeSource, AnimeHttpSource() {
|
||||
.toByteArray().map {
|
||||
(it.toInt() xor 56).toChar()
|
||||
}.joinToString("")
|
||||
} else this
|
||||
} else {
|
||||
this
|
||||
}
|
||||
}
|
||||
|
||||
private fun prioritySort(pList: List<Pair<Video, Float>>): List<Video> {
|
||||
|
@ -188,7 +188,7 @@ class AllAnimeExtractor(private val client: OkHttpClient, private val headers: H
|
||||
if (videos != null) {
|
||||
videoList.addAll(videos)
|
||||
}
|
||||
} else {}
|
||||
}
|
||||
}
|
||||
|
||||
return videoList
|
||||
|
@ -68,7 +68,7 @@ class Animension() : ConfigurableAnimeSource, AnimeHttpSource() {
|
||||
|
||||
// Episode
|
||||
override fun episodeListRequest(anime: SAnime): Request {
|
||||
return (GET("$apiUrl/episodes.php?id=${anime.url}", headers))
|
||||
return GET("$apiUrl/episodes.php?id=${anime.url}", headers)
|
||||
}
|
||||
|
||||
override fun episodeListParse(response: Response): List<SEpisode> {
|
||||
|
@ -218,12 +218,12 @@ class AnimePahe : ConfigurableAnimeSource, AnimeHttpSource() {
|
||||
val subPreference = preferences.getString(PREF_SUB_KEY, PREF_SUB_DEFAULT)!!
|
||||
val quality = preferences.getString(PREF_QUALITY_KEY, PREF_QUALITY_DEFAULT)!!
|
||||
val shouldBeAv1 = preferences.getBoolean(PREF_AV1_KEY, PREF_AV1_DEFAULT)
|
||||
val shouldEndWithEng = (subPreference == "eng")
|
||||
val shouldEndWithEng = subPreference == "eng"
|
||||
|
||||
return this.sortedWith(
|
||||
compareBy(
|
||||
{ it.quality.contains(quality) },
|
||||
{ (Regex("""\beng\b""").find(it.quality.lowercase()) != null) == shouldEndWithEng },
|
||||
{ Regex("""\beng\b""").containsMatchIn(it.quality.lowercase()) == shouldEndWithEng },
|
||||
{ it.quality.lowercase().contains("av1") == shouldBeAv1 },
|
||||
),
|
||||
).reversed()
|
||||
|
@ -65,7 +65,7 @@ class KwikExtractor(private val client: OkHttpClient) {
|
||||
.header("location")!!.substringAfterLast("https://")
|
||||
val fContent =
|
||||
client.newCall(GET(kwikUrl, Headers.headersOf("referer", "https://kwik.cx/"))).execute()
|
||||
cookies += (fContent.header("set-cookie")!!)
|
||||
cookies += fContent.header("set-cookie")!!
|
||||
val fContentString = fContent.body.string()
|
||||
|
||||
val (fullString, key, v1, v2) = kwikParamsRegex.find(fContentString)!!.destructured
|
||||
@ -138,12 +138,10 @@ class KwikExtractor(private val client: OkHttpClient) {
|
||||
var acc: Long = 0
|
||||
|
||||
for ((n, i) in content.reversed().withIndex()) {
|
||||
acc += (
|
||||
when (isNumber("$i")) {
|
||||
true -> "$i".toLong()
|
||||
false -> "0".toLong()
|
||||
}
|
||||
) * s1.toDouble().pow(n.toDouble()).toInt()
|
||||
acc += when (isNumber("$i")) {
|
||||
true -> "$i".toLong()
|
||||
false -> 0L
|
||||
} * s1.toDouble().pow(n.toDouble()).toInt()
|
||||
}
|
||||
|
||||
var k = ""
|
||||
|
@ -102,7 +102,7 @@ class AsianLoad : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
val epNum = element.selectFirst("div.name")!!.text().substringAfter("Episode ")
|
||||
name = element.selectFirst("div.type span")!!.text() + " Episode: $epNum"
|
||||
episode_number = when {
|
||||
(epNum.isNotEmpty()) -> epNum.toFloatOrNull() ?: 1F
|
||||
epNum.isNotEmpty() -> epNum.toFloatOrNull() ?: 1F
|
||||
else -> 1F
|
||||
}
|
||||
date_upload = element.selectFirst("span.date")?.text()?.toDate() ?: 0L
|
||||
|
@ -125,7 +125,7 @@ class DramaCool : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
setUrlWithoutDomain(element.attr("abs:href"))
|
||||
name = element.select("span.type").text() + ": Episode " + element.select("h3").text().substringAfter("Episode ")
|
||||
episode_number = when {
|
||||
(epNum.isNotEmpty()) -> epNum.toFloat()
|
||||
epNum.isNotEmpty() -> epNum.toFloatOrNull() ?: 1F
|
||||
else -> 1F
|
||||
}
|
||||
date_upload = parseDate(element.select("span.time").text())
|
||||
@ -171,13 +171,6 @@ class DramaCool : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
videoList.add(video)
|
||||
}
|
||||
}
|
||||
|
||||
url.contains("streamtape") -> {
|
||||
val video = StreamTapeExtractor(client).videoFromUrl(url)
|
||||
if (video != null) {
|
||||
videoList.add(video)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return videoList
|
||||
|
@ -96,7 +96,7 @@ class HentaiMama : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
.add("action", "get_player_contents")
|
||||
.add(
|
||||
"a",
|
||||
(document.select("#post_report input:nth-child(5)").attr("value")).toString(),
|
||||
document.selectFirst("#post_report input:nth-child(5)")?.attr("value").toString(),
|
||||
)
|
||||
.build()
|
||||
|
||||
@ -196,7 +196,7 @@ class HentaiMama : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
val parameters = getSearchParameters(filters)
|
||||
return if (query.isNotEmpty()) {
|
||||
filterSearch = false
|
||||
GET("$baseUrl/page/$page/?s=${query.replace(("[\\W]").toRegex(), " ")}") // regular search
|
||||
GET("$baseUrl/page/$page/?s=${query.replace(Regex("[\\W]"), " ")}") // regular search
|
||||
} else {
|
||||
filterSearch = true
|
||||
GET("$baseUrl/advance-search/page/$page/?$parameters") // filter search
|
||||
|
@ -44,7 +44,7 @@ class KickAssAnimeExtractor(
|
||||
fun videosFromUrl(url: String, name: String): List<Video> {
|
||||
val host = url.toHttpUrl().host
|
||||
val mid = if (name == "DuckStream") "mid" else "id"
|
||||
val isBird = (name == "BirdStream")
|
||||
val isBird = name == "BirdStream"
|
||||
|
||||
val query = url.toHttpUrl().queryParameter(mid)!!
|
||||
|
||||
@ -134,7 +134,7 @@ class KickAssAnimeExtractor(
|
||||
}
|
||||
|
||||
val cid = String(html.substringAfter("cid: '").substringBefore("'").decodeHex()).split("|")
|
||||
val timeStamp = ((System.currentTimeMillis() / 1000) + 60).toString()
|
||||
val timeStamp = (System.currentTimeMillis() / 1000 + 60).toString()
|
||||
val route = cid[1].replace("player.php", "source.php")
|
||||
|
||||
val signature = buildString {
|
||||
|
@ -27,7 +27,6 @@ class YouTubeExtractor(private val client: OkHttpClient) {
|
||||
|
||||
fun videosFromUrl(url: String, prefix: String): List<Video> {
|
||||
// Ported from https://github.com/dermasmid/scrapetube/blob/master/scrapetube/scrapetube.py
|
||||
// TODO: Make code prettier
|
||||
// GET KEY
|
||||
var ytcfgString = ""
|
||||
val videoId = url.substringAfter("/embed/").substringBefore("?")
|
||||
@ -97,7 +96,7 @@ class YouTubeExtractor(private val client: OkHttpClient) {
|
||||
// Get Audio
|
||||
for (format in formats) {
|
||||
if (format.jsonObject["mimeType"]!!.jsonPrimitive.content.startsWith("audio/webm")) {
|
||||
try {
|
||||
runCatching {
|
||||
audioTracks.add(
|
||||
Track(
|
||||
format.jsonObject["url"]!!.jsonPrimitive.content,
|
||||
@ -105,7 +104,7 @@ class YouTubeExtractor(private val client: OkHttpClient) {
|
||||
" (${formatBits(format.jsonObject["averageBitrate"]!!.jsonPrimitive.long)}ps)",
|
||||
),
|
||||
)
|
||||
} catch (a: Exception) { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -118,15 +117,14 @@ class YouTubeExtractor(private val client: OkHttpClient) {
|
||||
|
||||
for (caption in captionTracks) {
|
||||
val captionJson = caption.jsonObject
|
||||
try {
|
||||
runCatching {
|
||||
subtitleTracks.add(
|
||||
Track(
|
||||
// TODO: Would replacing srv3 with vtt work for every video?
|
||||
captionJson["baseUrl"]!!.jsonPrimitive.content.replace("srv3", "vtt"),
|
||||
captionJson["name"]!!.jsonObject["runs"]!!.jsonArray[0].jsonObject["text"]!!.jsonPrimitive.content,
|
||||
),
|
||||
)
|
||||
} catch (a: Exception) { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -94,7 +94,7 @@ class MyRunningMan : ParsedAnimeHttpSource() {
|
||||
title = it.label
|
||||
thumbnail_url = buildString {
|
||||
append("$baseUrl/assets/epimg/${it.value.padStart(3, '0')}")
|
||||
if ((it.value.toIntOrNull() ?: 1) > 396) append("_temp")
|
||||
if (it.value.toIntOrNull() ?: 1 > 396) append("_temp")
|
||||
append(".jpg")
|
||||
}
|
||||
}
|
||||
|
@ -1,88 +0,0 @@
|
||||
package eu.kanade.tachiyomi.animeextension.en.putlocker;
|
||||
|
||||
public class JSONUtil {
|
||||
public static String escape(String input) {
|
||||
StringBuilder output = new StringBuilder();
|
||||
|
||||
for(int i=0; i<input.length(); i++) {
|
||||
char ch = input.charAt(i);
|
||||
int chx = (int) ch;
|
||||
|
||||
// let's not put any nulls in our strings
|
||||
assert(chx != 0);
|
||||
|
||||
if(ch == '\n') {
|
||||
output.append("\\n");
|
||||
} else if(ch == '\t') {
|
||||
output.append("\\t");
|
||||
} else if(ch == '\r') {
|
||||
output.append("\\r");
|
||||
} else if(ch == '\\') {
|
||||
output.append("\\\\");
|
||||
} else if(ch == '"') {
|
||||
output.append("\\\"");
|
||||
} else if(ch == '\b') {
|
||||
output.append("\\b");
|
||||
} else if(ch == '\f') {
|
||||
output.append("\\f");
|
||||
} else if(chx >= 0x10000) {
|
||||
assert false : "Java stores as u16, so it should never give us a character that's bigger than 2 bytes. It literally can't.";
|
||||
} else if(chx > 127) {
|
||||
output.append(String.format("\\u%04x", chx));
|
||||
} else {
|
||||
output.append(ch);
|
||||
}
|
||||
}
|
||||
|
||||
return output.toString();
|
||||
}
|
||||
|
||||
public static String unescape(String input) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
int i = 0;
|
||||
while (i < input.length()) {
|
||||
char delimiter = input.charAt(i); i++; // consume letter or backslash
|
||||
|
||||
if(delimiter == '\\' && i < input.length()) {
|
||||
|
||||
// consume first after backslash
|
||||
char ch = input.charAt(i); i++;
|
||||
|
||||
if(ch == '\\' || ch == '/' || ch == '"' || ch == '\'') {
|
||||
builder.append(ch);
|
||||
}
|
||||
else if(ch == 'n') builder.append('\n');
|
||||
else if(ch == 'r') builder.append('\r');
|
||||
else if(ch == 't') builder.append('\t');
|
||||
else if(ch == 'b') builder.append('\b');
|
||||
else if(ch == 'f') builder.append('\f');
|
||||
else if(ch == 'u') {
|
||||
|
||||
StringBuilder hex = new StringBuilder();
|
||||
|
||||
// expect 4 digits
|
||||
if (i+4 > input.length()) {
|
||||
throw new RuntimeException("Not enough unicode digits! ");
|
||||
}
|
||||
for (char x : input.substring(i, i + 4).toCharArray()) {
|
||||
if(!Character.isLetterOrDigit(x)) {
|
||||
throw new RuntimeException("Bad character in unicode escape.");
|
||||
}
|
||||
hex.append(Character.toLowerCase(x));
|
||||
}
|
||||
i+=4; // consume those four digits.
|
||||
|
||||
int code = Integer.parseInt(hex.toString(), 16);
|
||||
builder.append((char) code);
|
||||
} else {
|
||||
throw new RuntimeException("Illegal escape sequence: \\"+ch);
|
||||
}
|
||||
} else { // it's not a backslash, or it's the last character.
|
||||
builder.append(delimiter);
|
||||
}
|
||||
}
|
||||
|
||||
return builder.toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
package eu.kanade.tachiyomi.animeextension.en.putlocker
|
||||
|
||||
object JSONUtil {
|
||||
fun escape(input: String): String {
|
||||
val output = StringBuilder()
|
||||
|
||||
for (ch in input) {
|
||||
// let's not put any nulls in our strings
|
||||
val charInt = ch.code
|
||||
assert(charInt != 0)
|
||||
|
||||
// 0x10000 = 65536 = 2^16 = u16 max value
|
||||
assert(charInt < 0x10000) { "Java stores as u16, so it should never give us a character that's bigger than 2 bytes. It literally can't." }
|
||||
|
||||
val escapedChar = when (ch) {
|
||||
'\b' -> "\\b"
|
||||
'\u000C' -> "\\f" // '\u000C' == '\f', Kotlin doesnt support \f
|
||||
'\n' -> "\\n"
|
||||
'\r' -> "\\r"
|
||||
'\t' -> "\\t"
|
||||
'\\' -> "\\\\"
|
||||
'"' -> "\\\""
|
||||
else -> {
|
||||
if (charInt > 127) {
|
||||
String.format("\\u%04x", charInt)
|
||||
} else {
|
||||
ch
|
||||
}
|
||||
}
|
||||
}
|
||||
output.append(escapedChar)
|
||||
}
|
||||
return output.toString()
|
||||
}
|
||||
|
||||
fun unescape(input: String): String {
|
||||
val builder = StringBuilder()
|
||||
|
||||
var index = 0
|
||||
while (index < input.length) {
|
||||
val delimiter = input.get(index) // consume letter or backslash
|
||||
index++
|
||||
|
||||
if (delimiter == '\\' && index < input.length) {
|
||||
// consume first after backslash
|
||||
val ch = input.get(index)
|
||||
index++
|
||||
|
||||
val unescaped = when (ch) {
|
||||
'\\', '/', '"', '\'' -> ch // "
|
||||
'b' -> '\b'
|
||||
'f' -> '\u000C' // '\f' in java
|
||||
'n' -> '\n'
|
||||
'r' -> '\r'
|
||||
't' -> '\t'
|
||||
'u' -> {
|
||||
if (index + 4 > input.length) {
|
||||
throw RuntimeException("Not enough unicode digits!")
|
||||
}
|
||||
val hex = input.substring(index, index + 4)
|
||||
if (hex.any { !it.isLetterOrDigit() }) {
|
||||
throw RuntimeException("Bad character in unicode escape.")
|
||||
}
|
||||
hex.toInt(16).toChar()
|
||||
}
|
||||
else -> throw RuntimeException("Illegal escape sequence: \\" + ch)
|
||||
}
|
||||
builder.append(unescaped)
|
||||
} else {
|
||||
builder.append(delimiter)
|
||||
}
|
||||
}
|
||||
|
||||
return builder.toString()
|
||||
}
|
||||
}
|
@ -955,20 +955,20 @@ class SuperStreamAPI(val json: Json) {
|
||||
if (isMovie) { // 1 = Movie
|
||||
val apiQuery =
|
||||
"""{"childmode":"$hideNsfw","uid":"","app_version":"11.5","appid":"$appId","module":"Movie_detail","channel":"Website","mid":"${loadData.id}","lang":"en","expired_date":"${getExpiryDate()}","platform":"android","oss":"","group":""}"""
|
||||
val data = (queryApiParsed<MovieDataProp>(apiQuery, altApi)).data
|
||||
val data = queryApiParsed<MovieDataProp>(apiQuery, altApi).data
|
||||
?: throw RuntimeException("API error")
|
||||
|
||||
return Pair(data, Pair(null, null))
|
||||
} else { // 2 Series
|
||||
val apiQuery =
|
||||
"""{"childmode":"$hideNsfw","uid":"","app_version":"11.5","appid":"$appId","module":"TV_detail_1","display_all":"1","channel":"Website","lang":"en","expired_date":"${getExpiryDate()}","platform":"android","tid":"${loadData.id}"}"""
|
||||
val data = (queryApiParsed<SeriesDataProp>(apiQuery, altApi)).data
|
||||
val data = queryApiParsed<SeriesDataProp>(apiQuery, altApi).data
|
||||
?: throw RuntimeException("API error")
|
||||
|
||||
val episodes = data.season.mapNotNull {
|
||||
val seasonQuery =
|
||||
"""{"childmode":"$hideNsfw","app_version":"11.5","year":"0","appid":"$appId","module":"TV_episode","display_all":"1","channel":"Website","season":"$it","lang":"en","expired_date":"${getExpiryDate()}","platform":"android","tid":"${loadData.id}"}"""
|
||||
(queryApiParsed<SeriesSeasonProp>(seasonQuery)).data
|
||||
queryApiParsed<SeriesSeasonProp>(seasonQuery).data
|
||||
}.flatten().reversed()
|
||||
|
||||
return Pair(null, Pair(data, episodes))
|
||||
|
@ -180,7 +180,7 @@ class UHDMovies : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
}.mapIndexed { index, linkElement ->
|
||||
val episode = linkElement?.text()
|
||||
?.replace("Episode", "", true)
|
||||
?.trim()?.toIntOrNull() ?: (index + 1)
|
||||
?.trim()?.toIntOrNull() ?: index + 1
|
||||
Triple(
|
||||
season + "_$episode" + "_$part",
|
||||
linkElement?.attr("href") ?: return@mapIndexed null,
|
||||
|
@ -108,7 +108,7 @@ class Wcofun : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
val ep = epName.substringAfter("Episode ")
|
||||
val seasonNum = season.substringBefore(" ").toIntOrNull() ?: 1
|
||||
val epNum = ep.substringBefore(" ").toIntOrNull() ?: 1
|
||||
episode_number = ((seasonNum * 100) + epNum).toFloat()
|
||||
episode_number = (seasonNum * 100 + epNum).toFloat()
|
||||
name = "Season $seasonNum - Episode $epNum"
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ class WCOStream : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
episode.setUrlWithoutDomain(element.select("a").attr("href").toHttpUrl().encodedPath)
|
||||
episode.name = "Episode: " + element.select("a").text()
|
||||
episode.episode_number = when {
|
||||
(epNum.isNotEmpty()) -> epNum.toFloat()
|
||||
epNum.isNotEmpty() -> epNum.toFloatOrNull() ?: 1F
|
||||
else -> 1F
|
||||
}
|
||||
return episode
|
||||
|
@ -342,7 +342,7 @@ class Animefenix : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
override fun setupPreferenceScreen(screen: PreferenceScreen) {
|
||||
val qualities = arrayOf(
|
||||
"Okru:1080p", "Okru:720p", "Okru:480p", "Okru:360p", "Okru:240p", "Okru:144p", // Okru
|
||||
"Amazon", "AmazonES", "StreamTape", "Fireload", "Mp4upload", "YourUpload", "StreamWish"
|
||||
"Amazon", "AmazonES", "StreamTape", "Fireload", "Mp4upload", "YourUpload", "StreamWish",
|
||||
)
|
||||
val videoQualityPref = ListPreference(screen.context).apply {
|
||||
key = "preferred_quality"
|
||||
|
@ -26,7 +26,7 @@ class JsUnpacker(packedJS: String?) {
|
||||
*/
|
||||
fun unpack(): String? {
|
||||
val js = packedJS
|
||||
try {
|
||||
runCatching {
|
||||
var p =
|
||||
Pattern.compile("""\}\s*\('(.*)',\s*(.*?),\s*(\d+),\s*'(.*?)'\.split\('\|'\)""", Pattern.DOTALL)
|
||||
var m = p.matcher(js)
|
||||
@ -35,16 +35,8 @@ class JsUnpacker(packedJS: String?) {
|
||||
val radixStr = m.group(2)
|
||||
val countStr = m.group(3)
|
||||
val symtab = m.group(4).split("\\|".toRegex()).toTypedArray()
|
||||
var radix = 36
|
||||
var count = 0
|
||||
try {
|
||||
radix = radixStr.toInt()
|
||||
} catch (e: Exception) {
|
||||
}
|
||||
try {
|
||||
count = countStr.toInt()
|
||||
} catch (e: Exception) {
|
||||
}
|
||||
val radix = radixStr.toIntOrNull() ?: 36
|
||||
val count = countStr.toIntOrNull() ?: 0
|
||||
if (symtab.size != count) {
|
||||
throw Exception("Unknown p.a.c.k.e.r. encoding")
|
||||
}
|
||||
@ -67,7 +59,6 @@ class JsUnpacker(packedJS: String?) {
|
||||
}
|
||||
return decoded.toString()
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ class Animeyt : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
val epNum = getNumberFromEpsString(element.select("span.sa-series-link__number").text())
|
||||
episode.setUrlWithoutDomain(element.attr("href"))
|
||||
val epParsed = when {
|
||||
(epNum.isNotEmpty()) -> epNum.toFloat()
|
||||
epNum.isNotEmpty() -> epNum.toFloatOrNull() ?: 1F
|
||||
else -> 1F
|
||||
}
|
||||
episode.episode_number = epParsed
|
||||
|
@ -63,8 +63,8 @@ class AsiaLiveAction : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
val year = document.select("header div.asia-post-main p.Info span.Date a").text().toInt()
|
||||
val currentYear = Calendar.getInstance().get(Calendar.YEAR)
|
||||
anime.status = when {
|
||||
(year < currentYear) -> SAnime.COMPLETED
|
||||
(year == currentYear) -> SAnime.ONGOING
|
||||
year < currentYear -> SAnime.COMPLETED
|
||||
year == currentYear -> SAnime.ONGOING
|
||||
else -> SAnime.UNKNOWN
|
||||
}
|
||||
return anime
|
||||
@ -81,7 +81,7 @@ class AsiaLiveAction : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
val epNum = getNumberFromEpsString(element.select("div.flex-grow-1 p").text())
|
||||
episode.setUrlWithoutDomain(element.attr("href"))
|
||||
episode.episode_number = when {
|
||||
(epNum.isNotEmpty()) -> epNum.toFloat()
|
||||
epNum.isNotEmpty() -> epNum.toFloatOrNull() ?: 1F
|
||||
else -> 1F
|
||||
}
|
||||
episode.name = element.select("div.flex-grow-1 p").text().trim()
|
||||
|
@ -70,7 +70,7 @@ class Doramasyt : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
val epNum = getNumberFromEpsString(element.select("a div.flimss div.dtlsflim p").text())
|
||||
Log.i("bruh ep", element.select("a").attr("href"))
|
||||
val formatedEp = when {
|
||||
(epNum.isNotEmpty()) -> epNum.toFloat()
|
||||
epNum.isNotEmpty() -> epNum.toFloatOrNull() ?: 1F
|
||||
else -> 1F
|
||||
}
|
||||
episode.setUrlWithoutDomain(element.select("a").attr("href"))
|
||||
|
@ -204,7 +204,7 @@ class Gnula : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
val videoList = mutableListOf<Video>()
|
||||
val embedUrl = url.lowercase()
|
||||
if (embedUrl.contains("tomatomatela")) {
|
||||
try {
|
||||
runCatching {
|
||||
val mainUrl = url.substringBefore("/embed.html#").substringAfter("https://")
|
||||
val headers = headers.newBuilder()
|
||||
.set("authority", mainUrl)
|
||||
@ -226,7 +226,7 @@ class Gnula : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
val status = json["status"]!!.jsonPrimitive!!.content
|
||||
val file = json["file"]!!.jsonPrimitive!!.content
|
||||
if (status == "200") { videoList.add(Video(file, "$prefix Tomatomatela", file, headers = null)) }
|
||||
} catch (e: Exception) { }
|
||||
}
|
||||
}
|
||||
if (embedUrl.contains("yourupload")) {
|
||||
val videos = YourUploadExtractor(client).videoFromUrl(url, headers = headers)
|
||||
|
@ -131,10 +131,9 @@ class Hentaijk : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
val serverId = it.attr("data-id")
|
||||
document.select("script").forEach { script ->
|
||||
if (script.data().contains("var video = [];")) {
|
||||
val url = (
|
||||
script.data().substringAfter("video[$serverId] = '<iframe class=\"player_conte\" src=\"")
|
||||
.substringBefore("\"")
|
||||
)
|
||||
val url = script.data()
|
||||
.substringAfter("video[$serverId] = '<iframe class=\"player_conte\" src=\"")
|
||||
.substringBefore("\"")
|
||||
.replace("$baseUrl/jkokru.php?u=", "http://ok.ru/videoembed/")
|
||||
.replace("$baseUrl/jkvmixdrop.php?u=", "https://mixdrop.co/e/")
|
||||
.replace("$baseUrl/jk.php?u=", "$baseUrl/")
|
||||
|
@ -129,7 +129,7 @@ class MonosChinos : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
}
|
||||
|
||||
override fun searchAnimeRequest(page: Int, query: String, filters: AnimeFilterList): Request {
|
||||
val genreFilter = (filters.find { it is GenreFilter } as? GenreFilter?) ?: GenreFilter()
|
||||
val genreFilter = filters.filterIsInstance<GenreFilter>().firstOrNull() ?: GenreFilter()
|
||||
val yearFilter = try {
|
||||
(filters.find { it is YearFilter } as YearFilter).state.toInt()
|
||||
} catch (e: Exception) {
|
||||
|
@ -16,7 +16,7 @@ class ProteaExtractor() {
|
||||
private val json: Json by injectLazy()
|
||||
fun videosFromUrl(url: String, qualityPrefix: String = "Protea", headers: Headers): List<Video> {
|
||||
val videoList = mutableListOf<Video>()
|
||||
try {
|
||||
runCatching {
|
||||
val document = Jsoup.connect(url).headers(headers.toMap()).ignoreContentType(true).method(Connection.Method.POST).execute()
|
||||
if (document!!.body()!!.isNotEmpty()) {
|
||||
val responseString = document.body().removePrefix("[").removeSuffix("]")
|
||||
@ -44,7 +44,6 @@ class ProteaExtractor() {
|
||||
videoList.add(Video("https://$urlVideo", quality, "https://$urlVideo", headers = newHeaders))
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
}
|
||||
return videoList
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ class SeriesflixClass : Pelisflix("Seriesflix", "https://seriesflix.video") {
|
||||
val iframe = it.attr("src")
|
||||
if (iframe.contains("https://sc.seriesflix.video/index.php")) {
|
||||
val postKey = iframe.replace("https://sc.seriesflix.video/index.php?h=", "")
|
||||
val mediaType = ("application/x-www-form-urlencoded").toMediaType()
|
||||
val mediaType = "application/x-www-form-urlencoded".toMediaType()
|
||||
val body: RequestBody = "h=$postKey".toRequestBody(mediaType)
|
||||
val newClient = OkHttpClient().newBuilder().build()
|
||||
val requestServer = Request.Builder()
|
||||
|
@ -167,7 +167,7 @@ open class PelisForte : ConfigurableAnimeSource, AnimeHttpSource() {
|
||||
lang.contains("Castellano", true) -> "[CAST]"
|
||||
else -> ""
|
||||
}
|
||||
val locationsDdh = client.newCall(GET(player,headers = headers.newBuilder().add("referer", src).build()))
|
||||
val locationsDdh = client.newCall(GET(player, headers = headers.newBuilder().add("referer", src).build()))
|
||||
.execute().networkResponse.toString()
|
||||
|
||||
fetchUrls(locationsDdh).forEach {
|
||||
|
@ -79,14 +79,14 @@ class Pelisplusph(override val name: String, override val baseUrl: String) : Pel
|
||||
} else {
|
||||
var index = 0
|
||||
jsoup.select(".item-season").reversed().mapIndexed { idxSeas, season ->
|
||||
val seasonNumber = try {
|
||||
val seasonNumber = runCatching {
|
||||
getNumberFromString(season.selectFirst(".item-season-title")!!.ownText())
|
||||
} catch (_: Exception) { idxSeas + 1 }
|
||||
}.getOrElse { idxSeas + 1 }
|
||||
season.select(".item-season-episodes a").reversed().mapIndexed { idx, ep ->
|
||||
index += 1
|
||||
val noEp = try {
|
||||
val noEp = runCatching {
|
||||
getNumberFromString(ep.ownText())
|
||||
} catch (_: Exception) { idx + 1 }
|
||||
}.getOrElse { idx + 1 }
|
||||
|
||||
val episode = SEpisode.create()
|
||||
episode.episode_number = index.toFloat()
|
||||
@ -130,7 +130,7 @@ class Pelisplusph(override val name: String, override val baseUrl: String) : Pel
|
||||
val videoList = mutableListOf<Video>()
|
||||
val embedUrl = url.lowercase()
|
||||
if (embedUrl.contains("tomatomatela")) {
|
||||
try {
|
||||
runCatching {
|
||||
val mainUrl = url.substringBefore("/embed.html#").substringAfter("https://")
|
||||
val headers = headers.newBuilder()
|
||||
.set("authority", mainUrl)
|
||||
@ -152,7 +152,7 @@ class Pelisplusph(override val name: String, override val baseUrl: String) : Pel
|
||||
val status = json["status"]!!.jsonPrimitive!!.content
|
||||
val file = json["file"]!!.jsonPrimitive!!.content
|
||||
if (status == "200") { videoList.add(Video(file, "$prefix Tomatomatela", file, headers = null)) }
|
||||
} catch (e: Exception) { }
|
||||
}
|
||||
}
|
||||
if (embedUrl.contains("yourupload")) {
|
||||
val videos = YourUploadExtractor(client).videoFromUrl(url, headers = headers)
|
||||
|
@ -26,7 +26,7 @@ class JsUnpacker(packedJS: String?) {
|
||||
*/
|
||||
fun unpack(): String? {
|
||||
val js = packedJS
|
||||
try {
|
||||
runCatching {
|
||||
var p =
|
||||
Pattern.compile("""\}\s*\('(.*)',\s*(.*?),\s*(\d+),\s*'(.*?)'\.split\('\|'\)""", Pattern.DOTALL)
|
||||
var m = p.matcher(js)
|
||||
@ -35,16 +35,8 @@ class JsUnpacker(packedJS: String?) {
|
||||
val radixStr = m.group(2)
|
||||
val countStr = m.group(3)
|
||||
val symtab = m.group(4).split("\\|".toRegex()).toTypedArray()
|
||||
var radix = 36
|
||||
var count = 0
|
||||
try {
|
||||
radix = radixStr.toInt()
|
||||
} catch (e: Exception) {
|
||||
}
|
||||
try {
|
||||
count = countStr.toInt()
|
||||
} catch (e: Exception) {
|
||||
}
|
||||
val radix = radixStr.toIntOrNull() ?: 36
|
||||
val count = countStr.toIntOrNull() ?: 0
|
||||
if (symtab.size != count) {
|
||||
throw Exception("Unknown p.a.c.k.e.r. encoding")
|
||||
}
|
||||
@ -67,7 +59,6 @@ class JsUnpacker(packedJS: String?) {
|
||||
}
|
||||
return decoded.toString()
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ class Vostfree : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
episode_number = "1".toFloat()
|
||||
name = "Film"
|
||||
}
|
||||
episode.url = ("?episode:${0}/${response.request.url}")
|
||||
episode.url = "?episode:0/${response.request.url}"
|
||||
episodes.add(episode)
|
||||
} else {
|
||||
val episode = SEpisode.create().apply {
|
||||
@ -104,10 +104,10 @@ class Vostfree : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
if (server.lowercase() == "vudeo") {
|
||||
val playerId = it.attr("id")
|
||||
val url = document.select("div#player-tabs div.tab-blocks div.tab-content div div#content_$playerId").text()
|
||||
try {
|
||||
runCatching {
|
||||
val video = VudeoExtractor(client).videosFromUrl(url)
|
||||
videoList.addAll(video)
|
||||
} catch (e: Exception) {}
|
||||
}
|
||||
}
|
||||
if (server.lowercase() == "ok") {
|
||||
val playerId = it.attr("id")
|
||||
|
@ -61,7 +61,7 @@ class Kuramanime : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
val epsNum = getNumberFromEpsString(element.text())
|
||||
episode.setUrlWithoutDomain(element.attr("href"))
|
||||
episode.episode_number = when {
|
||||
(epsNum.isNotEmpty()) -> epsNum.toFloat()
|
||||
epsNum.isNotEmpty() -> epsNum.toFloatOrNull() ?: 1F
|
||||
else -> 1F
|
||||
}
|
||||
episode.name = element.text()
|
||||
|
@ -66,7 +66,7 @@ class Kuronime : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
val epsNum = getNumberFromEpsString(element.select("span.lchx").text())
|
||||
episode.setUrlWithoutDomain(element.selectFirst("a")!!.attr("href"))
|
||||
episode.episode_number = when {
|
||||
(epsNum.isNotEmpty()) -> epsNum.toFloat()
|
||||
epsNum.isNotEmpty() -> epsNum.toFloatOrNull() ?: 1F
|
||||
else -> 1F
|
||||
}
|
||||
episode.name = element.select("span.lchx").text()
|
||||
|
@ -188,7 +188,7 @@ class NeoNime : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
val epsNum = getNumberFromEpsString(element.select("div.episodiotitle > a").text())
|
||||
episode.setUrlWithoutDomain(element.select("div.episodiotitle > a").attr("href"))
|
||||
episode.episode_number = when {
|
||||
(epsNum.isNotEmpty()) -> epsNum.toFloat()
|
||||
epsNum.isNotEmpty() -> epsNum.toFloat()
|
||||
else -> 1F
|
||||
}
|
||||
episode.name = element.select("div.episodiotitle > a").text()
|
||||
|
@ -71,7 +71,7 @@ class Oploverz : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
val epsNum = getNumberFromEpsString(element.select(".epl-num").text())
|
||||
episode.setUrlWithoutDomain(element.select("a").attr("href"))
|
||||
episode.episode_number = when {
|
||||
(epsNum.isNotEmpty()) -> epsNum.toFloat()
|
||||
epsNum.isNotEmpty() -> epsNum.toFloatOrNull() ?: 1F
|
||||
else -> 1F
|
||||
}
|
||||
episode.name = element.select(".epl-title").text()
|
||||
|
@ -76,7 +76,7 @@ class ANIMEWORLD : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
episode.name = "Episode: " + element.text()
|
||||
val epNum = getNumberFromEpsString(element.text())
|
||||
episode.episode_number = when {
|
||||
(epNum.isNotEmpty()) -> epNum.toFloat()
|
||||
epNum.isNotEmpty() -> epNum.toFloatOrNull() ?: 1F
|
||||
else -> 1F
|
||||
}
|
||||
return episode
|
||||
|
@ -92,8 +92,9 @@ class StreamingCommunity : ConfigurableAnimeSource, AnimeHttpSource() {
|
||||
}
|
||||
}
|
||||
|
||||
val hasNextPage = (response.request.url.queryParameter("offset")?.let { it.toInt() < 120 } ?: true) &&
|
||||
animeList.size == 60
|
||||
val hasNextPage = response.request.url.queryParameter("offset")
|
||||
?.toIntOrNull()
|
||||
?.let { it < 120 } ?: true && animeList.size == 60
|
||||
|
||||
return AnimesPage(animeList, hasNextPage)
|
||||
}
|
||||
@ -174,8 +175,9 @@ class StreamingCommunity : ConfigurableAnimeSource, AnimeHttpSource() {
|
||||
}
|
||||
}
|
||||
|
||||
val hasNextPage = (response.request.url.queryParameter("offset")?.let { it.toInt() < 120 } ?: true) &&
|
||||
animeList.size == 60
|
||||
val hasNextPage = response.request.url.queryParameter("offset")
|
||||
?.toIntOrNull()
|
||||
?.let { it < 120 } ?: true && animeList.size == 60
|
||||
|
||||
return AnimesPage(animeList, hasNextPage)
|
||||
}
|
||||
|
@ -547,7 +547,7 @@ class VVVVID : ConfigurableAnimeSource, AnimeHttpSource() {
|
||||
}
|
||||
|
||||
private fun getRandomIntString(): String {
|
||||
val allowedChars = ('0'..'9')
|
||||
val allowedChars = '0'..'9'
|
||||
return (1..16)
|
||||
.map { allowedChars.random() }
|
||||
.joinToString("")
|
||||
@ -571,7 +571,7 @@ class VVVVID : ConfigurableAnimeSource, AnimeHttpSource() {
|
||||
var b = false
|
||||
val mSize = m.size
|
||||
|
||||
while ((!b) && o < mSize) {
|
||||
while (!b && o < mSize) {
|
||||
var n = m[o] shl 2
|
||||
o++
|
||||
var k = -1
|
||||
|
@ -238,17 +238,6 @@ class Wbijam : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
|
||||
override fun episodeFromElement(element: Element): SEpisode = throw Exception("Not used")
|
||||
|
||||
// private fun episodeFromElement(element: Element, seasonName: String): SEpisode {
|
||||
// return SEpisode.create().apply {
|
||||
// name = "[$seasonName] ${element.selectFirst("td a").text()}"
|
||||
// episode_number = if (episodeName.contains("Episode ", true)) {
|
||||
// episodeName.substringAfter("Episode ").substringBefore(" ").toFloatOrNull() ?: 0F
|
||||
// } else { 0F }
|
||||
// date_upload = element.selectFirst("span.date")?.let { parseDate(it.text()) } ?: 0L
|
||||
// setUrlWithoutDomain(element.selectFirst("a[href]")!!.attr("href"))
|
||||
// }
|
||||
// }
|
||||
|
||||
// ============================ Video Links =============================
|
||||
|
||||
override fun fetchVideoList(episode: SEpisode): Observable<List<Video>> {
|
||||
@ -275,7 +264,7 @@ class Wbijam : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
?: serverDoc.selectFirst("span.odtwarzaj_vk")?.let { t -> "https://vk.com/video${t.attr("rel")}_${t.attr("id")}" } ?: "",
|
||||
)
|
||||
}
|
||||
} else {}
|
||||
}
|
||||
}
|
||||
|
||||
videoList.addAll(
|
||||
|
@ -152,7 +152,7 @@ class Megaflix : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
||||
?.let {
|
||||
val season = it.first().toFloatOrNull() ?: 0F
|
||||
val episode = it.last().toFloatOrNull() ?: 0F
|
||||
(season * 100F) + episode
|
||||
season * 100F + episode
|
||||
}
|
||||
?: 0F
|
||||
}
|
||||
|
Reference in New Issue
Block a user