Skip to content

Commit

Permalink
Use StringUtils in some places
Browse files Browse the repository at this point in the history
  • Loading branch information
Luna712 authored Jan 5, 2025
1 parent f36939f commit 1cce20f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import com.lagradost.cloudstream3.mvvm.logError
import com.lagradost.cloudstream3.utils.ExtractorApi
import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.Qualities
import com.lagradost.cloudstream3.utils.StringUtils.decodeUri
import org.jsoup.nodes.Document
import java.net.URLDecoder

open class InternetArchive : ExtractorApi() {
override val mainUrl = "https://archive.org"
Expand All @@ -16,8 +16,6 @@ open class InternetArchive : ExtractorApi() {

companion object {
private var archivedItems: MutableMap<String, Document> = mutableMapOf()

fun String.decodeUri(): String = URLDecoder.decode(this, "UTF-8")
}

override fun getExtractorUrl(id: String): String {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package com.lagradost.cloudstream3.extractors.helper

// taken from https://github.com/saikou-app/saikou/blob/b35364c8c2a00364178a472fccf1ab72f09815b4/app/src/main/java/ani/saikou/parsers/anime/NineAnime.kt
import com.lagradost.cloudstream3.utils.StringUtils.decodeUri
import com.lagradost.cloudstream3.utils.StringUtils.encodeUri

// Taken from https://github.com/saikou-app/saikou/blob/b35364c8c2a00364178a472fccf1ab72f09815b4/app/src/main/java/ani/saikou/parsers/anime/NineAnime.kt
// GNU General Public License v3.0 https://github.com/saikou-app/saikou/blob/main/LICENSE.md
object NineAnimeHelper {
private const val nineAnimeKey =
Expand Down Expand Up @@ -106,7 +109,7 @@ object NineAnimeHelper {
}

fun encode(input: String): String =
java.net.URLEncoder.encode(input, "utf-8").replace("+", "%20")
input.encodeUri().replace("+", "%20")

private fun decode(input: String): String = java.net.URLDecoder.decode(input, "utf-8")
private fun decode(input: String): String = input.decodeUri()
}

0 comments on commit 1cce20f

Please sign in to comment.