fix(ar/arabanime): Use cloudflare client(fixes http 403) + fix base64 decoding (#2440)
This commit is contained in:
@ -1,12 +1,14 @@
|
|||||||
apply plugin: 'com.android.application'
|
plugins {
|
||||||
apply plugin: 'kotlin-android'
|
alias(libs.plugins.android.application)
|
||||||
apply plugin: 'kotlinx-serialization'
|
alias(libs.plugins.kotlin.android)
|
||||||
|
alias(libs.plugins.kotlin.serialization)
|
||||||
|
}
|
||||||
|
|
||||||
ext {
|
ext {
|
||||||
extName = 'ArabAnime'
|
extName = 'ArabAnime'
|
||||||
pkgNameSuffix = 'ar.arabanime'
|
pkgNameSuffix = 'ar.arabanime'
|
||||||
extClass = '.ArabAnime'
|
extClass = '.ArabAnime'
|
||||||
extVersionCode = 1
|
extVersionCode = 2
|
||||||
libVersion = '13'
|
libVersion = '13'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package eu.kanade.tachiyomi.animeextension.ar.arabanime
|
package eu.kanade.tachiyomi.animeextension.ar.arabanime
|
||||||
|
|
||||||
import android.app.Application
|
import android.app.Application
|
||||||
import android.content.SharedPreferences
|
import android.util.Base64
|
||||||
import androidx.preference.ListPreference
|
import androidx.preference.ListPreference
|
||||||
import androidx.preference.PreferenceScreen
|
import androidx.preference.PreferenceScreen
|
||||||
import eu.kanade.tachiyomi.animeextension.ar.arabanime.dto.AnimeItem
|
import eu.kanade.tachiyomi.animeextension.ar.arabanime.dto.AnimeItem
|
||||||
@ -26,6 +26,7 @@ import okhttp3.Request
|
|||||||
import okhttp3.Response
|
import okhttp3.Response
|
||||||
import uy.kohesive.injekt.Injekt
|
import uy.kohesive.injekt.Injekt
|
||||||
import uy.kohesive.injekt.api.get
|
import uy.kohesive.injekt.api.get
|
||||||
|
import uy.kohesive.injekt.injectLazy
|
||||||
|
|
||||||
class ArabAnime : ConfigurableAnimeSource, AnimeHttpSource() {
|
class ArabAnime : ConfigurableAnimeSource, AnimeHttpSource() {
|
||||||
|
|
||||||
@ -37,83 +38,112 @@ class ArabAnime : ConfigurableAnimeSource, AnimeHttpSource() {
|
|||||||
|
|
||||||
override val supportsLatest = true
|
override val supportsLatest = true
|
||||||
|
|
||||||
private val json = Json {
|
override val client = network.cloudflareClient
|
||||||
ignoreUnknownKeys = true
|
|
||||||
}
|
|
||||||
|
|
||||||
private val preferences: SharedPreferences by lazy {
|
private val json: Json by injectLazy()
|
||||||
|
|
||||||
|
private val preferences by lazy {
|
||||||
Injekt.get<Application>().getSharedPreferences("source_$id", 0x0000)
|
Injekt.get<Application>().getSharedPreferences("source_$id", 0x0000)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ============================== Popular ===============================
|
// ============================== Popular ===============================
|
||||||
|
override fun popularAnimeRequest(page: Int): Request = GET("$baseUrl/api?page=$page")
|
||||||
|
|
||||||
override fun popularAnimeParse(response: Response): AnimesPage {
|
override fun popularAnimeParse(response: Response): AnimesPage {
|
||||||
val responseJson = json.decodeFromString<PopularAnimeResponse>(response.body.string())
|
val responseJson = json.decodeFromString<PopularAnimeResponse>(response.body.string())
|
||||||
val animeList = responseJson.Shows.map {
|
val animeList = responseJson.Shows.mapNotNull {
|
||||||
val animeJson = json.decodeFromString<AnimeItem>(it.decodeBase64())
|
runCatching {
|
||||||
SAnime.create().apply {
|
val animeJson = json.decodeFromString<AnimeItem>(it.decodeBase64())
|
||||||
setUrlWithoutDomain(animeJson.info_src)
|
SAnime.create().apply {
|
||||||
title = animeJson.anime_name
|
setUrlWithoutDomain(animeJson.info_src)
|
||||||
thumbnail_url = animeJson.anime_cover_image_url
|
title = animeJson.anime_name
|
||||||
}
|
thumbnail_url = animeJson.anime_cover_image_url
|
||||||
|
}
|
||||||
|
}.getOrNull()
|
||||||
}
|
}
|
||||||
val hasNextPage = responseJson.current_page < responseJson.last_page
|
val hasNextPage = responseJson.current_page < responseJson.last_page
|
||||||
return AnimesPage(animeList, hasNextPage)
|
return AnimesPage(animeList, hasNextPage)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun popularAnimeRequest(page: Int): Request = GET("$baseUrl/api?page=$page")
|
// =============================== Latest ===============================
|
||||||
|
override fun latestUpdatesRequest(page: Int) = GET(baseUrl)
|
||||||
|
|
||||||
// ============================== Episodes ==============================
|
override fun latestUpdatesParse(response: Response): AnimesPage {
|
||||||
override fun episodeListParse(response: Response): List<SEpisode> {
|
val latestEpisodes = response.use { it.asJsoup() }.select("div.as-episode")
|
||||||
val showData = response.asJsoup().select("div#data").text().decodeBase64()
|
val animeList = latestEpisodes.map {
|
||||||
val episodesJson = json.decodeFromString<ShowItem>(showData)
|
SAnime.create().apply {
|
||||||
return episodesJson.EPS.map {
|
val ahref = it.selectFirst("a.as-info")!!
|
||||||
SEpisode.create().apply {
|
title = ahref.text()
|
||||||
name = it.episode_name
|
val url = ahref.attr("href").replace("watch", "show").substringBeforeLast("/")
|
||||||
episode_number = it.episode_number.toFloat()
|
setUrlWithoutDomain(url)
|
||||||
setUrlWithoutDomain(it.`info-src`)
|
|
||||||
}
|
|
||||||
}.reversed()
|
|
||||||
}
|
|
||||||
|
|
||||||
// ============================ Video Links =============================
|
thumbnail_url = it.selectFirst("img")?.absUrl("src")
|
||||||
override fun videoListRequest(episode: SEpisode): Request = GET("$baseUrl/${episode.url}")
|
|
||||||
|
|
||||||
override fun videoListParse(response: Response): List<Video> {
|
|
||||||
val watchData = response.asJsoup().select("div#datawatch").text().decodeBase64()
|
|
||||||
val serversJson = json.decodeFromString<Episode>(watchData)
|
|
||||||
val selectServer = serversJson.ep_info[0].stream_servers[0].decodeBase64()
|
|
||||||
val watchPage = client.newCall(GET(selectServer)).execute().asJsoup()
|
|
||||||
val videoList = mutableListOf<Video>()
|
|
||||||
watchPage.select("option").forEach { it ->
|
|
||||||
val link = it.attr("data-src").decodeBase64()
|
|
||||||
if (link.contains("www.arabanime.net/embed")) {
|
|
||||||
val sources = client.newCall(GET(link)).execute().asJsoup().select("source")
|
|
||||||
sources.forEach { source ->
|
|
||||||
if (!source.attr("src").contains("static")) {
|
|
||||||
val quality = source.attr("label").let { q ->
|
|
||||||
if (q.contains("p")) q else q + "p"
|
|
||||||
}
|
|
||||||
videoList.add(
|
|
||||||
Video(source.attr("src"), "${it.text()}: $quality", source.attr("src")),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return videoList
|
return AnimesPage(animeList, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun List<Video>.sort(): List<Video> {
|
// =============================== Search ===============================
|
||||||
val quality = preferences.getString(PREF_QUALITY_KEY, PREF_QUALITY_DEFAULT)!!
|
override fun searchAnimeRequest(page: Int, query: String, filters: AnimeFilterList): Request {
|
||||||
return sortedWith(
|
return if (query.isNotEmpty()) {
|
||||||
compareBy { it.quality.contains(quality) },
|
val body = FormBody.Builder().add("searchq", query).build()
|
||||||
).reversed()
|
POST("$baseUrl/searchq", body = body)
|
||||||
|
} else {
|
||||||
|
val type = filters.asQueryPart<TypeFilter>()
|
||||||
|
val status = filters.asQueryPart<StatusFilter>()
|
||||||
|
val order = filters.asQueryPart<OrderFilter>()
|
||||||
|
GET("$baseUrl/api?order=$order&type=$type&stat=$status&tags=&page=$page")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun searchAnimeParse(response: Response): AnimesPage {
|
||||||
|
return if (response.body.contentType() == "application/json".toMediaType()) {
|
||||||
|
popularAnimeParse(response)
|
||||||
|
} else {
|
||||||
|
val searchResult = response.use { it.asJsoup() }.select("div.show")
|
||||||
|
val animeList = searchResult.map {
|
||||||
|
SAnime.create().apply {
|
||||||
|
setUrlWithoutDomain(it.selectFirst("a")!!.attr("href"))
|
||||||
|
title = it.selectFirst("h3")!!.text()
|
||||||
|
thumbnail_url = it.selectFirst("img")?.absUrl("src")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return AnimesPage(animeList, false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ============================== filters ==============================
|
||||||
|
override fun getFilterList() = AnimeFilterList(
|
||||||
|
AnimeFilter.Header("فلترة الموقع"),
|
||||||
|
OrderFilter(),
|
||||||
|
TypeFilter(),
|
||||||
|
StatusFilter(),
|
||||||
|
)
|
||||||
|
|
||||||
|
open class QueryPartFilter(
|
||||||
|
displayName: String,
|
||||||
|
val vals: Array<Pair<String, String>>,
|
||||||
|
) : AnimeFilter.Select<String>(
|
||||||
|
displayName,
|
||||||
|
vals.map { it.first }.toTypedArray(),
|
||||||
|
) {
|
||||||
|
fun toQueryPart() = vals[state].second
|
||||||
|
}
|
||||||
|
|
||||||
|
private inline fun <reified R> AnimeFilterList.asQueryPart(): String {
|
||||||
|
return (firstOrNull { it is R } as? QueryPartFilter)?.toQueryPart() ?: ""
|
||||||
|
}
|
||||||
|
|
||||||
|
private class OrderFilter : QueryPartFilter("ترتيب", ORDER_LIST)
|
||||||
|
private class TypeFilter : QueryPartFilter("النوع", TYPE_LIST)
|
||||||
|
private class StatusFilter : QueryPartFilter("الحالة", STATUS_LIST)
|
||||||
|
|
||||||
// =========================== Anime Details ============================
|
// =========================== Anime Details ============================
|
||||||
|
|
||||||
override fun animeDetailsParse(response: Response): SAnime {
|
override fun animeDetailsParse(response: Response): SAnime {
|
||||||
val showData = response.asJsoup().select("div#data").text().decodeBase64()
|
val showData = response.use { it.asJsoup() }.selectFirst("div#data")!!
|
||||||
|
.text()
|
||||||
|
.decodeBase64()
|
||||||
|
|
||||||
val details = json.decodeFromString<ShowItem>(showData).show[0]
|
val details = json.decodeFromString<ShowItem>(showData).show[0]
|
||||||
return SAnime.create().apply {
|
return SAnime.create().apply {
|
||||||
url = "/show-${details.anime_id}/${details.anime_slug}"
|
url = "/show-${details.anime_id}/${details.anime_slug}"
|
||||||
@ -129,102 +159,61 @@ class ArabAnime : ConfigurableAnimeSource, AnimeHttpSource() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// =============================== Search ===============================
|
// ============================== Episodes ==============================
|
||||||
|
override fun episodeListParse(response: Response): List<SEpisode> {
|
||||||
|
val showData = response.use { it.asJsoup() }.selectFirst("div#data")
|
||||||
|
?.text()
|
||||||
|
?.decodeBase64()
|
||||||
|
?: return emptyList()
|
||||||
|
|
||||||
override fun searchAnimeParse(response: Response): AnimesPage {
|
val episodesJson = json.decodeFromString<ShowItem>(showData)
|
||||||
return if (response.body.contentType() == "application/json".toMediaType()) {
|
return episodesJson.EPS.map {
|
||||||
popularAnimeParse(response)
|
SEpisode.create().apply {
|
||||||
} else {
|
name = it.episode_name
|
||||||
val searchResult = response.asJsoup().select("div.show")
|
episode_number = it.episode_number.toFloat()
|
||||||
val animeList = searchResult.map {
|
setUrlWithoutDomain(it.`info-src`)
|
||||||
SAnime.create().apply {
|
|
||||||
setUrlWithoutDomain(it.select("a").attr("href"))
|
|
||||||
title = it.select("h3").text()
|
|
||||||
thumbnail_url = it.select("img").attr("src")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return AnimesPage(animeList, false)
|
}.reversed()
|
||||||
}
|
|
||||||
}
|
|
||||||
override fun searchAnimeRequest(page: Int, query: String, filters: AnimeFilterList): Request {
|
|
||||||
if (query.isNotEmpty()) {
|
|
||||||
val body = FormBody.Builder().add("searchq", query).build()
|
|
||||||
return POST("$baseUrl/searchq", body = body)
|
|
||||||
} else {
|
|
||||||
var type = ""
|
|
||||||
var status = ""
|
|
||||||
var order = ""
|
|
||||||
(if (filters.isEmpty()) getFilterList() else filters).forEach { filter ->
|
|
||||||
when (filter) {
|
|
||||||
is OrderCategoryList -> {
|
|
||||||
order = getOrderFilterList()[filter.state].query
|
|
||||||
}
|
|
||||||
is TypeCategoryList -> {
|
|
||||||
type = getTypeFilterList()[filter.state].query
|
|
||||||
}
|
|
||||||
is StatCategoryList -> {
|
|
||||||
status = getStatFilterList()[filter.state].query
|
|
||||||
}
|
|
||||||
else -> {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return GET("$baseUrl/api?order=$order&type=$type&stat=$status&tags=&page=$page")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// =============================== Latest ===============================
|
// ============================ Video Links =============================
|
||||||
override fun latestUpdatesParse(response: Response): AnimesPage {
|
override fun videoListParse(response: Response): List<Video> {
|
||||||
val latestEpisodes = response.asJsoup().select("div.as-episode")
|
val watchData = response.use { it.asJsoup() }.selectFirst("div#datawatch")
|
||||||
val animeList = latestEpisodes.map {
|
?.text()
|
||||||
SAnime.create().apply {
|
?.decodeBase64()
|
||||||
val url = it.select("a.as-info").attr("href")
|
?: return emptyList()
|
||||||
.replace("watch", "show").substringBeforeLast("/")
|
|
||||||
setUrlWithoutDomain(url)
|
val serversJson = json.decodeFromString<Episode>(watchData)
|
||||||
title = it.select("a.as-info").text()
|
val selectServer = serversJson.ep_info[0].stream_servers[0].decodeBase64()
|
||||||
thumbnail_url = it.select("img").attr("src")
|
|
||||||
|
val watchPage = client.newCall(GET(selectServer)).execute().use { it.asJsoup() }
|
||||||
|
return watchPage.select("option")
|
||||||
|
.map { it.text() to it.attr("data-src").decodeBase64() } // server : url
|
||||||
|
.filter { it.second.contains("$baseUrl/embed") } // filter urls
|
||||||
|
.flatMap { (name, url) ->
|
||||||
|
client.newCall(GET(url)).execute()
|
||||||
|
.use { it.asJsoup() }
|
||||||
|
.select("source")
|
||||||
|
.mapNotNull { source ->
|
||||||
|
val videoUrl = source.attr("src")
|
||||||
|
if (!videoUrl.contains("static")) {
|
||||||
|
val quality = source.attr("label").let { q ->
|
||||||
|
if (q.contains("p")) q else q + "p"
|
||||||
|
}
|
||||||
|
Video(videoUrl, "$name: $quality", videoUrl)
|
||||||
|
} else {
|
||||||
|
null
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return AnimesPage(animeList, false)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun latestUpdatesRequest(page: Int): Request = GET(baseUrl)
|
override fun List<Video>.sort(): List<Video> {
|
||||||
|
val quality = preferences.getString(PREF_QUALITY_KEY, PREF_QUALITY_DEFAULT)!!
|
||||||
// ============================== filters ==============================
|
return sortedWith(
|
||||||
override fun getFilterList() = AnimeFilterList(
|
compareBy { it.quality.contains(quality) },
|
||||||
AnimeFilter.Header("فلترة الموقع"),
|
).reversed()
|
||||||
OrderCategoryList(orderFilterList),
|
}
|
||||||
TypeCategoryList(typeFilterList),
|
|
||||||
StatCategoryList(statFilterList),
|
|
||||||
)
|
|
||||||
private class OrderCategoryList(categories: Array<String>) : AnimeFilter.Select<String>("ترتيب", categories)
|
|
||||||
private class TypeCategoryList(categories: Array<String>) : AnimeFilter.Select<String>("النوع", categories)
|
|
||||||
private class StatCategoryList(categories: Array<String>) : AnimeFilter.Select<String>("الحالة", categories)
|
|
||||||
|
|
||||||
private data class CatUnit(val name: String, val query: String)
|
|
||||||
|
|
||||||
private val orderFilterList = getOrderFilterList().map { it.name }.toTypedArray()
|
|
||||||
private val typeFilterList = getTypeFilterList().map { it.name }.toTypedArray()
|
|
||||||
private val statFilterList = getStatFilterList().map { it.name }.toTypedArray()
|
|
||||||
|
|
||||||
private fun getOrderFilterList() = listOf(
|
|
||||||
CatUnit("اختر", ""),
|
|
||||||
CatUnit("التقييم", "2"),
|
|
||||||
CatUnit("اخر الانميات المضافة", "1"),
|
|
||||||
CatUnit("الابجدية", "0"),
|
|
||||||
)
|
|
||||||
|
|
||||||
private fun getTypeFilterList() = listOf(
|
|
||||||
CatUnit("اختر", ""),
|
|
||||||
CatUnit("الكل", ""),
|
|
||||||
CatUnit("فيلم", "0"),
|
|
||||||
CatUnit("انمى", "1"),
|
|
||||||
)
|
|
||||||
private fun getStatFilterList() = listOf(
|
|
||||||
CatUnit("اختر", ""),
|
|
||||||
CatUnit("الكل", ""),
|
|
||||||
CatUnit("مستمر", "1"),
|
|
||||||
CatUnit("مكتمل", "0"),
|
|
||||||
)
|
|
||||||
|
|
||||||
// =============================== Preferences ===============================
|
// =============================== Preferences ===============================
|
||||||
override fun setupPreferenceScreen(screen: PreferenceScreen) {
|
override fun setupPreferenceScreen(screen: PreferenceScreen) {
|
||||||
@ -246,7 +235,30 @@ class ArabAnime : ConfigurableAnimeSource, AnimeHttpSource() {
|
|||||||
screen.addPreference(videoQualityPref)
|
screen.addPreference(videoQualityPref)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun String.decodeBase64() = String(Base64.decode(this, Base64.DEFAULT))
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
private val ORDER_LIST = arrayOf(
|
||||||
|
Pair("اختر", ""),
|
||||||
|
Pair("التقييم", "2"),
|
||||||
|
Pair("اخر الانميات المضافة", "1"),
|
||||||
|
Pair("الابجدية", "0"),
|
||||||
|
)
|
||||||
|
|
||||||
|
private val TYPE_LIST = arrayOf(
|
||||||
|
Pair("اختر", ""),
|
||||||
|
Pair("الكل", ""),
|
||||||
|
Pair("فيلم", "0"),
|
||||||
|
Pair("انمى", "1"),
|
||||||
|
)
|
||||||
|
|
||||||
|
private val STATUS_LIST = arrayOf(
|
||||||
|
Pair("اختر", ""),
|
||||||
|
Pair("الكل", ""),
|
||||||
|
Pair("مستمر", "1"),
|
||||||
|
Pair("مكتمل", "0"),
|
||||||
|
)
|
||||||
|
|
||||||
private const val PREF_QUALITY_KEY = "preferred_quality"
|
private const val PREF_QUALITY_KEY = "preferred_quality"
|
||||||
private const val PREF_QUALITY_TITLE = "Preferred quality"
|
private const val PREF_QUALITY_TITLE = "Preferred quality"
|
||||||
private const val PREF_QUALITY_DEFAULT = "1080"
|
private const val PREF_QUALITY_DEFAULT = "1080"
|
||||||
|
@ -1,51 +0,0 @@
|
|||||||
package eu.kanade.tachiyomi.animeextension.ar.arabanime
|
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream
|
|
||||||
|
|
||||||
fun String.decodeBase64(): String = String(this.toByteArray().decodeBase64())
|
|
||||||
|
|
||||||
fun ByteArray.decodeBase64(): ByteArray {
|
|
||||||
val table = intArrayOf(
|
|
||||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
|
||||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1,
|
|
||||||
-1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1,
|
|
||||||
-1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1, -1,
|
|
||||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
|
||||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
|
||||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
|
||||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
|
||||||
)
|
|
||||||
|
|
||||||
val output = ByteArrayOutputStream()
|
|
||||||
var position = 0
|
|
||||||
while (position < this.size) {
|
|
||||||
var b: Int
|
|
||||||
if (table[this[position].toInt()] != -1) {
|
|
||||||
b = table[this[position].toInt()] and 0xFF shl 18
|
|
||||||
} else {
|
|
||||||
position++
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
var count = 0
|
|
||||||
if (position + 1 < this.size && table[this[position + 1].toInt()] != -1) {
|
|
||||||
b = b or (table[this[position + 1].toInt()] and 0xFF shl 12)
|
|
||||||
count++
|
|
||||||
}
|
|
||||||
if (position + 2 < this.size && table[this[position + 2].toInt()] != -1) {
|
|
||||||
b = b or (table[this[position + 2].toInt()] and 0xFF shl 6)
|
|
||||||
count++
|
|
||||||
}
|
|
||||||
if (position + 3 < this.size && table[this[position + 3].toInt()] != -1) {
|
|
||||||
b = b or (table[this[position + 3].toInt()] and 0xFF)
|
|
||||||
count++
|
|
||||||
}
|
|
||||||
while (count > 0) {
|
|
||||||
val c = b and 0xFF0000 shr 16
|
|
||||||
output.write(c.toChar().code)
|
|
||||||
b = b shl 8
|
|
||||||
count--
|
|
||||||
}
|
|
||||||
position += 4
|
|
||||||
}
|
|
||||||
return output.toByteArray()
|
|
||||||
}
|
|
Reference in New Issue
Block a user