From a86793f3ae0bea9ff0e2029e1a13633fbe20976a Mon Sep 17 00:00:00 2001 From: UrloMythus Date: Tue, 9 Jul 2024 23:35:40 +0200 Subject: [PATCH] Avoid using TMBD API for Sc when IMDB is given --- streamingcommunity.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/streamingcommunity.py b/streamingcommunity.py index 6e6345a..7b6e464 100644 --- a/streamingcommunity.py +++ b/streamingcommunity.py @@ -15,7 +15,7 @@ headers = { 'Accept-Language': 'en-US,en;q=0.5' } -def search(query,date,ismovie): +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() for item in response['data']: @@ -81,14 +81,17 @@ def streaming_community(imdb): if "tt" in imdb: #If it is a imbd then conver it to tmbd tmdba = get_TMDb_id_from_IMDb_id(imdb_id) + showname = requests.get(f'https://v3.sg.media-imdb.com/suggestion/a/{imdb_id}.json') + showname = showname.json() + showname = showname['d'][0]['l'] else: #else just equals them tmdba = imdb_id.replace("tmdb:","") - type = "StreamingCommunity" - showname,date = get_info(tmdba,ismovie,type) + type = "StreamingCommunity" + showname = get_info(tmdba,ismovie,type) showname = showname.replace(" ", "+").replace("–", "+").replace("—","+") query = f'https://streamingcommunity.{SC_DOMAIN}/api/search?q={showname}' - tid,slug = search(query,date,ismovie) + tid,slug = search(query) if ismovie == 1: #TID means temporaly ID url = get_film(tid)