fixed arab site

This commit is contained in:
LagradOst 2022-01-15 20:51:30 +01:00
parent ad3b775787
commit ef9d6e11a7
8 changed files with 215 additions and 30 deletions

View file

@ -7,7 +7,6 @@ import com.lagradost.cloudstream3.utils.Qualities
import org.jsoup.nodes.Element import org.jsoup.nodes.Element
class AkwamProvider : MainAPI() { class AkwamProvider : MainAPI() {
override val lang = "ar" override val lang = "ar"
override val mainUrl = "https://akwam.io" override val mainUrl = "https://akwam.io"
override val name = "Akwam" override val name = "Akwam"
@ -15,8 +14,9 @@ class AkwamProvider : MainAPI() {
override val hasMainPage = true override val hasMainPage = true
override val supportedTypes = setOf(TvType.TvSeries, TvType.Movie, TvType.Anime, TvType.Cartoon) override val supportedTypes = setOf(TvType.TvSeries, TvType.Movie, TvType.Anime, TvType.Cartoon)
private fun Element.toSearchResponse(): SearchResponse { private fun Element.toSearchResponse(): SearchResponse? {
val url = select("a.box").attr("href") val url = select("a.box")?.attr("href") ?: return null
if(url.contains("/games/") || url.contains("/programs/")) return null
val poster = select("picture > img") val poster = select("picture > img")
val title = poster.attr("alt") val title = poster.attr("alt")
val posterUrl = poster.attr("data-src") val posterUrl = poster.attr("data-src")
@ -34,12 +34,16 @@ class AkwamProvider : MainAPI() {
) )
} }
override fun getMainPage(): HomePageResponse? { override fun getMainPage(): HomePageResponse {
// Title, Url // Title, Url
val moviesUrl = listOf("Movies" to "$mainUrl/movies", "Series" to "$mainUrl/series", "Shows" to "$mainUrl/shows") val moviesUrl = listOf(
"Movies" to "$mainUrl/movies",
"Series" to "$mainUrl/series",
"Shows" to "$mainUrl/shows"
)
val pages = moviesUrl.pmap { val pages = moviesUrl.pmap {
val doc = app.get(it.second).document val doc = app.get(it.second).document
val list = doc.select("div.col-lg-auto.col-md-4.col-6.mb-12").map { element -> val list = doc.select("div.col-lg-auto.col-md-4.col-6.mb-12").mapNotNull { element ->
element.toSearchResponse() element.toSearchResponse()
} }
HomePageList(it.first, list) HomePageList(it.first, list)
@ -50,7 +54,7 @@ class AkwamProvider : MainAPI() {
override fun search(query: String): List<SearchResponse> { override fun search(query: String): List<SearchResponse> {
val url = "$mainUrl/search?q=$query" val url = "$mainUrl/search?q=$query"
val doc = app.get(url).document val doc = app.get(url).document
return doc.select("div.col-lg-auto").map { return doc.select("div.col-lg-auto").mapNotNull {
it.toSearchResponse() it.toSearchResponse()
} }
} }
@ -122,11 +126,8 @@ class AkwamProvider : MainAPI() {
rating, rating,
tags, tags,
duration, duration,
null,
null
) )
} else { } else {
val episodes = doc.select("div.bg-primary2.p-4.col-lg-4.col-md-6.col-12").map { val episodes = doc.select("div.bg-primary2.p-4.col-lg-4.col-md-6.col-12").map {
it.toTvSeriesEpisode() it.toTvSeriesEpisode()
}.let { }.let {
@ -136,23 +137,14 @@ class AkwamProvider : MainAPI() {
else it else it
} }
TvSeriesLoadResponse( newTvSeriesLoadResponse(title, url, TvType.TvSeries, episodes) {
title, this.duration = duration
url, this.posterUrl = posterUrl
this@AkwamProvider.name, this.tags = tags.filterNotNull()
TvType.Movie, this.rating = rating
episodes, this.year = year
posterUrl, this.plot = synopsis
year, }
synopsis,
null,
null,
rating,
tags,
duration,
null,
null
)
} }
} }

View file

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background"
android:drawable="@drawable/rating_empty"/>
<item android:id="@android:id/secondaryProgress"
android:drawable="@drawable/rating_empty"
/>
<item android:id="@android:id/progress"
android:drawable="@drawable/rating_fill"
/>
</layer-list>

View file

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M22,9.24l-7.19,-0.62L12,2 9.19,8.63 2,9.24l5.46,4.73L5.82,21 12,17.27 18.18,21l-1.63,-7.03L22,9.24zM12,15.4l-3.76,2.27 1,-4.28 -3.32,-2.88 4.38,-0.38L12,6.1l1.71,4.04 4.38,0.38 -3.32,2.88 1,4.28L12,15.4z"/>
</vector>

View file

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"
android:state_window_focused="true"
android:drawable="@drawable/ic_baseline_star_border_24"/>
<item android:state_focused="true"
android:state_window_focused="true"
android:drawable="@drawable/ic_baseline_star_border_24"/>
<item android:state_selected="true"
android:state_window_focused="true"
android:drawable="@drawable/ic_baseline_star_border_24"/>
<item
android:drawable="@drawable/ic_baseline_star_border_24"/>
</selector>

View file

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"
android:state_window_focused="true"
android:drawable="@drawable/ic_baseline_star_24"/>
<item android:state_focused="true"
android:state_window_focused="true"
android:drawable="@drawable/ic_baseline_star_24"/>
<item android:state_selected="true"
android:state_window_focused="true"
android:drawable="@drawable/ic_baseline_star_24"/>
<item
android:drawable="@drawable/ic_baseline_star_24"/>
</selector>

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="?attr/colorPrimary" />
<corners android:radius="5dp" />
</shape>

View file

@ -204,6 +204,7 @@
android:visibility="gone" android:visibility="gone"
app:mediaRouteButtonTint="?attr/textColor" /> app:mediaRouteButtonTint="?attr/textColor" />
<!--
<ImageView <ImageView
android:visibility="gone" android:visibility="gone"
android:nextFocusUp="@id/result_back" android:nextFocusUp="@id/result_back"
@ -221,7 +222,7 @@
android:src="@drawable/ic_baseline_add_24" android:src="@drawable/ic_baseline_add_24"
android:layout_gravity="end|center_vertical" android:layout_gravity="end|center_vertical"
android:contentDescription="@string/add_sync" android:contentDescription="@string/add_sync"
app:tint="?attr/textColor" /> app:tint="?attr/textColor" />-->
<ImageView <ImageView
android:nextFocusUp="@id/result_back" android:nextFocusUp="@id/result_back"
@ -398,6 +399,7 @@
</LinearLayout> </LinearLayout>
<com.google.android.material.button.MaterialButton <com.google.android.material.button.MaterialButton
tools:visibility="gone"
android:layout_marginTop="0dp" android:layout_marginTop="0dp"
android:paddingTop="0dp" android:paddingTop="0dp"
android:layout_marginStart="0dp" android:layout_marginStart="0dp"
@ -451,12 +453,135 @@
android:textStyle="normal" android:textStyle="normal"
android:textColor="?attr/textColor" /> android:textColor="?attr/textColor" />
<LinearLayout
android:visibility="gone"
android:layout_marginBottom="10dp"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:textStyle="bold"
android:textSize="16sp"
android:text="MyAnimeList"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<LinearLayout
android:visibility="visible"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:padding="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:src="@drawable/ic_baseline_add_24"
android:layout_gravity="end|center_vertical"
android:contentDescription="@string/result_share"
app:tint="?attr/textColor" />
<TextView
android:layout_gravity="center_vertical"
android:padding="10dp"
android:textSize="17sp"
android:textColor="?attr/textColor"
android:text="24/30"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<androidx.core.widget.ContentLoadingProgressBar
android:layout_width="match_parent"
android:layout_height="20dp"
android:progress="50"
android:indeterminate="false"
android:progressBackgroundTint="?attr/colorPrimary"
style="?android:attr/progressBarStyleHorizontal"
android:max="100"
android:layout_gravity="end|center_vertical"
tools:visibility="visible" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_gravity="center_vertical"
android:padding="10dp"
android:textSize="17sp"
android:textColor="?attr/textColor"
android:text="Rated:"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<com.google.android.material.button.MaterialButton
android:layout_height="30dp"
android:text="7/10"
android:minWidth="0dp"
android:layout_width="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="0dp"
style="@style/BlackButton" />
<TextView
android:layout_gravity="center_vertical"
android:padding="10dp"
android:textSize="17sp"
android:textColor="?attr/textColor"
android:text="Status:"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<com.google.android.material.button.MaterialButton
android:layout_height="30dp"
android:text="Watching"
android:minWidth="0dp"
android:layout_width="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="0dp"
style="@style/BlackButton" />
</LinearLayout>
<FrameLayout
android:visibility="gone"
android:paddingTop="12dp"
android:paddingBottom="12dp"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/home_parent_item_title"
style="@style/WatchHeaderText"
tools:text="Recommended"
/>
<ImageView
app:tint="?attr/textColor"
android:layout_marginEnd="5dp"
android:layout_gravity="end|center_vertical"
android:src="@drawable/ic_baseline_arrow_forward_24"
android:layout_width="30dp"
android:layout_height="match_parent"
android:contentDescription="@string/home_more_info">
</ImageView>
</FrameLayout>
</LinearLayout>
<com.lagradost.cloudstream3.widget.FlowLayout <com.lagradost.cloudstream3.widget.FlowLayout
android:id="@+id/result_tag" android:id="@+id/result_tag"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
<com.google.android.material.button.MaterialButton
android:visibility="gone"
android:text="@string/add_sync"
android:layout_width="match_parent"
app:icon="@drawable/ic_baseline_add_24"
android:id="@+id/result_add_sync"
android:layout_gravity="center_vertical"
android:layout_marginStart="0dp"
android:layout_marginBottom="10dp"
style="@style/WhiteButton" />
<LinearLayout <LinearLayout
tools:visibility="gone"
android:layout_marginTop="5dp" android:layout_marginTop="5dp"
android:orientation="vertical" android:orientation="vertical"
android:id="@+id/result_movie_parent" android:id="@+id/result_movie_parent"
@ -503,6 +628,7 @@
android:id="@+id/result_movie_progress_downloaded" android:id="@+id/result_movie_progress_downloaded"
android:indeterminate="false" android:indeterminate="false"
style="?android:attr/progressBarStyleHorizontal" style="?android:attr/progressBarStyleHorizontal"
android:progressBackgroundTint="?attr/colorPrimary"
android:max="100" android:max="100"
android:layout_gravity="end|center_vertical" android:layout_gravity="end|center_vertical"
android:progress="0" android:progress="0"
@ -632,8 +758,9 @@
android:id="@+id/result_episodes_text" android:id="@+id/result_episodes_text"
tools:text="8 Episodes" tools:text="8 Episodes"
android:textSize="17sp" android:textSize="17sp"
android:layout_marginTop="10dp" android:paddingTop="10dp"
android:layout_marginBottom="10dp" android:paddingBottom="10dp"
android:layout_gravity="center_vertical"
android:textStyle="normal" android:textStyle="normal"
android:textColor="?attr/textColor" /> android:textColor="?attr/textColor" />
</LinearLayout> </LinearLayout>

View file

@ -174,6 +174,12 @@
<item name="android:colorAccent">@color/colorPrimaryPink</item> <item name="android:colorAccent">@color/colorPrimaryPink</item>
</style> </style>
<style name="customRatingBar" parent="@style/Widget.AppCompat.RatingBar">
<item name="android:progressDrawable">@drawable/abc_ratingbar_indicator_material</item>
<item name="android:indeterminateDrawable">@drawable/abc_ratingbar_indicator_material</item>
</style>
<style name="LoadedStyle"> <style name="LoadedStyle">
<item name="android:navigationBarColor">?attr/primaryGrayBackground</item> <item name="android:navigationBarColor">?attr/primaryGrayBackground</item>
<item name="android:windowBackground">?attr/primaryBlackBackground</item> <item name="android:windowBackground">?attr/primaryBlackBackground</item>