From 6c477f9e1a5a830bb77ea03caa5dae1d97c4c0d5 Mon Sep 17 00:00:00 2001
From: Blatzar <46196380+Blatzar@users.noreply.github.com>
Date: Sat, 9 Jul 2022 15:24:12 +0200
Subject: [PATCH] Fixes to Streamingcommunity and Filman.cc
---
app/src/main/AndroidManifest.xml | 2 +-
.../cloudstream3/movieproviders/FilmanProvider.kt | 12 ++++++++++--
.../movieproviders/StreamingcommunityProvider.kt | 4 ++--
docs/providers.json | 2 +-
4 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index b80154b2..2fd8bb3d 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -114,7 +114,7 @@
-
+
diff --git a/app/src/main/java/com/lagradost/cloudstream3/movieproviders/FilmanProvider.kt b/app/src/main/java/com/lagradost/cloudstream3/movieproviders/FilmanProvider.kt
index 8cf5f753..c82fff2e 100644
--- a/app/src/main/java/com/lagradost/cloudstream3/movieproviders/FilmanProvider.kt
+++ b/app/src/main/java/com/lagradost/cloudstream3/movieproviders/FilmanProvider.kt
@@ -3,6 +3,8 @@ package com.lagradost.cloudstream3.movieproviders
import com.fasterxml.jackson.annotation.JsonProperty
import com.fasterxml.jackson.module.kotlin.readValue
import com.lagradost.cloudstream3.*
+import com.lagradost.cloudstream3.utils.AppUtils.parseJson
+import com.lagradost.cloudstream3.utils.AppUtils.tryParseJson
import com.lagradost.cloudstream3.utils.ExtractorLink
import com.lagradost.cloudstream3.utils.loadExtractor
import org.jsoup.Jsoup
@@ -86,10 +88,16 @@ class FilmanProvider : MainAPI() {
override suspend fun load(url: String): LoadResponse {
val response = app.get(url).text
val document = Jsoup.parse(response)
+ val documentTitle = document.select("title").text().trim()
+
+ if (documentTitle.startsWith("Logowanie")){
+ throw RuntimeException("This page seems to be locked behind a login-wall on the website, unable to scrape it. If it is not please report it.")
+ }
+
var title = document.select("span[itemprop=title]").text()
val data = document.select("#links").outerHtml()
val posterUrl = document.select("#single-poster > img").attr("src")
- val year = document.select(".info > ul li")[1].text().toIntOrNull()
+ val year = document.select(".info > ul li").getOrNull(0)?.text()?.toIntOrNull()
val plot = document.select(".description").text()
val episodesElements = document.select("#episode-list a[href]")
if (episodesElements.isEmpty()) {
@@ -132,7 +140,7 @@ class FilmanProvider : MainAPI() {
document?.select(".link-to-video")?.apmap { item ->
val decoded = base64Decode(item.select("a").attr("data-iframe"))
- val link = mapper.readValue(decoded).src
+ val link = tryParseJson(decoded)?.src ?: return@apmap
loadExtractor(link, null, callback)
}
return true
diff --git a/app/src/main/java/com/lagradost/cloudstream3/movieproviders/StreamingcommunityProvider.kt b/app/src/main/java/com/lagradost/cloudstream3/movieproviders/StreamingcommunityProvider.kt
index 2196caa9..209bca6d 100644
--- a/app/src/main/java/com/lagradost/cloudstream3/movieproviders/StreamingcommunityProvider.kt
+++ b/app/src/main/java/com/lagradost/cloudstream3/movieproviders/StreamingcommunityProvider.kt
@@ -128,7 +128,7 @@ data class TrailerElement(
class StreamingcommunityProvider : MainAPI() {
override var lang = "it"
- override var mainUrl = "https://streamingcommunity.business"
+ override var mainUrl = "https://streamingcommunity.org"
override var name = "Streamingcommunity"
override val hasMainPage = true
override val hasChromecastSupport = true
@@ -177,7 +177,7 @@ class StreamingcommunityProvider : MainAPI() {
override suspend fun getMainPage(): HomePageResponse {
val items = ArrayList()
val document = app.get(mainUrl).document
- document.select("slider-title").subList(2, 6).map { it ->
+ document.select("slider-title").subList(0, 6).map { it ->
if (it.attr("slider-name") != "In arrivo") {
val films = it.attr("titles-json")
val lista = mutableListOf()
diff --git a/docs/providers.json b/docs/providers.json
index 7050c1f0..d06b9fbb 100644
--- a/docs/providers.json
+++ b/docs/providers.json
@@ -455,7 +455,7 @@
"language": "it",
"name": "Streamingcommunity",
"status": 1,
- "url": "https://streamingcommunity.business"
+ "url": "https://streamingcommunity.org"
},
"TantifilmProvider": {
"language": "it",