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

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"
app:mediaRouteButtonTint="?attr/textColor" />
<!--
<ImageView
android:visibility="gone"
android:nextFocusUp="@id/result_back"
@ -221,7 +222,7 @@
android:src="@drawable/ic_baseline_add_24"
android:layout_gravity="end|center_vertical"
android:contentDescription="@string/add_sync"
app:tint="?attr/textColor" />
app:tint="?attr/textColor" />-->
<ImageView
android:nextFocusUp="@id/result_back"
@ -398,6 +399,7 @@
</LinearLayout>
<com.google.android.material.button.MaterialButton
tools:visibility="gone"
android:layout_marginTop="0dp"
android:paddingTop="0dp"
android:layout_marginStart="0dp"
@ -451,12 +453,135 @@
android:textStyle="normal"
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
android:id="@+id/result_tag"
android:layout_width="match_parent"
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
tools:visibility="gone"
android:layout_marginTop="5dp"
android:orientation="vertical"
android:id="@+id/result_movie_parent"
@ -503,6 +628,7 @@
android:id="@+id/result_movie_progress_downloaded"
android:indeterminate="false"
style="?android:attr/progressBarStyleHorizontal"
android:progressBackgroundTint="?attr/colorPrimary"
android:max="100"
android:layout_gravity="end|center_vertical"
android:progress="0"
@ -632,8 +758,9 @@
android:id="@+id/result_episodes_text"
tools:text="8 Episodes"
android:textSize="17sp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:layout_gravity="center_vertical"
android:textStyle="normal"
android:textColor="?attr/textColor" />
</LinearLayout>

View File

@ -174,6 +174,12 @@
<item name="android:colorAccent">@color/colorPrimaryPink</item>
</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">
<item name="android:navigationBarColor">?attr/primaryGrayBackground</item>
<item name="android:windowBackground">?attr/primaryBlackBackground</item>