Spaces:
Paused
Paused
UrloMythus commited on
Commit ·
6be9f99
1
Parent(s): 74ee077
- Dockerfile +1 -1
- config.json +5 -2
- config.py +4 -1
- convert.py +2 -2
- cool.py +139 -0
- example.env +3 -0
- info.py +43 -6
- loadenv.py +5 -1
- requirements.txt +1 -1
- run.py +15 -5
- streamingcommunity.py +57 -37
- tantifilm.py +224 -0
Dockerfile
CHANGED
|
@@ -8,7 +8,7 @@ WORKDIR /app
|
|
| 8 |
ADD . /app
|
| 9 |
# Install any needed packages specified in requirements.txt
|
| 10 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 11 |
-
#EXPOSE the port
|
| 12 |
EXPOSE 8080
|
| 13 |
|
| 14 |
# Run run.py when the container launches
|
|
|
|
| 8 |
ADD . /app
|
| 9 |
# Install any needed packages specified in requirements.txt
|
| 10 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 11 |
+
#EXPOSE the port, for now default is 8080 cause it's the only one really allowed by HuggingFace
|
| 12 |
EXPOSE 8080
|
| 13 |
|
| 14 |
# Run run.py when the container launches
|
config.json
CHANGED
|
@@ -3,16 +3,19 @@
|
|
| 3 |
"StreamingCommunity": {
|
| 4 |
"enabled": "1",
|
| 5 |
"domain": "boston",
|
| 6 |
-
"fast_search": "
|
| 7 |
},
|
| 8 |
"Filmpertutti": {
|
| 9 |
"enabled": "0",
|
| 10 |
"domain": "makeup"
|
| 11 |
},
|
| 12 |
-
"
|
| 13 |
"enabled": "1",
|
| 14 |
"domain": "bond",
|
| 15 |
"fast_search": "0"
|
|
|
|
|
|
|
|
|
|
| 16 |
}
|
| 17 |
},
|
| 18 |
"General":{
|
|
|
|
| 3 |
"StreamingCommunity": {
|
| 4 |
"enabled": "1",
|
| 5 |
"domain": "boston",
|
| 6 |
+
"fast_search": "1"
|
| 7 |
},
|
| 8 |
"Filmpertutti": {
|
| 9 |
"enabled": "0",
|
| 10 |
"domain": "makeup"
|
| 11 |
},
|
| 12 |
+
"Tuttifilm":{
|
| 13 |
"enabled": "1",
|
| 14 |
"domain": "bond",
|
| 15 |
"fast_search": "0"
|
| 16 |
+
},
|
| 17 |
+
"Mysterius":{
|
| 18 |
+
"enabled": "0"
|
| 19 |
}
|
| 20 |
},
|
| 21 |
"General":{
|
config.py
CHANGED
|
@@ -10,10 +10,13 @@ with open('config.json') as f:
|
|
| 10 |
SITE = config["Siti"]
|
| 11 |
FT_DOMAIN = SITE["Filmpertutti"]['domain']
|
| 12 |
SC_DOMAIN = SITE["StreamingCommunity"]['domain']
|
| 13 |
-
TF_DOMAIN = SITE["
|
| 14 |
FILMPERTUTTI = SITE["Filmpertutti"]['enabled']
|
| 15 |
STREAMINGCOMMUNITY = SITE["StreamingCommunity"]['enabled']
|
|
|
|
|
|
|
| 16 |
SC_FAST_SEARCH = SITE["StreamingCommunity"]['fast_search']
|
|
|
|
| 17 |
#General
|
| 18 |
GENERAL = config['General']
|
| 19 |
dotenv = GENERAL["load_env"]
|
|
|
|
| 10 |
SITE = config["Siti"]
|
| 11 |
FT_DOMAIN = SITE["Filmpertutti"]['domain']
|
| 12 |
SC_DOMAIN = SITE["StreamingCommunity"]['domain']
|
| 13 |
+
TF_DOMAIN = SITE["Tuttifilm"]['enabled']
|
| 14 |
FILMPERTUTTI = SITE["Filmpertutti"]['enabled']
|
| 15 |
STREAMINGCOMMUNITY = SITE["StreamingCommunity"]['enabled']
|
| 16 |
+
MYSTERIUS = SITE["Mysterius"]['enabled']
|
| 17 |
+
TUTTIFILM = SITE["Tuttifilm"]['enabled']
|
| 18 |
SC_FAST_SEARCH = SITE["StreamingCommunity"]['fast_search']
|
| 19 |
+
TF_FAST_SEARCH = SITE["Tuttifilm"]['fast_search']
|
| 20 |
#General
|
| 21 |
GENERAL = config['General']
|
| 22 |
dotenv = GENERAL["load_env"]
|
convert.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
-
import requests
|
| 2 |
from tmdbv3api import TMDb, Movie, TV
|
| 3 |
from loadenv import load_env
|
| 4 |
-
TMDB_KEY= load_env()
|
| 5 |
def get_TMDb_id_from_IMDb_id(imdb_id):
|
| 6 |
response = requests.get(f'https://api.themoviedb.org/3/find/{imdb_id}',
|
| 7 |
params={'external_source': 'imdb_id', 'api_key': f'{TMDB_KEY}'})
|
|
|
|
| 1 |
+
import requests
|
| 2 |
from tmdbv3api import TMDb, Movie, TV
|
| 3 |
from loadenv import load_env
|
| 4 |
+
TMDB_KEY,_= load_env()
|
| 5 |
def get_TMDb_id_from_IMDb_id(imdb_id):
|
| 6 |
response = requests.get(f'https://api.themoviedb.org/3/find/{imdb_id}',
|
| 7 |
params={'external_source': 'imdb_id', 'api_key': f'{TMDB_KEY}'})
|
cool.py
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import requests
|
| 2 |
+
import json
|
| 3 |
+
from info import get_info_tmdb,is_movie
|
| 4 |
+
from convert import get_TMDb_id_from_IMDb_id
|
| 5 |
+
from loadenv import load_env
|
| 6 |
+
_,MYSTERIUS_KEY = load_env()
|
| 7 |
+
def get_links(slug,season,episode,ismovie):
|
| 8 |
+
try:
|
| 9 |
+
headers = {
|
| 10 |
+
"x-api-key": MYSTERIUS_KEY
|
| 11 |
+
}
|
| 12 |
+
response = requests.get("https://mythus-ulala1243.hf.space/api/cookie", headers=headers)
|
| 13 |
+
print(response.text)
|
| 14 |
+
Auths = response.json()
|
| 15 |
+
Bearer = Auths.get('cookie')
|
| 16 |
+
ap_session = Auths.get('auth')
|
| 17 |
+
|
| 18 |
+
cookies = {'ap_session': ap_session}
|
| 19 |
+
|
| 20 |
+
headers = {
|
| 21 |
+
'accept': 'application/json, text/plain, */*',
|
| 22 |
+
'accept-language': 'it-IT,it;q=0.9,en-US;q=0.8,en;q=0.7',
|
| 23 |
+
'authorization': f'Bearer {Bearer}',
|
| 24 |
+
'referer': f'https://altadefinizione-originale.com/play/{slug}',
|
| 25 |
+
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36 OPR/111.0.0.0',
|
| 26 |
+
'x-requested-with': 'XMLHttpRequest',
|
| 27 |
+
}
|
| 28 |
+
if ismovie == 1:
|
| 29 |
+
|
| 30 |
+
response = requests.get(f'https://altadefinizione-originale.com/api/post/urls/stream/{slug}',cookies=cookies,headers=headers)
|
| 31 |
+
elif ismovie == 0:
|
| 32 |
+
response = requests.get(f'https://altadefinizione-originale.com/api/post/urls/stream/{slug}/{{season}}/{{episode}}',cookies=cookies,headers=headers)
|
| 33 |
+
try:
|
| 34 |
+
video_data = response.json() # Assuming this is the JSON response containing video streams
|
| 35 |
+
|
| 36 |
+
if 'streams' not in video_data:
|
| 37 |
+
print("Invalid JSON format: 'streams' key not found or incorrect structure")
|
| 38 |
+
return None
|
| 39 |
+
|
| 40 |
+
streams = video_data['streams']
|
| 41 |
+
|
| 42 |
+
resolutions = {}
|
| 43 |
+
|
| 44 |
+
for stream in streams:
|
| 45 |
+
resolution_name = stream['resolution']['name'].lower() # Convert resolution name to lowercase
|
| 46 |
+
url = stream['url']
|
| 47 |
+
|
| 48 |
+
# Remove everything after '.mp4' in the URL
|
| 49 |
+
mp4_index = url.find('.mp4')
|
| 50 |
+
if mp4_index != -1:
|
| 51 |
+
url = url[:mp4_index + 4] # +4 to include '.mp4' in the substring
|
| 52 |
+
|
| 53 |
+
resolutions[resolution_name] = url
|
| 54 |
+
|
| 55 |
+
return resolutions
|
| 56 |
+
|
| 57 |
+
except KeyError as e:
|
| 58 |
+
print(f"KeyError: {e}")
|
| 59 |
+
return None
|
| 60 |
+
except json.JSONDecodeError as e:
|
| 61 |
+
print(f"JSONDecodeError: {e}")
|
| 62 |
+
return None
|
| 63 |
+
|
| 64 |
+
except requests.RequestException as e:
|
| 65 |
+
print(f"Request error: {e}")
|
| 66 |
+
return None
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
# Example usage: Fetch video links
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
# Print the dictionary
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+
def search_imdb(showname,tmdba):
|
| 79 |
+
tmdba = str(tmdba)
|
| 80 |
+
query = f'https://altadefinizione-originale.com/api/search?search={showname}&page=1'
|
| 81 |
+
response = requests.get(query)
|
| 82 |
+
if response.status_code == 200:
|
| 83 |
+
data = response.json()
|
| 84 |
+
if 'data' in data:
|
| 85 |
+
for item in data['data']:
|
| 86 |
+
if item.get('tmdb_id') == tmdba:
|
| 87 |
+
slug = item.get('slug')
|
| 88 |
+
print(slug)
|
| 89 |
+
return slug
|
| 90 |
+
|
| 91 |
+
|
| 92 |
+
|
| 93 |
+
def parse_links(resolution_links):
|
| 94 |
+
results = {}
|
| 95 |
+
if resolution_links:
|
| 96 |
+
print("Video links:")
|
| 97 |
+
for resolution, link in resolution_links.items():
|
| 98 |
+
print(f"{resolution}: {link}")
|
| 99 |
+
results[resolution] = link
|
| 100 |
+
return results
|
| 101 |
+
else:
|
| 102 |
+
print("Failed to fetch video links")
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
def cool(imdb):
|
| 106 |
+
try:
|
| 107 |
+
type = "Cool"
|
| 108 |
+
general = is_movie(imdb)
|
| 109 |
+
ismovie = general[0]
|
| 110 |
+
imdb_id = general[1]
|
| 111 |
+
if ismovie == 0 :
|
| 112 |
+
season = int(general[2])
|
| 113 |
+
episode = int(general[3])
|
| 114 |
+
|
| 115 |
+
if "tt" in imdb:
|
| 116 |
+
#Get showname
|
| 117 |
+
tmdba = get_TMDb_id_from_IMDb_id(imdb_id)
|
| 118 |
+
else:
|
| 119 |
+
tmdba = imdb_id.replace("tmdb:","")
|
| 120 |
+
|
| 121 |
+
showname = get_info_tmdb(tmdba,ismovie,type)
|
| 122 |
+
|
| 123 |
+
|
| 124 |
+
slug = search_imdb(showname,tmdba)
|
| 125 |
+
if ismovie == 1:
|
| 126 |
+
season = None
|
| 127 |
+
episode = None
|
| 128 |
+
resolution_links = get_links(slug,episode,season,ismovie)
|
| 129 |
+
results = parse_links(resolution_links)
|
| 130 |
+
return results
|
| 131 |
+
elif ismovie == 0:
|
| 132 |
+
season = season -1
|
| 133 |
+
episode = episode - 1
|
| 134 |
+
resolution_links = get_links(slug,episode,season,ismovie)
|
| 135 |
+
results = parse_links(resolution_links)
|
| 136 |
+
return results
|
| 137 |
+
except Exception as e:
|
| 138 |
+
print("Cool Error")
|
| 139 |
+
return None
|
example.env
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
TMDB_KEY= "INSERT YOUR API KEY HERE"
|
| 2 |
+
|
| 3 |
+
|
info.py
CHANGED
|
@@ -4,7 +4,8 @@ from convert_date import convert_US_date, convert_IT_date
|
|
| 4 |
import requests
|
| 5 |
import config
|
| 6 |
SC_FAST_SEARCH = config.SC_FAST_SEARCH
|
| 7 |
-
|
|
|
|
| 8 |
|
| 9 |
def get_info_tmdb(tmbda,ismovie,type):
|
| 10 |
tmdb = TMDb()
|
|
@@ -22,19 +23,41 @@ def get_info_tmdb(tmbda,ismovie,type):
|
|
| 22 |
if SC_FAST_SEARCH == "0":
|
| 23 |
n_season = show.number_of_seasons
|
| 24 |
return showname,n_season
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
-
|
| 27 |
movie = Movie()
|
| 28 |
show= movie.details(tmbda)
|
| 29 |
showname= show.title
|
| 30 |
#Get all release dates
|
| 31 |
-
date = show.release_dates
|
| 32 |
if type == "Filmpertutti":
|
|
|
|
| 33 |
#GET US RELEASE DATE because filmpertutti somewhy uses US release date
|
| 34 |
date = convert_US_date(date)
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
|
| 39 |
|
| 40 |
def get_info_imdb(imdb_id, ismovie, type):
|
|
@@ -49,6 +72,12 @@ def get_info_imdb(imdb_id, ismovie, type):
|
|
| 49 |
return showname, date
|
| 50 |
elif type == "StreamingCommunity":
|
| 51 |
return showname
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
|
| 53 |
elif ismovie == 1:
|
| 54 |
showname= data['movie_results'][0]['title']
|
|
@@ -56,6 +85,14 @@ def get_info_imdb(imdb_id, ismovie, type):
|
|
| 56 |
return
|
| 57 |
elif type == "StreamingCommunity":
|
| 58 |
return showname
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
|
| 60 |
|
| 61 |
|
|
|
|
| 4 |
import requests
|
| 5 |
import config
|
| 6 |
SC_FAST_SEARCH = config.SC_FAST_SEARCH
|
| 7 |
+
TF_FAST_SEARCH = config.TF_FAST_SEARCH
|
| 8 |
+
TMDB_KEY,_= load_env()
|
| 9 |
|
| 10 |
def get_info_tmdb(tmbda,ismovie,type):
|
| 11 |
tmdb = TMDb()
|
|
|
|
| 23 |
if SC_FAST_SEARCH == "0":
|
| 24 |
n_season = show.number_of_seasons
|
| 25 |
return showname,n_season
|
| 26 |
+
else:
|
| 27 |
+
return showname
|
| 28 |
+
elif type == "Tuttifilm":
|
| 29 |
+
if TF_FAST_SEARCH == "0":
|
| 30 |
+
date = show.first_air_date
|
| 31 |
+
date = date.split("-")[0]
|
| 32 |
+
print("Real date",date)
|
| 33 |
+
return showname,date
|
| 34 |
+
else:
|
| 35 |
+
return showname
|
| 36 |
+
elif type == "Cool":
|
| 37 |
+
return showname
|
| 38 |
|
| 39 |
+
elif ismovie == 1:
|
| 40 |
movie = Movie()
|
| 41 |
show= movie.details(tmbda)
|
| 42 |
showname= show.title
|
| 43 |
#Get all release dates
|
|
|
|
| 44 |
if type == "Filmpertutti":
|
| 45 |
+
date = show.release_dates
|
| 46 |
#GET US RELEASE DATE because filmpertutti somewhy uses US release date
|
| 47 |
date = convert_US_date(date)
|
| 48 |
+
return showname,date
|
| 49 |
+
elif type == "StreamingCommunity":
|
| 50 |
+
return showname
|
| 51 |
+
elif type == "Tuttifilm":
|
| 52 |
+
if TF_FAST_SEARCH == "0":
|
| 53 |
+
date = show.release_date
|
| 54 |
+
date = date.split("-")[0]
|
| 55 |
+
print("Real date",date)
|
| 56 |
+
return showname,date
|
| 57 |
+
else:
|
| 58 |
+
return showname
|
| 59 |
+
elif type == "Cool":
|
| 60 |
+
return showname
|
| 61 |
|
| 62 |
|
| 63 |
def get_info_imdb(imdb_id, ismovie, type):
|
|
|
|
| 72 |
return showname, date
|
| 73 |
elif type == "StreamingCommunity":
|
| 74 |
return showname
|
| 75 |
+
elif type == "Tuttifilm":
|
| 76 |
+
date = data['tv_results'][0]['first_air_date']
|
| 77 |
+
date = date.split("-")[0]
|
| 78 |
+
return showname,date
|
| 79 |
+
elif type == "Cool":
|
| 80 |
+
return showname
|
| 81 |
|
| 82 |
elif ismovie == 1:
|
| 83 |
showname= data['movie_results'][0]['title']
|
|
|
|
| 85 |
return
|
| 86 |
elif type == "StreamingCommunity":
|
| 87 |
return showname
|
| 88 |
+
elif type == "Tuttifilm":
|
| 89 |
+
date = data['movie_results'][0]['release_date']
|
| 90 |
+
date = date.split("-")[0]
|
| 91 |
+
print("Real date",date)
|
| 92 |
+
return showname,date
|
| 93 |
+
elif type == "Cool":
|
| 94 |
+
return showname
|
| 95 |
+
|
| 96 |
|
| 97 |
|
| 98 |
|
loadenv.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
import os
|
| 2 |
import config
|
| 3 |
-
|
|
|
|
| 4 |
dotenv = config.dotenv
|
| 5 |
#You need to keep dotenv disabled on remote servers
|
| 6 |
if dotenv == "1":
|
|
@@ -10,4 +11,7 @@ if dotenv == "1":
|
|
| 10 |
|
| 11 |
def load_env():
|
| 12 |
TMDB_KEY = os.getenv('TMDB_KEY')
|
|
|
|
|
|
|
|
|
|
| 13 |
return TMDB_KEY
|
|
|
|
| 1 |
import os
|
| 2 |
import config
|
| 3 |
+
import config
|
| 4 |
+
MYSTERIUS = config.MYSTERIUS
|
| 5 |
dotenv = config.dotenv
|
| 6 |
#You need to keep dotenv disabled on remote servers
|
| 7 |
if dotenv == "1":
|
|
|
|
| 11 |
|
| 12 |
def load_env():
|
| 13 |
TMDB_KEY = os.getenv('TMDB_KEY')
|
| 14 |
+
if MYSTERIUS == "1":
|
| 15 |
+
MYSTERIUS_KEY = os.getenv('MYSTERIUS_KEY')
|
| 16 |
+
return TMDB_KEY, MYSTERIUS_KEY
|
| 17 |
return TMDB_KEY
|
requirements.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
bs4
|
| 2 |
tmdbv3api
|
| 3 |
dateparser
|
|
|
|
| 4 |
flask
|
| 5 |
-
requests
|
| 6 |
lxml
|
|
|
|
| 1 |
bs4
|
| 2 |
tmdbv3api
|
| 3 |
dateparser
|
| 4 |
+
python-dotenv
|
| 5 |
flask
|
|
|
|
| 6 |
lxml
|
run.py
CHANGED
|
@@ -1,14 +1,17 @@
|
|
| 1 |
from flask import Flask, jsonify, abort
|
| 2 |
from filmpertutti import filmpertutti
|
| 3 |
from streamingcommunity import streaming_community
|
|
|
|
| 4 |
import json
|
| 5 |
import config
|
| 6 |
-
|
| 7 |
FILMPERTUTTI = config.FILMPERTUTTI
|
| 8 |
STREAMINGCOMMUNITY = config.STREAMINGCOMMUNITY
|
|
|
|
|
|
|
| 9 |
HOST = config.HOST
|
| 10 |
PORT = int(config.PORT)
|
| 11 |
-
|
|
|
|
| 12 |
|
| 13 |
|
| 14 |
app = Flask(__name__)
|
|
@@ -45,19 +48,26 @@ def addon_stream(type, id):
|
|
| 45 |
if type not in MANIFEST['types']:
|
| 46 |
abort(404)
|
| 47 |
streams = {'streams': []}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
if STREAMINGCOMMUNITY == "1":
|
| 49 |
url_streaming_community = streaming_community(id)
|
| 50 |
print(url_streaming_community)
|
| 51 |
if url_streaming_community is not None:
|
| 52 |
-
streams['streams'].append({'title': '
|
| 53 |
-
streams['streams'].append({'title': '
|
| 54 |
|
| 55 |
# If FILMPERTUTTI == 1, scrape that site
|
| 56 |
if FILMPERTUTTI == "1":
|
| 57 |
url_filmpertutti = filmpertutti(id)
|
| 58 |
if url_filmpertutti is not None:
|
| 59 |
streams['streams'].append({'title': 'Filmpertutti', 'url': url_filmpertutti})
|
| 60 |
-
|
|
|
|
|
|
|
| 61 |
# If no streams were added, abort with a 404 error
|
| 62 |
if not streams['streams']:
|
| 63 |
abort(404)
|
|
|
|
| 1 |
from flask import Flask, jsonify, abort
|
| 2 |
from filmpertutti import filmpertutti
|
| 3 |
from streamingcommunity import streaming_community
|
| 4 |
+
from tantifilm import tantifilm
|
| 5 |
import json
|
| 6 |
import config
|
|
|
|
| 7 |
FILMPERTUTTI = config.FILMPERTUTTI
|
| 8 |
STREAMINGCOMMUNITY = config.STREAMINGCOMMUNITY
|
| 9 |
+
MYSTERIUS = config.MYSTERIUS
|
| 10 |
+
TUTTIFILM = config.TUTTIFILM
|
| 11 |
HOST = config.HOST
|
| 12 |
PORT = int(config.PORT)
|
| 13 |
+
if MYSTERIUS == "1":
|
| 14 |
+
from cool import cool
|
| 15 |
|
| 16 |
|
| 17 |
app = Flask(__name__)
|
|
|
|
| 48 |
if type not in MANIFEST['types']:
|
| 49 |
abort(404)
|
| 50 |
streams = {'streams': []}
|
| 51 |
+
if MYSTERIUS == "1":
|
| 52 |
+
results = cool(id)
|
| 53 |
+
if results:
|
| 54 |
+
for resolution, link in results.items():
|
| 55 |
+
streams['streams'].append({'title': f'Mysterious {resolution}', 'url': link})
|
| 56 |
if STREAMINGCOMMUNITY == "1":
|
| 57 |
url_streaming_community = streaming_community(id)
|
| 58 |
print(url_streaming_community)
|
| 59 |
if url_streaming_community is not None:
|
| 60 |
+
streams['streams'].append({'title': 'StreamingCommunity 1080p', 'url': f'{url_streaming_community}?rendition=1080p'})
|
| 61 |
+
streams['streams'].append({'title': 'StreamingCommunity 720p', 'url': f'{url_streaming_community}?rendition=720p'})
|
| 62 |
|
| 63 |
# If FILMPERTUTTI == 1, scrape that site
|
| 64 |
if FILMPERTUTTI == "1":
|
| 65 |
url_filmpertutti = filmpertutti(id)
|
| 66 |
if url_filmpertutti is not None:
|
| 67 |
streams['streams'].append({'title': 'Filmpertutti', 'url': url_filmpertutti})
|
| 68 |
+
if TUTTIFILM == "1":
|
| 69 |
+
url_tuttifilm = tantifilm(id)
|
| 70 |
+
streams['streams'].append({'title': 'Tantifilm', 'url': url_tuttifilm,'behaviorHints': {'proxyHeaders': {"request": {"Referer": "https://d000d.com/"}},'notWebReady': True}})
|
| 71 |
# If no streams were added, abort with a 404 error
|
| 72 |
if not streams['streams']:
|
| 73 |
abort(404)
|
streamingcommunity.py
CHANGED
|
@@ -36,15 +36,19 @@ def get_version():
|
|
| 36 |
version = "65e52dcf34d64173542cd2dc6b8bb75b"
|
| 37 |
return version
|
| 38 |
|
| 39 |
-
def search(query,n_season):
|
| 40 |
#Do a request to get the ID of serie/move and it's slug in the URL
|
| 41 |
response = requests.get(query).json()
|
| 42 |
for item in response['data']:
|
| 43 |
tid = item['id']
|
| 44 |
slug = item['slug']
|
| 45 |
-
|
| 46 |
if SC_FAST_SEARCH == "0":
|
| 47 |
-
if
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
return tid,slug
|
| 49 |
elif SC_FAST_SEARCH == "1":
|
| 50 |
return tid,slug
|
|
@@ -98,40 +102,56 @@ def get_episode_link(episode_id,tid):
|
|
| 98 |
|
| 99 |
|
| 100 |
def streaming_community(imdb):
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 110 |
if "tt" in imdb:
|
| 111 |
-
|
| 112 |
-
showname = get_info_imdb(imdb_id,ismovie,type)
|
| 113 |
n_season = None
|
|
|
|
| 114 |
else:
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
|
|
|
| 36 |
version = "65e52dcf34d64173542cd2dc6b8bb75b"
|
| 37 |
return version
|
| 38 |
|
| 39 |
+
def search(query,n_season,ismovie):
|
| 40 |
#Do a request to get the ID of serie/move and it's slug in the URL
|
| 41 |
response = requests.get(query).json()
|
| 42 |
for item in response['data']:
|
| 43 |
tid = item['id']
|
| 44 |
slug = item['slug']
|
| 45 |
+
idk = item['seasons_count']
|
| 46 |
if SC_FAST_SEARCH == "0":
|
| 47 |
+
if ismovie == 0:
|
| 48 |
+
seasons_count = item['seasons_count']
|
| 49 |
+
if seasons_count == n_season:
|
| 50 |
+
return tid,slug
|
| 51 |
+
elif ismovie == 1:
|
| 52 |
return tid,slug
|
| 53 |
elif SC_FAST_SEARCH == "1":
|
| 54 |
return tid,slug
|
|
|
|
| 102 |
|
| 103 |
|
| 104 |
def streaming_community(imdb):
|
| 105 |
+
try:
|
| 106 |
+
general = is_movie(imdb)
|
| 107 |
+
ismovie = general[0]
|
| 108 |
+
imdb_id = general[1]
|
| 109 |
+
type = "StreamingCommunity"
|
| 110 |
+
if ismovie == 0 :
|
| 111 |
+
season = int(general[2])
|
| 112 |
+
episode = int(general[3])
|
| 113 |
+
#Check if fast search is enabled or disabled
|
| 114 |
+
if SC_FAST_SEARCH == "1":
|
| 115 |
+
if "tt" in imdb:
|
| 116 |
+
#Get showname
|
| 117 |
+
showname = get_info_imdb(imdb_id,ismovie,type)
|
| 118 |
+
n_season = None
|
| 119 |
+
else:
|
| 120 |
+
#I just set n season to None to avoid bugs, but it is not needed if Fast search is enabled
|
| 121 |
+
n_season = None
|
| 122 |
+
#else just equals them
|
| 123 |
+
tmdba = imdb_id.replace("tmdb:","")
|
| 124 |
+
showname = get_info_tmdb(tmdba,ismovie,type)
|
| 125 |
+
elif SC_FAST_SEARCH == "0":
|
| 126 |
+
tmdba = get_TMDb_id_from_IMDb_id(imdb_id)
|
| 127 |
+
showname,n_season = get_info_tmdb(tmdba,ismovie,type)
|
| 128 |
+
#HERE THE CASE IF IT IS A MOVIE
|
| 129 |
+
else:
|
| 130 |
if "tt" in imdb:
|
| 131 |
+
#Get showname
|
|
|
|
| 132 |
n_season = None
|
| 133 |
+
showname = get_info_imdb(imdb_id,ismovie,type)
|
| 134 |
else:
|
| 135 |
+
#I just set n season to None to avoid bugs, but it is not needed if Fast search is enabled
|
| 136 |
+
#else just equals them
|
| 137 |
+
n_season = None
|
| 138 |
+
tmdba = imdb_id.replace("tmdb:","")
|
| 139 |
+
showname = get_info_tmdb(tmdba,ismovie,type)
|
| 140 |
+
|
| 141 |
+
showname = showname.replace(" ", "+").replace("–", "+").replace("—","+")
|
| 142 |
+
query = f'https://streamingcommunity.{SC_DOMAIN}/api/search?q={showname}'
|
| 143 |
+
tid,slug = search(query,n_season,ismovie)
|
| 144 |
+
if ismovie == 1:
|
| 145 |
+
#TID means temporaly ID
|
| 146 |
+
url = get_film(tid)
|
| 147 |
+
print(url)
|
| 148 |
+
return url
|
| 149 |
+
if ismovie == 0:
|
| 150 |
+
#Uid = URL ID
|
| 151 |
+
version = get_version()
|
| 152 |
+
episode_id = get_season_episode_id(tid,slug,season,episode,version)
|
| 153 |
+
url = get_episode_link(episode_id,tid)
|
| 154 |
+
print(url)
|
| 155 |
+
return url
|
| 156 |
+
except Exception as e:
|
| 157 |
+
print("Nope It failed")
|
tantifilm.py
ADDED
|
@@ -0,0 +1,224 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import requests
|
| 2 |
+
from bs4 import BeautifulSoup,SoupStrainer
|
| 3 |
+
import re
|
| 4 |
+
import time
|
| 5 |
+
from info import is_movie,get_info_imdb,get_info_tmdb
|
| 6 |
+
import config
|
| 7 |
+
TF_FAST_SEARCH = config.TF_FAST_SEARCH
|
| 8 |
+
TF_DOMAIN = config.TF_DOMAIN
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
##FOR NOW ONLY MOVIES WORK, I HOPE I CAN FIX SERIES
|
| 12 |
+
def search(showname,ismovie,season,episode,date):
|
| 13 |
+
url = f'https://www.tanti.bond/search/{showname}'
|
| 14 |
+
response = requests.get(url)
|
| 15 |
+
soup = BeautifulSoup(response.text, "lxml")
|
| 16 |
+
if ismovie == 1:
|
| 17 |
+
all_link = soup.select('#movies .col .list-media')
|
| 18 |
+
for link in all_link:
|
| 19 |
+
url = link['href']
|
| 20 |
+
response = requests.get(url)
|
| 21 |
+
pattern = r'Data di rilascio\s*</div>\s*<div class="text">\s*(\d{4})\s*</div>'
|
| 22 |
+
found_date = re.search(pattern, response.text)
|
| 23 |
+
release_date = str(found_date.group(1))
|
| 24 |
+
print(release_date)
|
| 25 |
+
if release_date == date:
|
| 26 |
+
tid= url.split('-')[1]
|
| 27 |
+
print(tid)
|
| 28 |
+
#Return URL and even the soup so I can use it later
|
| 29 |
+
#I try to get doodstream link inside this function so I do not have to get again the response
|
| 30 |
+
print(url)
|
| 31 |
+
return tid
|
| 32 |
+
elif ismovie == 0:
|
| 33 |
+
all_link = soup.select('#series .col .list-media')
|
| 34 |
+
for link in all_link:
|
| 35 |
+
base_url = link['href']
|
| 36 |
+
url = f'{base_url}-{season}-season-{episode}-episode'
|
| 37 |
+
response = requests.get(url)
|
| 38 |
+
pattern = r'Data di rilascio\s*</div>\s*<div class="text">\s*(\d{4})\s*</div>'
|
| 39 |
+
found_date = re.search(pattern, response.text)
|
| 40 |
+
release_date = str(found_date.group(1))
|
| 41 |
+
if release_date == date:
|
| 42 |
+
print("RELEASE DATE IS EQUAL")
|
| 43 |
+
tid= url.split('-')[1]
|
| 44 |
+
print(tid)
|
| 45 |
+
#I try to get doodstream link inside this function so I do not have to get again the response
|
| 46 |
+
return tid
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
def get_protect_link(id):
|
| 51 |
+
#Get the link where the Iframe is located, which contains the doodstream url kind of.
|
| 52 |
+
response = requests.get(f"https://p.hdplayer.casa/myadmin/play.php?id={id}")
|
| 53 |
+
soup = BeautifulSoup(response.text, "lxml", parse_only=SoupStrainer('iframe'))
|
| 54 |
+
print(soup)
|
| 55 |
+
protect_link = soup.iframe['src']
|
| 56 |
+
print("HERE PROTECT_LINK",protect_link)
|
| 57 |
+
return protect_link
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
def true_url(protect_link):
|
| 62 |
+
# Define headers
|
| 63 |
+
headers = {
|
| 64 |
+
"Range": "bytes=0-",
|
| 65 |
+
"Referer": "https://d000d.com/",
|
| 66 |
+
}
|
| 67 |
+
response = requests.get(protect_link)
|
| 68 |
+
link = response.url
|
| 69 |
+
#Get the ID
|
| 70 |
+
doodstream_id = link.rsplit('/e/', 1)[-1]
|
| 71 |
+
# Make a GET request
|
| 72 |
+
|
| 73 |
+
if response.status_code == 200:
|
| 74 |
+
# Get unique timestamp for the request
|
| 75 |
+
real_time = str(int(time.time()))
|
| 76 |
+
|
| 77 |
+
# Regular Expression Pattern for the match
|
| 78 |
+
pattern = r"(\/pass_md5\/.*?)'.*(\?token=.*?expiry=)"
|
| 79 |
+
|
| 80 |
+
# Find the match
|
| 81 |
+
match = re.search(pattern, response.text, re.DOTALL)
|
| 82 |
+
|
| 83 |
+
# If a match was found
|
| 84 |
+
if match:
|
| 85 |
+
# Create real link (match[0] includes all matched elements)
|
| 86 |
+
url =f'https://d000d.com{match[1]}'
|
| 87 |
+
rebobo = requests.get(url, headers=headers)
|
| 88 |
+
real_url = f'{rebobo.text}123456789{match[2]}{real_time}'
|
| 89 |
+
print(real_url)
|
| 90 |
+
return real_url
|
| 91 |
+
else:
|
| 92 |
+
print("No match found in the text.")
|
| 93 |
+
return None
|
| 94 |
+
|
| 95 |
+
print("Error: Could not get the response.")
|
| 96 |
+
return None
|
| 97 |
+
|
| 98 |
+
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
#Get temporaly ID
|
| 102 |
+
def tantifilm(imdb):
|
| 103 |
+
try:
|
| 104 |
+
general = is_movie(imdb)
|
| 105 |
+
ismovie = general[0]
|
| 106 |
+
imdb_id = general[1]
|
| 107 |
+
type = "Tuttifilm"
|
| 108 |
+
if ismovie == 0 :
|
| 109 |
+
print("Series not supported yet")
|
| 110 |
+
return
|
| 111 |
+
season = int(general[2])
|
| 112 |
+
episode = int(general[3])
|
| 113 |
+
if "tt" in imdb:
|
| 114 |
+
if TF_FAST_SEARCH == "0":
|
| 115 |
+
showname,date = get_info_imdb(imdb_id,ismovie,type)
|
| 116 |
+
elif TF_FAST_SEARCH == "1":
|
| 117 |
+
showname = get_info_imdb(imdb_id,ismovie,type)
|
| 118 |
+
date = None
|
| 119 |
+
else:
|
| 120 |
+
#else just equals them
|
| 121 |
+
tmdba = imdb_id.replace("tmdb:","")
|
| 122 |
+
if TF_FAST_SEARCH == "0":
|
| 123 |
+
showname = get_info_tmdb(tmdba,ismovie,type)
|
| 124 |
+
date = None
|
| 125 |
+
elif ismovie == 1:
|
| 126 |
+
season = None
|
| 127 |
+
episode = None
|
| 128 |
+
if "tt" in imdb:
|
| 129 |
+
#Get showname
|
| 130 |
+
if TF_FAST_SEARCH == "0":
|
| 131 |
+
showname,date = get_info_imdb(imdb_id,ismovie,type)
|
| 132 |
+
|
| 133 |
+
elif TF_FAST_SEARCH == "1":
|
| 134 |
+
showname = get_info_imdb(imdb_id,ismovie,type)
|
| 135 |
+
date = None
|
| 136 |
+
else:
|
| 137 |
+
|
| 138 |
+
#else just equals themtantifilm("tt2096673")
|
| 139 |
+
|
| 140 |
+
if TF_FAST_SEARCH == "0":
|
| 141 |
+
showname,date = get_info_tmdb(imdb,ismovie,type)
|
| 142 |
+
date = None
|
| 143 |
+
elif TF_FAST_SEARCH == "1":
|
| 144 |
+
showname = get_info_tmdb(imdb,ismovie,type)
|
| 145 |
+
date = None
|
| 146 |
+
|
| 147 |
+
tid = search(showname,ismovie,season,episode,date)
|
| 148 |
+
protect_link = get_protect_link(tid)
|
| 149 |
+
url = true_url(protect_link)
|
| 150 |
+
return url
|
| 151 |
+
|
| 152 |
+
except Exception as e:
|
| 153 |
+
print("Tantifilm Error")
|
| 154 |
+
|
| 155 |
+
|
| 156 |
+
|
| 157 |
+
|
| 158 |
+
|
| 159 |
+
|
| 160 |
+
|
| 161 |
+
|
| 162 |
+
|
| 163 |
+
|
| 164 |
+
|
| 165 |
+
|
| 166 |
+
#OLD SEARC THAT DOESN't CHECK THE DATE
|
| 167 |
+
def mamma(showname,ismovie,season,episode):
|
| 168 |
+
url = f'https://www.tanti.bond/search/{showname}'
|
| 169 |
+
response = requests.get(url)
|
| 170 |
+
soup = BeautifulSoup(response.text, "lxml")
|
| 171 |
+
if ismovie == 1:
|
| 172 |
+
first_link = soup.select_one('#movies .col .list-media')
|
| 173 |
+
url = first_link['href']
|
| 174 |
+
return url
|
| 175 |
+
elif ismovie == 0:
|
| 176 |
+
first_link = soup.select_one('#series .col .list-media')
|
| 177 |
+
base_url = first_link['href']
|
| 178 |
+
url = f'{base_url}-{season}-{episode}'
|
| 179 |
+
print(url)
|
| 180 |
+
return url
|
| 181 |
+
|
| 182 |
+
|
| 183 |
+
|
| 184 |
+
|
| 185 |
+
|
| 186 |
+
|
| 187 |
+
|
| 188 |
+
|
| 189 |
+
|
| 190 |
+
|
| 191 |
+
|
| 192 |
+
|
| 193 |
+
|
| 194 |
+
|
| 195 |
+
|
| 196 |
+
|
| 197 |
+
def searcht(showname,ismovie,season,episode):
|
| 198 |
+
url = f'https://www.tanti.bond/search/{showname}'
|
| 199 |
+
response = requests.get(url)
|
| 200 |
+
soup = BeautifulSoup(response.text, "lxml")
|
| 201 |
+
date = "2020"
|
| 202 |
+
if ismovie == 1:
|
| 203 |
+
all_link = soup.select('#movies .col .list-media')
|
| 204 |
+
for link in all_link:
|
| 205 |
+
url = link['href']
|
| 206 |
+
response = requests.get(url)
|
| 207 |
+
info_soup = BeautifulSoup(response.text, "lxml")
|
| 208 |
+
release_date= info_soup.select('div.video-attr div.text')[4].text.strip()
|
| 209 |
+
if release_date == date:
|
| 210 |
+
print("WOW")
|
| 211 |
+
#Return URL and even the soup so I can use it later
|
| 212 |
+
return url,info_soup
|
| 213 |
+
elif ismovie == 0:
|
| 214 |
+
all_link = soup.select('#series .col .list-media')
|
| 215 |
+
for link in all_link:
|
| 216 |
+
base_url = link['href']
|
| 217 |
+
url = f'{base_url}-{season}-season-{episode}-episode'
|
| 218 |
+
response = requests.get(url)
|
| 219 |
+
info_soup = BeautifulSoup(response.text, "lxml")
|
| 220 |
+
release_date= info_soup.select('div.video-attr div.text')[4].text.strip()
|
| 221 |
+
if release_date == date:
|
| 222 |
+
print("RELEASE DATE IS EQUAL")
|
| 223 |
+
#Return URL and even the soup so I can use it later
|
| 224 |
+
return url,info_soup
|