feat(src/fr) New source: Anime-Sama (#1984)
This commit is contained in:
@ -7,7 +7,7 @@ import okhttp3.OkHttpClient
|
||||
|
||||
class MytvExtractor(private val client: OkHttpClient) {
|
||||
|
||||
fun videosFromUrl(url: String): List<Video> {
|
||||
fun videosFromUrl(url: String, prefix: String = ""): List<Video> {
|
||||
val document = client.newCall(GET(url)).execute().asJsoup()
|
||||
val videoList = mutableListOf<Video>()
|
||||
document.select("script").forEach { script ->
|
||||
@ -16,9 +16,9 @@ class MytvExtractor(private val client: OkHttpClient) {
|
||||
val videoUrl = videosString.substringAfter("\"v=").substringBefore("\\u0026tp=video").replace("%26", "&").replace("%3a", ":").replace("%2f", "/").replace("%3f", "?").replace("%3d", "=")
|
||||
if (!videoUrl.contains("https:")) {
|
||||
val videoUrl = "https:$videoUrl"
|
||||
videoList.add(Video(videoUrl, "Stream", videoUrl))
|
||||
videoList.add(Video(videoUrl, "${prefix}Stream", videoUrl))
|
||||
} else {
|
||||
videoList.add(Video(videoUrl, "Mytv", videoUrl))
|
||||
videoList.add(Video(videoUrl, "${prefix}Mytv", videoUrl))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ import okhttp3.OkHttpClient
|
||||
|
||||
class SibnetExtractor(private val client: OkHttpClient) {
|
||||
|
||||
fun videosFromUrl(url: String): List<Video> {
|
||||
fun videosFromUrl(url: String, prefix: String = ""): List<Video> {
|
||||
val videoList = mutableListOf<Video>()
|
||||
|
||||
val document = client.newCall(
|
||||
@ -31,7 +31,7 @@ class SibnetExtractor(private val client: OkHttpClient) {
|
||||
)
|
||||
|
||||
videoList.add(
|
||||
Video(videoUrl, "Sibnet", videoUrl, headers = videoHeaders),
|
||||
Video(videoUrl, "${prefix}Sibnet", videoUrl, headers = videoHeaders),
|
||||
)
|
||||
|
||||
return videoList
|
||||
|
17
lib/vk-extractor/build.gradle.kts
Normal file
17
lib/vk-extractor/build.gradle.kts
Normal file
@ -0,0 +1,17 @@
|
||||
plugins {
|
||||
id("com.android.library")
|
||||
kotlin("android")
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdk = AndroidConfig.compileSdk
|
||||
namespace = "eu.kanade.tachiyomi.lib.vkextractor"
|
||||
|
||||
defaultConfig {
|
||||
minSdk = AndroidConfig.minSdk
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly(libs.bundles.common)
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package eu.kanade.tachiyomi.lib.vkextractor
|
||||
|
||||
import eu.kanade.tachiyomi.animesource.model.Video
|
||||
import eu.kanade.tachiyomi.network.GET
|
||||
import okhttp3.Headers
|
||||
import okhttp3.HttpUrl.Companion.toHttpUrl
|
||||
import okhttp3.OkHttpClient
|
||||
|
||||
class VkExtractor(private val client: OkHttpClient, private val headers: Headers) {
|
||||
fun videosFromUrl(url: String, prefix: String = ""): List<Video> {
|
||||
val documentHeaders = headers.newBuilder()
|
||||
.add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8")
|
||||
.add("Host", "vk.com")
|
||||
.build()
|
||||
|
||||
val data = client.newCall(
|
||||
GET(url, headers = documentHeaders),
|
||||
).execute().body.string()
|
||||
|
||||
val videoRegex = """"url(\d+)":"(.*?)"""".toRegex()
|
||||
return videoRegex.findAll(data).map {
|
||||
val quality = it.groupValues[1]
|
||||
val videoUrl = it.groupValues[2].replace("\\/", "/")
|
||||
val videoHeaders = headers.newBuilder()
|
||||
.add("Accept", "*/*")
|
||||
.add("Host", videoUrl.toHttpUrl().host)
|
||||
.add("Origin", "https://vk.com")
|
||||
.add("Referer", "https://vk.com/")
|
||||
.build()
|
||||
Video(videoUrl, "${prefix}vk.com - ${quality}p", videoUrl, headers = videoHeaders)
|
||||
}.toList()
|
||||
}
|
||||
}
|
22
src/fr/animesama/AndroidManifest.xml
Normal file
22
src/fr/animesama/AndroidManifest.xml
Normal file
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<application>
|
||||
<activity
|
||||
android:name=".fr.animesama.AnimeSamaUrlActivity"
|
||||
android:excludeFromRecents="true"
|
||||
android:exported="true"
|
||||
android:theme="@android:style/Theme.NoDisplay">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data
|
||||
android:host="anime-sama.fr"
|
||||
android:pathPattern="/catalogue/..*"
|
||||
android:scheme="https" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
</manifest>
|
23
src/fr/animesama/build.gradle
Normal file
23
src/fr/animesama/build.gradle
Normal file
@ -0,0 +1,23 @@
|
||||
plugins {
|
||||
alias(libs.plugins.android.application)
|
||||
alias(libs.plugins.kotlin.android)
|
||||
alias(libs.plugins.kotlin.serialization)
|
||||
}
|
||||
|
||||
ext {
|
||||
extName = 'Anime-Sama'
|
||||
pkgNameSuffix = 'fr.animesama'
|
||||
extClass = '.AnimeSama'
|
||||
extVersionCode = 1
|
||||
libVersion = 13
|
||||
containsNsfw = true
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(project(':lib-mytv-extractor'))
|
||||
implementation(project(':lib-sibnet-extractor'))
|
||||
implementation(project(':lib-vk-extractor'))
|
||||
implementation(project(':lib-sendvid-extractor'))
|
||||
}
|
||||
|
||||
apply from: "$rootDir/common.gradle"
|
BIN
src/fr/animesama/res/mipmap-hdpi/ic_launcher.png
Normal file
BIN
src/fr/animesama/res/mipmap-hdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.4 KiB |
BIN
src/fr/animesama/res/mipmap-mdpi/ic_launcher.png
Normal file
BIN
src/fr/animesama/res/mipmap-mdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.0 KiB |
BIN
src/fr/animesama/res/mipmap-xhdpi/ic_launcher.png
Normal file
BIN
src/fr/animesama/res/mipmap-xhdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.8 KiB |
BIN
src/fr/animesama/res/mipmap-xxhdpi/ic_launcher.png
Normal file
BIN
src/fr/animesama/res/mipmap-xxhdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.6 KiB |
BIN
src/fr/animesama/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
BIN
src/fr/animesama/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
BIN
src/fr/animesama/res/web_hi_res_512.png
Normal file
BIN
src/fr/animesama/res/web_hi_res_512.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 65 KiB |
@ -0,0 +1,287 @@
|
||||
package eu.kanade.tachiyomi.animeextension.fr.animesama
|
||||
|
||||
import android.app.Application
|
||||
import android.content.SharedPreferences
|
||||
import androidx.preference.ListPreference
|
||||
import androidx.preference.PreferenceScreen
|
||||
import eu.kanade.tachiyomi.animesource.ConfigurableAnimeSource
|
||||
import eu.kanade.tachiyomi.animesource.model.AnimeFilterList
|
||||
import eu.kanade.tachiyomi.animesource.model.AnimesPage
|
||||
import eu.kanade.tachiyomi.animesource.model.SAnime
|
||||
import eu.kanade.tachiyomi.animesource.model.SEpisode
|
||||
import eu.kanade.tachiyomi.animesource.model.Video
|
||||
import eu.kanade.tachiyomi.animesource.online.AnimeHttpSource
|
||||
import eu.kanade.tachiyomi.lib.mytvextractor.MytvExtractor
|
||||
import eu.kanade.tachiyomi.lib.sendvidextractor.SendvidExtractor
|
||||
import eu.kanade.tachiyomi.lib.sibnetextractor.SibnetExtractor
|
||||
import eu.kanade.tachiyomi.lib.vkextractor.VkExtractor
|
||||
import eu.kanade.tachiyomi.network.GET
|
||||
import eu.kanade.tachiyomi.network.POST
|
||||
import eu.kanade.tachiyomi.util.asJsoup
|
||||
import kotlinx.serialization.encodeToString
|
||||
import kotlinx.serialization.json.Json
|
||||
import okhttp3.FormBody
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.Request
|
||||
import okhttp3.Response
|
||||
import rx.Observable
|
||||
import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
import java.text.Normalizer
|
||||
|
||||
class AnimeSama : ConfigurableAnimeSource, AnimeHttpSource() {
|
||||
|
||||
override val name = "Anime-Sama"
|
||||
|
||||
override val baseUrl = "https://www.anime-sama.fr"
|
||||
|
||||
override val lang = "fr"
|
||||
|
||||
override val supportsLatest = true
|
||||
|
||||
override val client: OkHttpClient = network.cloudflareClient
|
||||
|
||||
private val json: Json by injectLazy()
|
||||
|
||||
private val preferences: SharedPreferences by lazy {
|
||||
Injekt.get<Application>().getSharedPreferences("source_$id", 0x0000)
|
||||
}
|
||||
|
||||
// ============================== Popular ===============================
|
||||
override fun popularAnimeParse(response: Response): AnimesPage {
|
||||
val animes = response.asJsoup()
|
||||
val seasons = animes.select("h2:contains(les classiques) + .scrollBarStyled > div").flatMap {
|
||||
val animeUrl = it.getElementsByTag("a").attr("href")
|
||||
fetchAnimeSeasons(animeUrl)
|
||||
}
|
||||
return AnimesPage(seasons, false)
|
||||
}
|
||||
|
||||
override fun popularAnimeRequest(page: Int): Request = GET(baseUrl)
|
||||
|
||||
// =============================== Latest ===============================
|
||||
override fun latestUpdatesParse(response: Response): AnimesPage {
|
||||
val animes = response.asJsoup()
|
||||
val seasons = animes.select("h2:contains(derniers ajouts) + .scrollBarStyled > div").flatMap {
|
||||
val animeUrl = it.getElementsByTag("a").attr("href")
|
||||
fetchAnimeSeasons(animeUrl)
|
||||
}
|
||||
return AnimesPage(seasons, false)
|
||||
}
|
||||
override fun latestUpdatesRequest(page: Int): Request = GET(baseUrl)
|
||||
|
||||
// =============================== Search ===============================
|
||||
override fun searchAnimeParse(response: Response): AnimesPage {
|
||||
return if (response.request.method == "GET") {
|
||||
AnimesPage(fetchAnimeSeasons(response), false)
|
||||
} else {
|
||||
val page = response.request.url.fragment?.toInt() ?: 1
|
||||
val elements = response.asJsoup().select(".cardListAnime").chunked(5)
|
||||
val animes = elements[page - 1].flatMap {
|
||||
fetchAnimeSeasons(it.getElementsByTag("a").attr("href"))
|
||||
}
|
||||
AnimesPage(animes, page < elements.size)
|
||||
}
|
||||
}
|
||||
|
||||
override fun searchAnimeRequest(page: Int, query: String, filters: AnimeFilterList): Request =
|
||||
if (query.startsWith(PREFIX_SEARCH)) { // Activity Intent Handler
|
||||
GET("$baseUrl/catalogue/${query.removePrefix(PREFIX_SEARCH)}/")
|
||||
} else {
|
||||
POST("$baseUrl/catalogue/searchbar.php#$page", headers, FormBody.Builder().add("query", query).build())
|
||||
}
|
||||
|
||||
// =========================== Anime Details ============================
|
||||
override fun fetchAnimeDetails(anime: SAnime): Observable<SAnime> = Observable.just(anime)
|
||||
|
||||
override fun animeDetailsParse(response: Response): SAnime = throw Exception("not used")
|
||||
|
||||
// ============================== Episodes ==============================
|
||||
override fun fetchEpisodeList(anime: SAnime): Observable<List<SEpisode>> {
|
||||
val animeUrl = "$baseUrl${anime.url.substringBeforeLast("/")}"
|
||||
val movie = anime.url.split("#").getOrElse(1) { "" }.toIntOrNull()
|
||||
val players = VOICES_VALUES.map { fetchPlayers("$animeUrl/$it") }
|
||||
val episodes = playersToEpisodes(players)
|
||||
return Observable.just(if (movie == null) episodes.reversed() else listOf(episodes[movie]))
|
||||
}
|
||||
|
||||
override fun episodeListParse(response: Response): List<SEpisode> = throw Exception("not used")
|
||||
|
||||
// ============================ Video Links =============================
|
||||
override fun fetchVideoList(episode: SEpisode): Observable<List<Video>> {
|
||||
val playerUrls = json.decodeFromString<List<List<String>>>(episode.url)
|
||||
val videos = playerUrls.flatMapIndexed { i, it ->
|
||||
val prefix = "(${VOICES_VALUES[i].uppercase()}) "
|
||||
it.flatMap { playerUrl ->
|
||||
with(playerUrl) {
|
||||
when {
|
||||
contains("anime-sama.fr") -> listOf(Video(playerUrl, "${prefix}AS Player", playerUrl))
|
||||
contains("sibnet.ru") -> SibnetExtractor(client).videosFromUrl(playerUrl, prefix)
|
||||
contains("myvi.") -> MytvExtractor(client).videosFromUrl(playerUrl, prefix)
|
||||
contains("vk.") -> VkExtractor(client, headers).videosFromUrl(playerUrl, prefix)
|
||||
contains("sendvid.com") -> SendvidExtractor(client, headers).videosFromUrl(playerUrl, prefix)
|
||||
else -> emptyList()
|
||||
}
|
||||
}
|
||||
}
|
||||
}.sort()
|
||||
return Observable.just(videos)
|
||||
}
|
||||
|
||||
// ============================ Utils =============================
|
||||
private fun removeDiacritics(string: String) = Normalizer.normalize(string, Normalizer.Form.NFD).replace(Regex("\\p{Mn}+"), "")
|
||||
private fun sanitizeEpisodesJs(doc: String) = doc
|
||||
.replace(Regex("[\"\t]"), "") // Fix trash format
|
||||
.replace("'", "\"") // Fix quotes
|
||||
.replace(Regex("/\\*.*?\\*/", setOf(RegexOption.MULTILINE, RegexOption.DOT_MATCHES_ALL)), "") // Remove block comments
|
||||
.replace(Regex("(^|,|\\[)\\s*//.*?$", RegexOption.MULTILINE), "$1") // Remove line comments
|
||||
.replace(Regex(",\\s*]"), "]") // Remove trailing comma
|
||||
|
||||
override fun List<Video>.sort(): List<Video> {
|
||||
val voices = preferences.getString(PREF_VOICES_KEY, PREF_VOICES_DEFAULT)!!
|
||||
val quality = preferences.getString(PREF_QUALITY_KEY, PREF_QUALITY_DEFAULT)!!
|
||||
|
||||
return this.sortedWith(
|
||||
compareBy(
|
||||
{ it.quality.contains(voices) },
|
||||
{ it.quality.contains(quality) },
|
||||
{ Regex("""(\d+)p""").find(it.quality)?.groupValues?.get(1)?.toIntOrNull() ?: 0 },
|
||||
),
|
||||
).reversed()
|
||||
}
|
||||
|
||||
private fun fetchAnimeSeasons(animeUrl: String): List<SAnime> {
|
||||
val res = client.newCall(GET(animeUrl)).execute()
|
||||
return fetchAnimeSeasons(res)
|
||||
}
|
||||
|
||||
private fun fetchAnimeSeasons(response: Response): List<SAnime> {
|
||||
val animeDoc = response.asJsoup()
|
||||
val animeUrl = response.request.url
|
||||
val animeName = animeDoc.getElementById("titreOeuvre")?.text() ?: ""
|
||||
|
||||
val seasonRegex = Regex("^\\s*panneauAnime\\(\"(.*)\", \"(.*)\"\\)", RegexOption.MULTILINE)
|
||||
val animes = seasonRegex.findAll(animeDoc.toString()).flatMapIndexed { animeIndex, seasonMatch ->
|
||||
val (seasonName, seasonStem) = seasonMatch.destructured
|
||||
if (seasonStem.contains("film", true)) {
|
||||
val moviesUrl = "$animeUrl/$seasonStem"
|
||||
val movies = fetchPlayers(moviesUrl).ifEmpty { return@flatMapIndexed emptyList() }
|
||||
val movieNameRegex = Regex("^\\s*newSPF\\(\"(.*)\"\\);", RegexOption.MULTILINE)
|
||||
val moviesDoc = client.newCall(GET(moviesUrl)).execute().use { it.body.string() }
|
||||
val matches = movieNameRegex.findAll(moviesDoc).toList()
|
||||
List(movies.size) { i ->
|
||||
val title = when {
|
||||
animeIndex == 0 && movies.size == 1 -> animeName
|
||||
matches.size > i -> "$animeName ${matches[i].destructured.component1()}"
|
||||
movies.size == 1 -> "$animeName Film"
|
||||
else -> "$animeName Film ${i + 1}"
|
||||
}
|
||||
Triple(title, "$moviesUrl#$i", SAnime.COMPLETED)
|
||||
}
|
||||
} else {
|
||||
listOf(Triple("$animeName $seasonName", "$animeUrl/$seasonStem", SAnime.UNKNOWN))
|
||||
}
|
||||
}
|
||||
|
||||
return animes.map {
|
||||
SAnime.create().apply {
|
||||
title = it.first
|
||||
thumbnail_url = animeDoc.getElementById("coverOeuvre")?.attr("src")
|
||||
description = animeDoc.select("h2:contains(synopsis) + p").text()
|
||||
genre = animeDoc.select("h2:contains(genres) + a").text()
|
||||
setUrlWithoutDomain(it.second)
|
||||
status = it.third
|
||||
initialized = true
|
||||
}
|
||||
}.toList()
|
||||
}
|
||||
|
||||
private fun playersToEpisodes(list: List<List<List<String>>>): List<SEpisode> =
|
||||
List(list.fold(0) { acc, it -> maxOf(acc, it.size) }) { episodeNumber ->
|
||||
val players = list.map { it.getOrElse(episodeNumber) { emptyList() } }
|
||||
SEpisode.create().apply {
|
||||
name = "Episode ${episodeNumber + 1}"
|
||||
url = json.encodeToString(players)
|
||||
episode_number = (episodeNumber + 1).toFloat()
|
||||
scanlator = players.mapIndexedNotNull { i, it -> if (it.isNotEmpty()) VOICES_VALUES[i] else null }.joinToString().uppercase()
|
||||
}
|
||||
}
|
||||
|
||||
private fun fetchPlayers(url: String): List<List<String>> {
|
||||
val docUrl = "$url/episodes.js"
|
||||
val players = mutableListOf<List<String>>()
|
||||
val doc = client.newCall(GET(docUrl)).execute().use {
|
||||
if (it.code != 200) return listOf()
|
||||
it.body.string()
|
||||
}
|
||||
val sanitizedDoc = sanitizeEpisodesJs(doc)
|
||||
for (i in 1..8) {
|
||||
val numPlayers = getPlayers("eps$i", sanitizedDoc)
|
||||
if (numPlayers != null) players.add(numPlayers)
|
||||
}
|
||||
val asPlayers = getPlayers("epsAS", sanitizedDoc)
|
||||
if (asPlayers != null) players.add(asPlayers)
|
||||
return List(players[0].size) { i -> players.mapNotNull { it.getOrNull(i) }.distinct() }
|
||||
}
|
||||
|
||||
private fun getPlayers(playerName: String, doc: String): List<String>? {
|
||||
val playerRegex = Regex("$playerName\\s*=\\s*(\\[.*?])", RegexOption.DOT_MATCHES_ALL)
|
||||
val string = playerRegex.find(doc)?.groupValues?.get(1)
|
||||
return if (string != null) json.decodeFromString<List<String>>(string) else null
|
||||
}
|
||||
|
||||
override fun setupPreferenceScreen(screen: PreferenceScreen) {
|
||||
ListPreference(screen.context).apply {
|
||||
key = PREF_QUALITY_KEY
|
||||
title = "Preferred quality"
|
||||
entries = arrayOf("1080p", "720p", "480p", "360p")
|
||||
entryValues = arrayOf("1080", "720", "480", "360")
|
||||
setDefaultValue(PREF_QUALITY_DEFAULT)
|
||||
summary = "%s"
|
||||
|
||||
setOnPreferenceChangeListener { _, newValue ->
|
||||
val selected = newValue as String
|
||||
val index = findIndexOfValue(selected)
|
||||
val entry = entryValues[index] as String
|
||||
preferences.edit().putString(key, entry).commit()
|
||||
}
|
||||
}.also(screen::addPreference)
|
||||
|
||||
ListPreference(screen.context).apply {
|
||||
key = PREF_VOICES_KEY
|
||||
title = "Préférence des voix"
|
||||
entries = VOICES
|
||||
entryValues = VOICES_VALUES
|
||||
setDefaultValue(PREF_VOICES_DEFAULT)
|
||||
summary = "%s"
|
||||
|
||||
setOnPreferenceChangeListener { _, newValue ->
|
||||
val selected = newValue as String
|
||||
val index = findIndexOfValue(selected)
|
||||
val entry = entryValues[index] as String
|
||||
preferences.edit().putString(key, entry).commit()
|
||||
}
|
||||
}.also(screen::addPreference)
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val PREFIX_SEARCH = "id:"
|
||||
|
||||
private val VOICES = arrayOf(
|
||||
"Préférer VOSTFR",
|
||||
"Préférer VF",
|
||||
)
|
||||
|
||||
private val VOICES_VALUES = arrayOf(
|
||||
"vostfr",
|
||||
"vf",
|
||||
)
|
||||
|
||||
private const val PREF_VOICES_KEY = "voices_preference"
|
||||
private const val PREF_VOICES_DEFAULT = "vostfr"
|
||||
|
||||
private const val PREF_QUALITY_KEY = "preferred_quality"
|
||||
private const val PREF_QUALITY_DEFAULT = "1080"
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package eu.kanade.tachiyomi.animeextension.fr.animesama
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.ActivityNotFoundException
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import kotlin.system.exitProcess
|
||||
|
||||
/**
|
||||
* Springboard that accepts www.anime-sama.fr/anime/<item> intents
|
||||
* and redirects them to the main Aniyomi process.
|
||||
*/
|
||||
class AnimeSamaUrlActivity : Activity() {
|
||||
|
||||
private val tag = javaClass.simpleName
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
val pathSegments = intent?.data?.pathSegments
|
||||
if (pathSegments != null && pathSegments.size > 1) {
|
||||
val item = pathSegments[1]
|
||||
val mainIntent = Intent().apply {
|
||||
action = "eu.kanade.tachiyomi.ANIMESEARCH"
|
||||
putExtra("query", "${AnimeSama.PREFIX_SEARCH}$item")
|
||||
putExtra("filter", packageName)
|
||||
}
|
||||
|
||||
try {
|
||||
startActivity(mainIntent)
|
||||
} catch (e: ActivityNotFoundException) {
|
||||
Log.e(tag, e.toString())
|
||||
}
|
||||
} else {
|
||||
Log.e(tag, "could not parse uri from intent $intent")
|
||||
}
|
||||
|
||||
finish()
|
||||
exitProcess(0)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user