From a5c467669886a2c5dd52cffebe7726e180f04302 Mon Sep 17 00:00:00 2001 From: UrloMythus Date: Thu, 11 Jul 2024 15:37:34 +0200 Subject: [PATCH] Fixed StreamingCommunity version --- filmpertutti.py | 11 ++++++++--- streamingcommunity.py | 27 ++++++++++++++++++++++++--- 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/filmpertutti.py b/filmpertutti.py index 1f991ae..79f72b5 100644 --- a/filmpertutti.py +++ b/filmpertutti.py @@ -46,8 +46,9 @@ def search(query,date): if release_date == date: url = link tid = tid - break - return url, tid + return url, tid + else: + print("Date are not equals") def get_episode_link(season,episode,tid,url): #Get the link from where we have to obtain mixdrop link @@ -101,7 +102,11 @@ def filmpertutti(imdb): showname = showname.replace(" ", "+").replace("–", "+").replace("—","+") #Build the query query = f'https://filmpertutti.{FT_DOMAIN}/wp-json/wp/v2/posts?search={showname}&page=1&_fields=link,id' - url,tid = search(query,date) + try: + url,tid = search(query,date) + except: + print("No results found") + return None if ismovie == 0: episode_link = get_episode_link(season,episode,tid,url) #Let's get mixdrop link diff --git a/streamingcommunity.py b/streamingcommunity.py index 0d06f77..7f1c0c3 100644 --- a/streamingcommunity.py +++ b/streamingcommunity.py @@ -7,6 +7,7 @@ import dateparser from convert import get_TMDb_id_from_IMDb_id from info import get_info, is_movie import config +import json #Get domain SC_DOMAIN= config.SC_DOMAIN @@ -15,6 +16,25 @@ headers = { 'Accept-Language': 'en-US,en;q=0.5' } +#GET VERSION OF STREAMING COMMUNITY: +def get_version(): + #Extract the version from the main page of the site + + + try: + base_url = f'https://streamingcommunity.{SC_DOMAIN}/richiedi-un-titolo' + response = requests.get(base_url, headers=headers) + #Soup the response + soup = BeautifulSoup(response.text, "lxml") + + # Extract version + version = json.loads(soup.find("div", {"id": "app"}).get("data-page"))['version'] + return version + except: + print("Couldn't find the version") + version = "65e52dcf34d64173542cd2dc6b8bb75b" + return version + def search(query): #Do a request to get the ID of serie/move and it's slug in the URL response = requests.get(query).json() @@ -37,13 +57,13 @@ def get_film(tid): url = f'https://vixcloud.co/playlist/{vixid}' return url -def get_season_episode_id(tid,slug,season,episode): +def get_season_episode_id(tid,slug,season,episode,version): #Set some basic headers for the request headers = { 'user-agent': "Mozilla/5.0 (Windows NT 10.10; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3", 'x-inertia': 'true', #Version of streaming community - 'x-inertia-version': 'c1bdf1189cb68fca28151c8e909bd053' + 'x-inertia-version': version } #Get episode ID response = requests.get(f'https://streamingcommunity.{SC_DOMAIN}/titles/{tid}-{slug}/stagione-{season}', headers=headers) @@ -99,7 +119,8 @@ def streaming_community(imdb): return url if ismovie == 0: #Uid = URL ID - episode_id = get_season_episode_id(tid,slug,season,episode) + version = get_version() + episode_id = get_season_episode_id(tid,slug,season,episode,version) url = get_episode_link(episode_id,tid) print(url) return url \ No newline at end of file