diff --git a/src/id/samehadaku/AndroidManifest.xml b/src/id/samehadaku/AndroidManifest.xml new file mode 100644 index 0000000000..568741e54f --- /dev/null +++ b/src/id/samehadaku/AndroidManifest.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/src/id/samehadaku/build.gradle b/src/id/samehadaku/build.gradle new file mode 100644 index 0000000000..5ebae04eed --- /dev/null +++ b/src/id/samehadaku/build.gradle @@ -0,0 +1,12 @@ +apply plugin: 'com.android.application' +apply plugin: 'kotlin-android' + +ext { + extName = 'Samehadaku' + pkgNameSuffix = 'id.samehadaku' + extClass = '.Samehadaku' + extVersionCode = 1 + libVersion = '13' +} + +apply from: "$rootDir/common.gradle" \ No newline at end of file diff --git a/src/id/samehadaku/res/mipmap-hdpi/ic_launcher.png b/src/id/samehadaku/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000000..1804042606 Binary files /dev/null and b/src/id/samehadaku/res/mipmap-hdpi/ic_launcher.png differ diff --git a/src/id/samehadaku/res/mipmap-mdpi/ic_launcher.png b/src/id/samehadaku/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000000..ab24e0bb31 Binary files /dev/null and b/src/id/samehadaku/res/mipmap-mdpi/ic_launcher.png differ diff --git a/src/id/samehadaku/res/mipmap-xhdpi/ic_launcher.png b/src/id/samehadaku/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000000..8d3bf8339a Binary files /dev/null and b/src/id/samehadaku/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/src/id/samehadaku/res/mipmap-xxhdpi/ic_launcher.png b/src/id/samehadaku/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000000..8ab55a129c Binary files /dev/null and b/src/id/samehadaku/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/src/id/samehadaku/res/mipmap-xxxhdpi/ic_launcher.png b/src/id/samehadaku/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000000..d294860b51 Binary files /dev/null and b/src/id/samehadaku/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/src/id/samehadaku/res/web_hi_res_512.png b/src/id/samehadaku/res/web_hi_res_512.png new file mode 100644 index 0000000000..b8a3e6a8da Binary files /dev/null and b/src/id/samehadaku/res/web_hi_res_512.png differ diff --git a/src/id/samehadaku/src/eu/kanade/tachiyomi/animeextension/id/samehadaku/Samehadaku.kt b/src/id/samehadaku/src/eu/kanade/tachiyomi/animeextension/id/samehadaku/Samehadaku.kt new file mode 100644 index 0000000000..4b20a3fc50 --- /dev/null +++ b/src/id/samehadaku/src/eu/kanade/tachiyomi/animeextension/id/samehadaku/Samehadaku.kt @@ -0,0 +1,249 @@ +package eu.kanade.tachiyomi.animeextension.id.samehadaku + +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.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.network.POST +import eu.kanade.tachiyomi.util.asJsoup +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.async +import kotlinx.coroutines.awaitAll +import kotlinx.coroutines.runBlocking +import okhttp3.FormBody +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.text.SimpleDateFormat +import java.util.Locale + +class Samehadaku : ConfigurableAnimeSource, ParsedAnimeHttpSource() { + override val name: String = "Samehadaku" + override val baseUrl: String = "https://samehadaku.vin" + override val lang: String = "id" + override val supportsLatest: Boolean = true + + private val preferences: SharedPreferences by lazy { + Injekt.get().getSharedPreferences("source_$id", 0x0000) + } + + // ============================== Popular =============================== + + override fun popularAnimeRequest(page: Int): Request = + GET("$baseUrl/daftar-anime-2/page/$page/?order=popular") + + override fun popularAnimeSelector(): String = "div.relat > article" + + override fun popularAnimeFromElement(element: Element): SAnime = + getAnimeFromAnimeElement(element) + + override fun popularAnimeNextPageSelector(): String = "div.pagination > a.arrow_pag" + + // =============================== Latest =============================== + + override fun latestUpdatesRequest(page: Int): Request = + GET("$baseUrl/daftar-anime-2/page/$page/?order=latest") + + override fun latestUpdatesSelector(): String = "div.relat > article" + + override fun latestUpdatesFromElement(element: Element): SAnime = + getAnimeFromAnimeElement(element) + + override fun latestUpdatesNextPageSelector(): String = "div.pagination > a.arrow_pag" + + // =============================== Search =============================== + + override fun searchAnimeRequest(page: Int, query: String, filters: AnimeFilterList): Request = + GET("$baseUrl/page/$page/?s=$query") + + override fun searchAnimeSelector(): String = "main.site-main.relat > article" + + override fun searchAnimeFromElement(element: Element): SAnime = + getAnimeFromAnimeElement(element) + + override fun searchAnimeNextPageSelector(): String = "div.pagination > a.arrow_pag" + + // =========================== Anime Details ============================ + + override fun animeDetailsParse(document: Document): SAnime { + val detail = document.selectFirst("div.infox > div.spe")!! + return SAnime.create().apply { + author = detail.getInfo("Studio") + status = parseStatus(detail.getInfo("Status")) + title = document.selectFirst("h3.anim-detail")!!.text().split("Detail Anime ")[1] + thumbnail_url = + document.selectFirst("div.infoanime.widget_senction > div.thumb > img")!! + .attr("src") + description = + document.selectFirst("div.entry-content.entry-content-single > p")!!.text() + } + } + + // ============================== Episodes ============================== + + override fun episodeListSelector(): String = + "div.whites.lsteps.widget_senction > div.lstepsiode.listeps > ul > li" + + override fun episodeFromElement(element: Element): SEpisode { + val episode = element.selectFirst("span.eps > a")!!.text() + return SEpisode.create().apply { + setUrlWithoutDomain(element.selectFirst("a")!!.attr("href")) + episode_number = episode.toFloatOrNull() ?: 1F + name = element.selectFirst("span.lchx > a")!!.text() + date_upload = element.selectFirst("span.date")!!.text().toDate() + } + } + + // ============================ Video Links ============================= + + override fun videoListSelector(): String = "#server > ul > li > div" + + override fun videoListParse(response: Response): List