diff --git a/src/ar/mycima/AndroidManifest.xml b/src/ar/mycima/AndroidManifest.xml new file mode 100644 index 000000000..acb4de356 --- /dev/null +++ b/src/ar/mycima/AndroidManifest.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/src/ar/mycima/build.gradle b/src/ar/mycima/build.gradle new file mode 100644 index 000000000..7725e9b32 --- /dev/null +++ b/src/ar/mycima/build.gradle @@ -0,0 +1,12 @@ +apply plugin: 'com.android.application' +apply plugin: 'kotlin-android' + +ext { + extName = 'MY CIMA' + pkgNameSuffix = 'ar.mycima' + extClass = '.MyCima' + extVersionCode = 7 + libVersion = '12' +} + +apply from: "$rootDir/common.gradle" diff --git a/src/ar/mycima/res/mipmap-hdpi/ic_launcher.png b/src/ar/mycima/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 000000000..703506431 Binary files /dev/null and b/src/ar/mycima/res/mipmap-hdpi/ic_launcher.png differ diff --git a/src/ar/mycima/res/mipmap-mdpi/ic_launcher.png b/src/ar/mycima/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 000000000..e0bb5f558 Binary files /dev/null and b/src/ar/mycima/res/mipmap-mdpi/ic_launcher.png differ diff --git a/src/ar/mycima/res/mipmap-xhdpi/ic_launcher.png b/src/ar/mycima/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 000000000..c8ad995c6 Binary files /dev/null and b/src/ar/mycima/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/src/ar/mycima/res/mipmap-xxhdpi/ic_launcher.png b/src/ar/mycima/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 000000000..2c5106544 Binary files /dev/null and b/src/ar/mycima/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/src/ar/mycima/res/mipmap-xxxhdpi/ic_launcher.png b/src/ar/mycima/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 000000000..b942c0746 Binary files /dev/null and b/src/ar/mycima/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/src/ar/mycima/res/web_hi_res_512.png b/src/ar/mycima/res/web_hi_res_512.png new file mode 100644 index 000000000..891dac02f Binary files /dev/null and b/src/ar/mycima/res/web_hi_res_512.png differ diff --git a/src/ar/mycima/src/eu/kanade/tachiyomi/animeextension/ar/mycima/MyCima.kt b/src/ar/mycima/src/eu/kanade/tachiyomi/animeextension/ar/mycima/MyCima.kt new file mode 100644 index 000000000..97e0e6367 --- /dev/null +++ b/src/ar/mycima/src/eu/kanade/tachiyomi/animeextension/ar/mycima/MyCima.kt @@ -0,0 +1,261 @@ +package eu.kanade.tachiyomi.animeextension.ar.mycima + +import android.app.Application +import android.content.SharedPreferences +import androidx.preference.ListPreference +import androidx.preference.PreferenceScreen +import com.google.gson.JsonParser +import eu.kanade.tachiyomi.animesource.ConfigurableAnimeSource +import eu.kanade.tachiyomi.animesource.model.AnimeFilter +import eu.kanade.tachiyomi.animesource.model.AnimeFilterList +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.ParsedAnimeHttpSource +import eu.kanade.tachiyomi.network.GET +import eu.kanade.tachiyomi.util.asJsoup +import okhttp3.Headers.Companion.toHeaders +import okhttp3.OkHttpClient +import okhttp3.Request +import okhttp3.Response +import org.jsoup.nodes.Document +import org.jsoup.nodes.Element +import uy.kohesive.injekt.Injekt +import uy.kohesive.injekt.api.get +import java.lang.Exception + +class MyCima : ConfigurableAnimeSource, ParsedAnimeHttpSource() { + + override val name = "MY Cima" + + override val baseUrl = "https://mycima.ink" + + override val lang = "ar" + + override val supportsLatest = true + + override val client: OkHttpClient = network.cloudflareClient + + private val preferences: SharedPreferences by lazy { + Injekt.get().getSharedPreferences("source_$id", 0x0000) + } + + // Popular Anime + + override fun popularAnimeSelector(): String = "div.Grid--MycimaPosts div.GridItem div.Thumb--GridItem" + + override fun popularAnimeRequest(page: Int): Request = GET("$baseUrl/seriestv/top/?page_number=$page") + + override fun popularAnimeFromElement(element: Element): SAnime { + val anime = SAnime.create() + anime.setUrlWithoutDomain(element.select("a").attr("href")) + anime.title = element.select("a").attr("title") + anime.thumbnail_url = + element.select("a > span.BG--GridItem") + .attr("data-lazy-style") + .substringAfter("-image:url(") + .substringBefore(");") + return anime + } + + override fun popularAnimeNextPageSelector(): String = "ul.page-numbers li a.next" + + // Episodes + + private fun seasonsNextPageSelector(seasonNumber: Int) = "div.List--Seasons--Episodes > a:nth-child($seasonNumber)" + + override fun episodeListParse(response: Response): List { + val episodes = mutableListOf() + + var seasonNumber = 1 + fun addEpisodes(document: Document) { + document.select(episodeListSelector()).map { episodes.add(episodeFromElement(it)) } + document.select(seasonsNextPageSelector(seasonNumber)).firstOrNull()?.let { + seasonNumber++ + addEpisodes(client.newCall(GET(it.attr("abs:href"), headers)).execute().asJsoup()) + } + } + + addEpisodes(response.asJsoup()) + return episodes + } + + override fun episodeListSelector() = "div.Episodes--Seasons--Episodes a, div.List--Seasons--Episodes a.selected" + + override fun episodeFromElement(element: Element): SEpisode { + val episode = SEpisode.create() + episode.setUrlWithoutDomain(element.attr("abs:href")) + episode.episode_number = element.text().removePrefix("موسم ").removePrefix("الحلقة ").replace("مدبلج", "").replace(" -", "").toFloat() + episode.name = element.text() + episode.date_upload = System.currentTimeMillis() + return episode + } + + // Video urls + + override fun videoListParse(response: Response): List