From 900edbee02e42ade29dbc7c049cb357e000f850d Mon Sep 17 00:00:00 2001 From: UrloMythus Date: Sun, 25 Aug 2024 13:43:30 +0200 Subject: [PATCH] Added partial proxy support for tantifilm --- animeworld.py | 3 +-- config.json | 4 ++-- convert.py | 8 +++----- cool.py | 3 ++- dictionaries.py | 18 ++++++++---------- info.py | 8 +++----- loadenv.py | 13 +++++++++---- run.py | 21 ++++++--------------- streamingcommunity.py | 2 +- tantifilm.py | 20 +++++++++++++++----- 10 files changed, 50 insertions(+), 50 deletions(-) diff --git a/animeworld.py b/animeworld.py index 32c83ba..2fca4d2 100644 --- a/animeworld.py +++ b/animeworld.py @@ -100,5 +100,4 @@ def animeworld(id): return final_urls except: print("Animeworld failed") - return None -animeworld("kitsi:12:10") + return None \ No newline at end of file diff --git a/config.json b/config.json index dbc3c1d..832aceb 100644 --- a/config.json +++ b/config.json @@ -10,7 +10,7 @@ "domain": "makeup" }, "Tuttifilm":{ - "enabled": "0", + "enabled": "1", "domain": "bond", "fast_search": "0" }, @@ -31,7 +31,7 @@ } }, "General":{ - "load_env": "0", + "load_env": "1", "HOST": "0.0.0.0", "PORT": "8080", "HF": "0" diff --git a/convert.py b/convert.py index b58f064..c60169b 100644 --- a/convert.py +++ b/convert.py @@ -2,11 +2,9 @@ import requests from tmdbv3api import TMDb, Movie, TV from loadenv import load_env import config -MYSTERIUS = config.MYSTERIUS -if MYSTERIUS == "1": - TMDB_KEY,_= load_env() -else: - TMDB_KEY= load_env() +env_vars = load_env() + +TMDB_KEY = env_vars.get('TMDB_KEY') def get_TMDb_id_from_IMDb_id(imdb_id): response = requests.get(f'https://api.themoviedb.org/3/find/{imdb_id}', params={'external_source': 'imdb_id', 'api_key': f'{TMDB_KEY}'}) diff --git a/cool.py b/cool.py index 312d0b1..491b60a 100644 --- a/cool.py +++ b/cool.py @@ -3,7 +3,8 @@ import json from info import get_info_tmdb,is_movie from convert import get_TMDb_id_from_IMDb_id from loadenv import load_env -_,MYSTERIUS_KEY = load_env() +env_vars = load_env() +MYSTERIUS_KEY = env_vars.get('MYSTERIUS_KEY') def get_links(slug,season,episode,ismovie): try: headers = { diff --git a/dictionaries.py b/dictionaries.py index c1a3371..6a3025a 100644 --- a/dictionaries.py +++ b/dictionaries.py @@ -8,25 +8,23 @@ STREAM = { { "id": "la7", "title": "LA7", + "name": "LA7", + "poster": "https://static.wikia.nocookie.net/logopedia/images/0/02/LA7_-_Logo_2011.svg/revision/latest?cb=20190728152519", "url": "https://d3749synfikwkv.cloudfront.net/v1/master/3722c60a815c199d9c0ef36c5b73da68a62b09d1/cc-74ylxpgd78bpb/Live.m3u8" }, { "id": "rai1", "title": "Rai 1", - "url": "https://m3u.iranvids.com/rai01/output.m3u8", - "behaviorHints": { - "notWebReady": True, - "proxyHeaders": { - "request": { - "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36" - } - } - } + "name": "Full HD", + "poster": "https://upload.wikimedia.org/wikipedia/commons/thumb/f/fa/Rai_1_-_Logo_2016.svg/1280px-Rai_1_-_Logo_2016.svg.png", + "url": "http://173.208.52.200/rai1/index.m3u8" }, { "id": "rai2", "title": "Rai 2", - "url": "https://m3u.iranvids.com/rai02/output.m3u8" + "name": "Full HD", + "poster": "https://upload.wikimedia.org/wikipedia/commons/thumb/9/99/Rai_2_-_Logo_2016.svg/1280px-Rai_2_-_Logo_2016.svg.png", + "url": "http://173.208.52.200/rai2/index.m3u8" } ] } diff --git a/info.py b/info.py index fef9b65..61161ad 100644 --- a/info.py +++ b/info.py @@ -6,11 +6,9 @@ import config import json SC_FAST_SEARCH = config.SC_FAST_SEARCH TF_FAST_SEARCH = config.TF_FAST_SEARCH -MYSTERIUS = config.MYSTERIUS -if MYSTERIUS == "1": - TMDB_KEY,_= load_env() -else: - TMDB_KEY= load_env() +env_vars = load_env() +TMDB_KEY = env_vars.get('TMDB_KEY') + def get_info_tmdb(tmbda,ismovie,type): tmdb = TMDb() diff --git a/loadenv.py b/loadenv.py index 93bda20..2f4577b 100644 --- a/loadenv.py +++ b/loadenv.py @@ -3,6 +3,8 @@ import config import config MYSTERIUS = config.MYSTERIUS dotenv = config.dotenv +TUTTIFILM = config.TUTTIFILM +HF = config.HF #You need to keep dotenv disabled on remote servers if dotenv == "1": from dotenv import load_dotenv @@ -10,8 +12,11 @@ if dotenv == "1": def load_env(): - TMDB_KEY = os.getenv('TMDB_KEY') + env_vars = {} + env_vars['TMDB_KEY'] = os.getenv('TMDB_KEY') if MYSTERIUS == "1": - MYSTERIUS_KEY = os.getenv('MYSTERIUS_KEY') - return TMDB_KEY, MYSTERIUS_KEY - return TMDB_KEY \ No newline at end of file + env_vars['MYSTERIUS_KEY'] = os.getenv('MYSTERIUS_KEY') + if TUTTIFILM == "1": + if HF == "1": + env_vars['PROXY_CREDENTIALS'] = os.getenv('PROXY') + return env_vars diff --git a/run.py b/run.py index 505529f..53fb1bb 100644 --- a/run.py +++ b/run.py @@ -9,7 +9,7 @@ import config import logging from okru import okru_get_url from animeworld import animeworld -from dictionaries import okru, STREAM +from dictionaries import okru,STREAM # Configure logging FILMPERTUTTI = config.FILMPERTUTTI STREAMINGCOMMUNITY = config.STREAMINGCOMMUNITY @@ -47,14 +47,6 @@ MANIFEST = { -okru = { - "rai1": "https://ok.ru/videoembed/7703488765552?nochat=1", - "rai2": "https://ok.ru/videoembed/7805618364016?nochat=1" -} - -MANIFEST["catalogs"].append({"type": "tv", "id": "channels", "name": "Channels"}) - - def respond_with(data): resp = jsonify(data) resp.headers['Access-Control-Allow-Origin'] = '*' @@ -80,7 +72,7 @@ def addon_catalog(type, id): "id": channel["id"], "type": "tv", "name": channel["title"], - "poster": "", # Add poster URL if available + "poster": channel["poster"], # Add poster URL if available "description": f"Watch {channel['title']}" }) @@ -97,12 +89,11 @@ def addon_meta(type, id): "id": id, "type": "tv", "name": channel["title"], - "poster": "", # Add poster URL if available + "poster": channel["poster"], # Add poster URL if available "description": f"Watch {channel['title']}", "background": "", # Add background image URL if available "logo": "", # Add logo URL if available "videos": [{ - "id": id, "title": channel["title"], "streams": [{ "title": channel["title"], @@ -126,12 +117,12 @@ def addon_stream(type, id): if id in okru: channel_url = okru_get_url(id) streams['streams'].append({ - 'title': channel['title'] + "OKRU", + 'title': channel['name'] + "OKRU", 'url': channel_url }) else: streams['streams'].append({ - 'title': channel['title'], + 'title': channel['name'], 'url': channel['url'] }) if not streams['streams']: @@ -195,4 +186,4 @@ def addon_stream(type, id): return respond_with({"meta": meta}) if __name__ == '__main__': - app.run(host=HOST, port=PORT) + app.run(host=HOST, port=PORT) \ No newline at end of file diff --git a/streamingcommunity.py b/streamingcommunity.py index 70dfae7..e89b45c 100644 --- a/streamingcommunity.py +++ b/streamingcommunity.py @@ -218,4 +218,4 @@ def streaming_community(imdb): return url,url720,quality except Exception as e: print("StreamingCommunity failed") - return None,None + return None,None,None \ No newline at end of file diff --git a/tantifilm.py b/tantifilm.py index 9c1d2f1..7d1b0af 100644 --- a/tantifilm.py +++ b/tantifilm.py @@ -4,11 +4,14 @@ import re import time from info import is_movie,get_info_imdb,get_info_tmdb import config +from loadenv import load_env TF_FAST_SEARCH = config.TF_FAST_SEARCH TF_DOMAIN = config.TF_DOMAIN +HF = config.HF +env_vars = load_env() +PROXY_CREDENTIALS = env_vars.get('PROXY_CREDENTIALS') -##FOR NOW ONLY MOVIES WORK, I HOPE I CAN FIX SERIES def search(showname,ismovie,date): url = f'https://www.tanti.{TF_DOMAIN}/search/{showname}' response = requests.get(url) @@ -157,11 +160,17 @@ def true_url(protect_link): "Range": "bytes=0-", "Referer": "https://d000d.com/", } - response = requests.get(protect_link) + if HF == "1": + proxy = PROXY_CREDENTIALS + proxies = { + "http": proxy, + "https": proxy + } + response = requests.get(protect_link, proxies=proxies) + else: + response = requests.get(protect_link) link = response.url - #Get the ID - doodstream_id = link.rsplit('/e/', 1)[-1] - # Make a GET request + if response.status_code == 200: # Get unique timestamp for the request @@ -177,6 +186,7 @@ def true_url(protect_link): if match: # Create real link (match[0] includes all matched elements) url =f'https://d000d.com{match[1]}' + print("MD5: ", url) rebobo = requests.get(url, headers=headers) real_url = f'{rebobo.text}123456789{match[2]}{real_time}' print(real_url)