Mythus commited on
Commit
1f9aed5
·
verified ·
1 Parent(s): e7763d6

Upload 8 files

Browse files
Files changed (8) hide show
  1. config.json +28 -0
  2. config.py +25 -0
  3. convert.py +19 -0
  4. filmpertutti.py +136 -0
  5. info.py +121 -0
  6. run.py +224 -0
  7. streamingcommunity.py +180 -0
  8. tantifilm.py +257 -0
config.json ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "Siti": {
3
+ "StreamingCommunity": {
4
+ "enabled": "1",
5
+ "domain": "photos",
6
+ "fast_search": "0"
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":{
22
+ "load_env": "0",
23
+ "HOST": "0.0.0.0",
24
+ "PORT": "8080",
25
+ "HF": "0"
26
+ }
27
+ }
28
+
config.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #LOAD THE CONFIG
2
+ import json
3
+
4
+ # Open the configuration file
5
+ with open('config.json') as f:
6
+ # Load JSON data from file
7
+ config = json.load(f)
8
+
9
+ # Accessing SC_DOMAIN
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"]
23
+ HOST = GENERAL["HOST"]
24
+ PORT = GENERAL["PORT"]
25
+ HF = GENERAL["HF"]
convert.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import requests
2
+ from tmdbv3api import TMDb, Movie, TV
3
+ from loadenv import load_env
4
+ import config
5
+ MYSTERIUS = config.MYSTERIUS
6
+ if MYSTERIUS == "1":
7
+ TMDB_KEY,_= load_env()
8
+ else:
9
+ TMDB_KEY= load_env()
10
+ def get_TMDb_id_from_IMDb_id(imdb_id):
11
+ response = requests.get(f'https://api.themoviedb.org/3/find/{imdb_id}',
12
+ params={'external_source': 'imdb_id', 'api_key': f'{TMDB_KEY}'})
13
+ tmbda = response.json()
14
+ if tmbda['movie_results']:
15
+ return tmbda['movie_results'][0]['id']
16
+ elif tmbda['tv_results']:
17
+ return tmbda['tv_results'][0]['id']
18
+ else:
19
+ return None
filmpertutti.py ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ from tmdbv3api import TMDb, Movie, TV
3
+ import requests
4
+ from bs4 import BeautifulSoup,SoupStrainer
5
+ import string
6
+ import re
7
+ from datetime import datetime
8
+ import dateparser
9
+ from convert import get_TMDb_id_from_IMDb_id
10
+ from info import get_info_tmdb, is_movie, get_info_imdb
11
+ from convert_date import convert_US_date
12
+ import logging
13
+ import config
14
+
15
+ FT_DOMAIN = config.FT_DOMAIN
16
+
17
+ #Some basic headers
18
+ headers = {
19
+ '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',
20
+ 'Accept-Language': 'en-US,en;q=0.5'
21
+ }
22
+ #Map months to check if date = date
23
+ month_mapping = {
24
+ 'Jan': 'Gennaio', 'Feb': 'Febbraio', 'Mar': 'Marzo', 'Apr': 'Aprile',
25
+ 'May': 'Maggio', 'Jun': 'Giugno', 'Jul': 'Luglio', 'Aug': 'Agosto',
26
+ 'Sep': 'Settembre', 'Oct': 'Ottobre', 'Nov': 'Novembre', 'Dec': 'Dicembre'
27
+ }
28
+
29
+ def search(query,date):
30
+ response = requests.get(query).json()
31
+ #Get link tid of every item and then open the link to see if the date = date
32
+ for json in response:
33
+ link = json['link']
34
+ tid = json['id']
35
+ series_response = requests.get(link, headers=headers)
36
+ series_soup = BeautifulSoup(series_response.text, 'lxml')
37
+ release_span = series_soup.find('span', class_='released')
38
+ if release_span:
39
+ if release_span.text != "Data di uscita: N/A":
40
+ date_string = release_span.text.split(': ')[-1] # Get the date part
41
+ for eng, ita in month_mapping.items():
42
+ date_string = re.sub(rf'\b{eng}\b', ita, date_string)
43
+
44
+ # Swap to YY-MM-DD formatting using dateparser
45
+ release_date = dateparser.parse(date_string, languages=['it']).strftime("%Y-%m-%d")
46
+ if release_date == date:
47
+ url = link
48
+ tid = tid
49
+ return url, tid
50
+ else:
51
+ print("Date are not equals")
52
+
53
+ def get_episode_link(season,episode,tid,url):
54
+ #Get the link from where we have to obtain mixdrop link
55
+ tlink = f'{url}?show_video=true&post_id={tid}&season_id={season-1}&episode_id={episode-1}'
56
+ return tlink
57
+
58
+
59
+ def get_film(url):
60
+ #Get the link from where we have to obtain mixdrop link
61
+ tlink = url + "?show_video=true"
62
+ return tlink
63
+
64
+ def get_real_link(tlink):
65
+ #Some basic code to get the mixdrop link
66
+ page = requests.get(tlink, headers=headers)
67
+ soup = BeautifulSoup(page.content, features="lxml",parse_only=SoupStrainer('iframe'))
68
+ iframe_src = soup.find('iframe')['src']
69
+
70
+ iframe_page = requests.get(iframe_src, headers=headers)
71
+ iframe_soup = BeautifulSoup(iframe_page.content, features="lxml")
72
+
73
+ mega_button = iframe_soup.find('div', attrs={'class': 'megaButton', 'rel': 'nofollow'}, string='MIXDROP')
74
+ if mega_button:
75
+ real_link = mega_button.get('meta-link')
76
+ return real_link
77
+
78
+ def get_true_link(real_link):
79
+ response = requests.get(real_link, headers=headers)
80
+ [s1, s2] = re.search(r"\}\('(.+)',.+,'(.+)'\.split", response.text).group(1, 2)
81
+ schema = s1.split(";")[2][5:-1]
82
+ terms = s2.split("|")
83
+ charset = string.digits + string.ascii_letters
84
+ d = dict()
85
+ for i in range(len(terms)):
86
+ d[charset[i]] = terms[i] or charset[i]
87
+ s = 'https:'
88
+ for c in schema:
89
+ s += d[c] if c in d else c
90
+ return s
91
+
92
+ def filmpertutti(imdb):
93
+ general = is_movie(imdb)
94
+ ismovie = general[0]
95
+ imdb_id = general[1]
96
+ type = "Filmpertutti"
97
+ if ismovie == 0 :
98
+ season = int(general[2])
99
+ episode = int(general[3])
100
+ if "tt" in imdb:
101
+ if ismovie == 0:
102
+ #Get showname and date
103
+ showname,date = get_info_imdb(imdb_id,ismovie,type)
104
+ else:
105
+ #THIS IS needed cause the only way to get all releases dates is by giving a tmdb ID not a IMDB
106
+ tmdba = get_TMDb_id_from_IMDb_id(imdb_id)
107
+ showname,date = get_info_tmdb(tmdba,ismovie,type)
108
+
109
+ elif "tmdb" in imdb:
110
+ #Get showname and date
111
+ tmdba = imdb_id.replace("tmdb:","")
112
+ showname,date = get_info_tmdb(tmdba,ismovie,type)
113
+ showname = showname.replace(" ", "+").replace("–", "+").replace("—","+")
114
+ #Build the query
115
+ query = f'https://filmpertutti.{FT_DOMAIN}/wp-json/wp/v2/posts?search={showname}&page=1&_fields=link,id'
116
+ try:
117
+ url,tid = search(query,date)
118
+ except:
119
+ print("No results found")
120
+ return None
121
+ if ismovie == 0:
122
+ episode_link = get_episode_link(season,episode,tid,url)
123
+ #Let's get mixdrop link
124
+ real_link = get_real_link(episode_link)
125
+ #let's get delivery link, streaming link
126
+ streaming_link = get_true_link(real_link)
127
+ print(streaming_link)
128
+ return streaming_link
129
+ elif ismovie == 1:
130
+ film_link = get_film(url)
131
+ #Let's get mixdrop link
132
+ real_link = get_real_link(film_link)
133
+ #let's get delivery link, streaming link
134
+ streaming_link = get_true_link(real_link)
135
+ print(streaming_link)
136
+ return streaming_link
info.py ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from loadenv import load_env
2
+ from tmdbv3api import TMDb, Movie, TV
3
+ 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
+ TF_FAST_SEARCH = config.TF_FAST_SEARCH
8
+ MYSTERIUS = config.MYSTERIUS
9
+ if MYSTERIUS == "1":
10
+ TMDB_KEY,_= load_env()
11
+ else:
12
+ TMDB_KEY= load_env()
13
+
14
+ def get_info_tmdb(tmbda,ismovie,type):
15
+ tmdb = TMDb()
16
+ tmdb.api_key = f'{TMDB_KEY}'
17
+ tmdb.language = 'it'
18
+ if ismovie == 0:
19
+ tv = TV()
20
+ show= tv.details(tmbda)
21
+ showname = show.name
22
+ if type == "Filmpertutti":
23
+ date= show.first_air_date
24
+ print("Real date",date)
25
+ return showname,date
26
+ elif type == "StreamingCommunity":
27
+ if SC_FAST_SEARCH == "0":
28
+ n_season = show.number_of_seasons
29
+ full_date = show.first_air_date
30
+ date = full_date.split("-")[0]
31
+ print(date)
32
+ return showname,date
33
+ else:
34
+ return showname
35
+ elif type == "Tuttifilm":
36
+ if TF_FAST_SEARCH == "0":
37
+ date = show.first_air_date
38
+ date = date.split("-")[0]
39
+ print("Real date",date)
40
+ return showname,date
41
+ else:
42
+ return showname
43
+ elif type == "Cool":
44
+ return showname
45
+
46
+ elif ismovie == 1:
47
+ movie = Movie()
48
+ show= movie.details(tmbda)
49
+ showname= show.title
50
+ #Get all release dates
51
+ if type == "Filmpertutti":
52
+ date = show.release_dates
53
+ #GET US RELEASE DATE because filmpertutti somewhy uses US release date
54
+ date = convert_US_date(date)
55
+ return showname,date
56
+ elif type == "StreamingCommunity":
57
+ return showname
58
+ elif type == "Tuttifilm":
59
+ if TF_FAST_SEARCH == "0":
60
+ date = show.release_date
61
+ date = date.split("-")[0]
62
+ print("Real date",date)
63
+ return showname,date
64
+ else:
65
+ return showname
66
+ elif type == "Cool":
67
+ return showname
68
+
69
+
70
+ def get_info_imdb(imdb_id, ismovie, type):
71
+
72
+ resp = requests.get(f'https://api.themoviedb.org/3/find/{imdb_id}?api_key={TMDB_KEY}&language=it&external_source=imdb_id')
73
+ data = resp.json()
74
+ if ismovie == 0:
75
+ showname = data['tv_results'][0]['name']
76
+ if type == "Filmpertutti":
77
+ date= data['tv_results'][0]['first_air_date']
78
+ print("Real date",date)
79
+ return showname, date
80
+ elif type == "StreamingCommunity":
81
+ return showname
82
+ elif type == "Tuttifilm":
83
+ if TF_FAST_SEARCH == "0":
84
+ date = data['tv_results'][0]['first_air_date']
85
+ date = date.split("-")[0]
86
+ return showname,date
87
+ elif TF_FAST_SEARCH == "1":
88
+ return showname
89
+ elif type == "Cool":
90
+ return showname
91
+
92
+ elif ismovie == 1:
93
+ showname= data['movie_results'][0]['title']
94
+ if type == "Filmpertutti":
95
+ return
96
+ elif type == "StreamingCommunity":
97
+ return showname
98
+ elif type == "Tuttifilm":
99
+ date = data['movie_results'][0]['release_date']
100
+ date = date.split("-")[0]
101
+ return showname,date
102
+ elif type == "Cool":
103
+ return showname
104
+
105
+
106
+
107
+
108
+
109
+
110
+ def is_movie(imdb_id):
111
+ if "tmdb:" in imdb_id:
112
+ imdb_id = imdb_id.replace("tmdb:","")
113
+ if ":" in imdb_id:
114
+ season = imdb_id.split(":")[1]
115
+ episode = imdb_id.split(":")[-1]
116
+ ismovie = 0
117
+ imdb_id = imdb_id.split(":")[0]
118
+ return ismovie,imdb_id,season,episode
119
+ else:
120
+ ismovie = 1
121
+ return ismovie,imdb_id
run.py ADDED
@@ -0,0 +1,224 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ import logging
8
+
9
+ # Configure logging
10
+
11
+ FILMPERTUTTI = config.FILMPERTUTTI
12
+ STREAMINGCOMMUNITY = config.STREAMINGCOMMUNITY
13
+ MYSTERIUS = config.MYSTERIUS
14
+ TUTTIFILM = config.TUTTIFILM
15
+ TF_DOMAIN = config.TF_DOMAIN
16
+ HOST = config.HOST
17
+ PORT = int(config.PORT)
18
+ HF = config.HF
19
+ if HF == "1":
20
+ HF = "🤗️"
21
+ #Cool code to set the hugging face if the service is hosted there.
22
+ else:
23
+ HF = ""
24
+ if MYSTERIUS == "1":
25
+ from cool import cool
26
+
27
+ app = Flask(__name__)
28
+
29
+ MANIFEST = {
30
+ "id": "org.stremio.mammamia",
31
+ "version": "1.0.0",
32
+ "catalogs": [
33
+ {"type": "tv", "id": "tv_channels", "name": "TV Channels"}
34
+ ],
35
+ "resources": ["stream", "catalog","meta"],
36
+ "types": ["movie", "series", "tv"],
37
+ "name": "Mamma Mia",
38
+ "description": "Addon providing HTTPS Stream for Italian Movies/Series",
39
+ "logo": "https://creazilla-store.fra1.digitaloceanspaces.com/emojis/49647/pizza-emoji-clipart-md.png"
40
+ }
41
+
42
+ STREAMS = {
43
+ "tv": {
44
+ "skysport24": [
45
+ {
46
+ "title": "Sky Sport 24",
47
+ "poster": f"https://www.tanti.{TF_DOMAIN}/public/upload/channel/sky-sport-24.webp",
48
+ "url": "https://07-24.mizhls.ru/fls/cdn/calcioXskysport24/playlist.m3u8",
49
+ "behaviorHints": {
50
+ "notWebReady": True,
51
+ "proxyHeaders": {
52
+ "request": {
53
+ "Referer": "https://claplivehdplay.ru/",
54
+ "Origin": "https://claplivehdplay.ru",
55
+ "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36"
56
+ }
57
+ }
58
+ }
59
+ }
60
+ ],
61
+ "Skyuno": [
62
+ {
63
+ "title": "Sky Uno",
64
+ "poster": f"https://www.tanti.{TF_DOMAIN}/public/upload/channel/sky-uno.webp",
65
+ "url": "https://07-24.mizhls.ru/fls/cdn/calcioXskyuno/playlist.m3u8",
66
+ "behaviorHints": {
67
+ "notWebReady": True,
68
+ "proxyHeaders": {
69
+ "request": {
70
+ "Referer": "https://claplivehdplay.ru/",
71
+ "Origin": "https://claplivehdplay.ru",
72
+ "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36"
73
+ }
74
+ }
75
+ }
76
+ }
77
+ ],
78
+ "skyserie": [
79
+ {
80
+ "title": "Sky Serie",
81
+ "poster": f"https://www.tanti.{TF_DOMAIN}/public/upload/channel/sky-serie.webp",
82
+ "url": "https://07-24.mizhls.ru/fls/cdn/calcioXskyserie/playlist.m3u8",
83
+ "behaviorHints": {
84
+ "notWebReady": True,
85
+ "proxyHeaders": {
86
+ "request": {
87
+ "Referer": "https://claplivehdplay.ru/",
88
+ "Origin": "https://claplivehdplay.ru",
89
+ "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36"
90
+ }
91
+ }
92
+ }
93
+ }
94
+ ],
95
+ "Sky Nature": [
96
+ {
97
+ "title": "Sky Nature",
98
+ "poster": f"https://www.tanti.{TF_DOMAIN}/public/upload/channel/sky-nature.webp",
99
+ "url": "https://07-24.mizhls.ru/fls/cdn/calcioXskynature/playlist.m3u8",
100
+ "behaviorHints": {
101
+ "notWebReady": True,
102
+ "proxyHeaders": {
103
+ "request": {
104
+ "Referer": "https://claplivehdplay.ru/",
105
+ "Origin": "https://claplivehdplay.ru",
106
+ "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36"
107
+ }
108
+ }
109
+ }
110
+ }
111
+ ],
112
+ "skyinvestigation": [
113
+ {
114
+ "title": "skyinvestigation",
115
+ "poster": f"https://www.tanti.{TF_DOMAIN}/public/upload/channel/sky-nature.webp",
116
+ "url": "https://07-24.mizhls.ru/fls/cdn/calcioXskyinvestigation/playlist.m3u8",
117
+ "behaviorHints": {
118
+ "notWebReady": True,
119
+ "proxyHeaders": {
120
+ "request": {
121
+ "Referer": "https://claplivehdplay.ru/",
122
+ "Origin": "https://claplivehdplay.ru",
123
+ "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36"
124
+ }
125
+ }
126
+ }
127
+ }
128
+ ]
129
+ }
130
+ }
131
+
132
+ def respond_with(data):
133
+ resp = jsonify(data)
134
+ resp.headers['Access-Control-Allow-Origin'] = '*'
135
+ resp.headers['Access-Control-Allow-Headers'] = '*'
136
+ return resp
137
+
138
+ @app.route('/manifest.json')
139
+ def addon_manifest():
140
+ return respond_with(MANIFEST)
141
+
142
+ @app.route('/')
143
+ def root():
144
+ return "Hello, this is a Stremio Addon providing HTTPS Stream for Italian Movies/Series, to install it add /manifest.json to the url and then add it into the Stremio search bar"
145
+
146
+ @app.route('/catalog/<type>/<id>.json')
147
+ def addon_catalog(type, id):
148
+ if type not in MANIFEST['types']:
149
+ abort(404)
150
+ catalog = {'metas': []}
151
+ if type in STREAMS:
152
+ for stream_id in STREAMS[type]:
153
+ for item in STREAMS[type][stream_id]:
154
+ meta_item = {
155
+ "id": stream_id,
156
+ "type": type,
157
+ "name": item['title'],
158
+ "poster": item.get('poster', "https://via.placeholder.com/150")
159
+ }
160
+ catalog['metas'].append(meta_item)
161
+ return respond_with(catalog)
162
+
163
+ @app.route('/stream/<type>/<id>.json')
164
+ def addon_stream(type, id):
165
+ if type not in MANIFEST['types']:
166
+ abort(404)
167
+ streams = {'streams': []}
168
+
169
+ if type in STREAMS and id in STREAMS[type]:
170
+ logging.debug(f"Found TV channel: {id}")
171
+ streams['streams'] = STREAMS[type][id]
172
+ else:
173
+ logging.debug(f"Handling movie or series: {id}")
174
+ if MYSTERIUS == "1":
175
+ results = cool(id)
176
+ if results:
177
+ for resolution, link in results.items():
178
+ streams['streams'].append({'title': f'{HF}Mysterious {resolution}', 'url': link})
179
+ if STREAMINGCOMMUNITY == "1":
180
+ url_streaming_community = streaming_community(id)
181
+ if url_streaming_community is not None:
182
+ streams['streams'].append({'title': f'{HF}StreamingCommunity 1080p', 'url': f'{url_streaming_community}?rendition=1080p'})
183
+ streams['streams'].append({'title': f'{HF}StreamingCommunity 720p', 'url': f'{url_streaming_community}?rendition=720p'})
184
+ if FILMPERTUTTI == "1":
185
+ url_filmpertutti = filmpertutti(id)
186
+ if url_filmpertutti is not None:
187
+ streams['streams'].append({'title': 'Filmpertutti', 'url': url_filmpertutti})
188
+ if TUTTIFILM == "1":
189
+ url_tuttifilm = tantifilm(id)
190
+ if url_tuttifilm:
191
+ if not isinstance(url_tuttifilm, str):
192
+ for title, url in url_tuttifilm.items():
193
+ streams['streams'].append({'title': f'{HF}Tantifilm {title}', 'url': url, 'behaviorHints': {'proxyHeaders': {"request": {"Referer": "https://d000d.com/"}}, 'notWebReady': True}})
194
+ else:
195
+ streams['streams'].append({'title': f'{HF}Tantifilm', 'url': url_tuttifilm, 'behaviorHints': {'proxyHeaders': {"request": {"Referer": "https://d000d.com/"}}, 'notWebReady': True}})
196
+ if not streams['streams']:
197
+ abort(404)
198
+
199
+ return respond_with(streams)
200
+
201
+ @app.route('/meta/<type>/<id>.json')
202
+ def meta(type, id):
203
+ if type not in MANIFEST['types']:
204
+ abort(404)
205
+
206
+ meta = {}
207
+ for stream_id in STREAMS.get(type, {}):
208
+ if stream_id == id:
209
+ item = STREAMS[type][stream_id][0] # Assuming there's at least one item
210
+ meta = {
211
+ "id": stream_id,
212
+ "type": type,
213
+ "name": item['title'],
214
+ "poster": item.get('poster', "https://icons.iconarchive.com/icons/designbolts/free-multimedia/256/TV-icon.png"),
215
+ "background": item.get('background', "https://icons.iconarchive.com/icons/designbolts/free-multimedia/256/TV-icon.png")
216
+ }
217
+ break
218
+
219
+ if not meta:
220
+ abort(404)
221
+
222
+ return respond_with({"meta": meta})
223
+ if __name__ == '__main__':
224
+ app.run(host=HOST, port=PORT)
streamingcommunity.py ADDED
@@ -0,0 +1,180 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from tmdbv3api import TMDb, Movie, TV
2
+ import requests
3
+ import logging
4
+ from bs4 import BeautifulSoup,SoupStrainer
5
+ from datetime import datetime
6
+ import dateparser
7
+ from convert import get_TMDb_id_from_IMDb_id
8
+ from info import get_info_tmdb, is_movie, get_info_imdb
9
+ import config
10
+ import json
11
+ import re
12
+ #Get domain
13
+ SC_DOMAIN= config.SC_DOMAIN
14
+ SC_FAST_SEARCH = config.SC_FAST_SEARCH
15
+
16
+ headers = {
17
+ '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',
18
+ 'Accept-Language': 'en-US,en;q=0.5'
19
+ }
20
+
21
+ #GET VERSION OF STREAMING COMMUNITY:
22
+ def get_version():
23
+ #Extract the version from the main page of the site
24
+
25
+
26
+ try:
27
+ base_url = f'https://streamingcommunity.{SC_DOMAIN}/richiedi-un-titolo'
28
+ response = requests.get(base_url, headers=headers)
29
+ #Soup the response
30
+ soup = BeautifulSoup(response.text, "lxml")
31
+
32
+ # Extract version
33
+ version = json.loads(soup.find("div", {"id": "app"}).get("data-page"))['version']
34
+ return version
35
+ except:
36
+ print("Couldn't find the version")
37
+ version = "65e52dcf34d64173542cd2dc6b8bb75b"
38
+ return version
39
+
40
+ def search(query,date,ismovie):
41
+ #Do a request to get the ID of serie/move and it's slug in the URL
42
+ response = requests.get(query).json()
43
+ for item in response['data']:
44
+ tid = item['id']
45
+ slug = item['slug']
46
+ type = item['type']
47
+ if type == "tv":
48
+ type = 0
49
+ elif type == "movie":
50
+ type = 1
51
+ if type == ismovie:
52
+ #Added a Check to see if the result is what it is supposed to be
53
+ if SC_FAST_SEARCH == "0":
54
+ if ismovie == 0:
55
+ seasons_count = item['seasons_count']
56
+ #Do not ask me why but somewhy streaming community call the first air date the last air date
57
+ first_air_date = item['last_air_date']
58
+ if first_air_date:
59
+ first_air_year = first_air_date.split("-")[0]
60
+ if first_air_year == date:
61
+ return tid,slug
62
+ else:
63
+ response = requests.get ( f'https://streamingcommunity.boston/titles/{tid}-{slug}')
64
+ pattern = r'<div[^>]*class="features"[^>]*>.*?<span[^>]*>(.*?)<\/span>'
65
+ match = re.search(pattern, response.text)
66
+ print(match.group(1).split("-")[0])
67
+ first_air_year = match.group(1).split("-")[0]
68
+ date = int(date)
69
+ first_air_year = int(first_air_year)
70
+ if first_air_year == date:
71
+ return tid,slug
72
+ elif ismovie == 1:
73
+ return tid,slug
74
+ elif SC_FAST_SEARCH == "1":
75
+ return tid,slug
76
+ else:
77
+ print("Couldn't find anything")
78
+
79
+
80
+ def get_film(tid):
81
+ #Access the iframe
82
+ url = f'https://streamingcommunity.{SC_DOMAIN}/iframe/{tid}'
83
+ response = requests.get(url, headers=headers)
84
+ iframe = BeautifulSoup(response.text, 'lxml')
85
+ #Get the link of iframe
86
+ iframe = iframe.find('iframe').get("src")
87
+ #Get the ID containted in the src of iframe
88
+ vixid = iframe.split("/embed/")[1].split("?")[0]
89
+ #Build the url with 1080p, to get the highest resolution
90
+ url = f'https://vixcloud.co/playlist/{vixid}'
91
+ return url
92
+
93
+ def get_season_episode_id(tid,slug,season,episode,version):
94
+ #Set some basic headers for the request
95
+ headers = {
96
+ '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",
97
+ 'x-inertia': 'true',
98
+ #Version of streaming community
99
+ 'x-inertia-version': version
100
+ }
101
+ #Get episode ID
102
+ response = requests.get(f'https://streamingcommunity.{SC_DOMAIN}/titles/{tid}-{slug}/stagione-{season}', headers=headers)
103
+ # Print the json got
104
+ json_response = response.json().get('props', {}).get('loadedSeason', {}).get('episodes', [])
105
+ for dict_episode in json_response:
106
+ if dict_episode['number'] == episode:
107
+ return dict_episode['id']
108
+
109
+ def get_episode_link(episode_id,tid):
110
+ #The parameters for the request
111
+ params = {
112
+ 'episode_id': episode_id,
113
+ 'next_episode': '1'
114
+ }
115
+ #Let's try to get the link from iframe source
116
+ # Make a request to get iframe source
117
+ response = requests.get(f"https://streamingcommunity.{SC_DOMAIN}/iframe/{tid}", params=params)
118
+
119
+ # Parse response with BeautifulSoup to get iframe source
120
+ soup = BeautifulSoup(response.text, "lxml")
121
+ iframe = soup.find("iframe").get("src")
122
+ vixid = iframe.split("/embed/")[1].split("?")[0]
123
+ url = f"https://vixcloud.co/playlist/{vixid}"
124
+ return url
125
+
126
+
127
+ def streaming_community(imdb):
128
+ try:
129
+ general = is_movie(imdb)
130
+ ismovie = general[0]
131
+ imdb_id = general[1]
132
+ type = "StreamingCommunity"
133
+ if ismovie == 0 :
134
+ season = int(general[2])
135
+ episode = int(general[3])
136
+ #Check if fast search is enabled or disabled
137
+ if SC_FAST_SEARCH == "1":
138
+ if "tt" in imdb:
139
+ #Get showname
140
+ showname = get_info_imdb(imdb_id,ismovie,type)
141
+ date = None
142
+ else:
143
+ #I just set n season to None to avoid bugs, but it is not needed if Fast search is enabled
144
+ date = None
145
+ #else just equals them
146
+ tmdba = imdb_id.replace("tmdb:","")
147
+ showname = get_info_tmdb(tmdba,ismovie,type)
148
+ elif SC_FAST_SEARCH == "0":
149
+ tmdba = get_TMDb_id_from_IMDb_id(imdb_id)
150
+ showname,date = get_info_tmdb(tmdba,ismovie,type)
151
+ #HERE THE CASE IF IT IS A MOVIE
152
+ else:
153
+ if "tt" in imdb:
154
+ #Get showname
155
+ date = None
156
+ showname = get_info_imdb(imdb_id,ismovie,type)
157
+ else:
158
+ #I just set n season to None to avoid bugs, but it is not needed if Fast search is enabled
159
+ #else just equals them
160
+ date = None
161
+ tmdba = imdb_id.replace("tmdb:","")
162
+ showname = get_info_tmdb(tmdba,ismovie,type)
163
+
164
+ showname = showname.replace(" ", "+").replace("–", "+").replace("—","+")
165
+ query = f'https://streamingcommunity.{SC_DOMAIN}/api/search?q={showname}'
166
+ tid,slug = search(query,date,ismovie)
167
+ if ismovie == 1:
168
+ #TID means temporaly ID
169
+ url = get_film(tid)
170
+ print(url)
171
+ return url
172
+ if ismovie == 0:
173
+ #Uid = URL ID
174
+ version = get_version()
175
+ episode_id = get_season_episode_id(tid,slug,season,episode,version)
176
+ url = get_episode_link(episode_id,tid)
177
+ print(url)
178
+ return url
179
+ except Exception as e:
180
+ print("Nope It failed")
tantifilm.py ADDED
@@ -0,0 +1,257 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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,date):
13
+ url = f'https://www.tanti.{TF_DOMAIN}/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
+ if release_date == date:
25
+ tid= url.split('-')[-1]
26
+ #Return URL and even the soup so I can use it later
27
+ #I try to get doodstream link inside this function so I do not have to get again the response
28
+ return tid,url
29
+ elif ismovie == 0:
30
+ all_link = soup.select('#series .col .list-media')
31
+ for link in all_link:
32
+ base_url = link['href']
33
+ url = f'{base_url}-1-season-1-episode'
34
+ response = requests.get(url)
35
+ pattern = r'Data di rilascio\s*</div>\s*<div class="text">\s*(\d{4})\s*</div>'
36
+ found_date = re.search(pattern, response.text)
37
+ release_date = str(found_date.group(1))
38
+ if release_date == date:
39
+ tid= url.split('-')[1]
40
+ soup = BeautifulSoup(response.text, 'lxml')
41
+ a_tag = soup.find('a', class_='dropdown-toggle btn-service selected')
42
+ embed_id = a_tag['data-embed']
43
+ #I try to get doodstream link inside this function so I do not have to get again the response
44
+ return url,embed_id
45
+
46
+ def fast_search(showname,ismovie):
47
+ url = f'https://www.tanti.{TF_DOMAIN}/search/{showname}'
48
+ response = requests.get(url)
49
+ soup = BeautifulSoup(response.text, "lxml")
50
+ if ismovie == 1:
51
+ first_link = soup.select_one('#movies .col .list-media')
52
+ url = first_link['href']
53
+ tid= url.split('-')[1]
54
+ return tid,url
55
+ elif ismovie == 0:
56
+ first_link = soup.select_one('#series .col .list-media')
57
+ base_url = first_link['href']
58
+ url = f'{base_url}-1-season-1-episode'
59
+ response = requests.get(url)
60
+ soup = BeautifulSoup(response.text, 'lxml')
61
+ a_tag = soup.find('a', class_='dropdown-toggle btn-service selected')
62
+ embed_id = a_tag['data-embed']
63
+ return url,embed_id
64
+
65
+
66
+
67
+ def get_protect_link(id,url):
68
+ #Get the link where the Iframe is located, which contains the doodstream url kind of.
69
+ response = requests.get(f"https://p.hdplayer.casa/myadmin/play.php?id={id}")
70
+ soup = BeautifulSoup(response.text, "lxml", parse_only=SoupStrainer('iframe'))
71
+ protect_link = soup.iframe['src']
72
+ if "protect" in protect_link:
73
+ return protect_link
74
+ else:
75
+ #DO this in case the movie has a 3D version etc
76
+ response = requests.get(url)
77
+ soup = BeautifulSoup(response.text, 'lxml')
78
+ a_tag = soup.find('a', class_='dropdown-toggle btn-service selected')
79
+ embed_id = a_tag['data-embed']
80
+ headers = {
81
+ 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36',
82
+ 'Referer': url
83
+ }
84
+ #Parameters needed is the embed ID
85
+ data = {
86
+ 'id': embed_id
87
+ }
88
+ ajax_url = f"https://www.tanti.{TF_DOMAIN}/ajax/embed"
89
+ response = requests.post(ajax_url, headers=headers, data=data)
90
+ hdplayer = response.text[43:-27]
91
+ response = requests.get(hdplayer)
92
+ soup = BeautifulSoup(response.text, 'lxml')
93
+ links_dict = {}
94
+ li_tags = soup.select('ul.nav.navbar-nav li.dropdown')
95
+ for li_tag in li_tags:
96
+ a_tag = li_tag.find('a')
97
+ if a_tag:
98
+ title = a_tag.text.strip()
99
+ #Since tantifilm player is broken I just skip it
100
+ if title == "1" or "Tantifilm" in title:
101
+ continue # Get the text of the <a> tag
102
+ href = a_tag['href']
103
+ response = requests.get(href)
104
+ soup = BeautifulSoup(response.text, "lxml", parse_only=SoupStrainer('iframe'))
105
+ protect_link = soup.iframe['src']
106
+ if "protect" in protect_link:
107
+ url = true_url(protect_link)
108
+ links_dict[title] = url
109
+ return links_dict
110
+ # Get the value of the href attribute
111
+
112
+
113
+ def get_nuovo_indirizzo_and_protect_link(url,embed_id,season,episode):
114
+ headers = {
115
+ 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36',
116
+ 'Referer': url
117
+ }
118
+ #Parameters needed is the embed ID
119
+ data = {
120
+ 'id': embed_id
121
+ }
122
+ ajax_url = f"https://www.tanti.{TF_DOMAIN}/ajax/embed"
123
+ response = requests.post(ajax_url, headers=headers, data=data)
124
+ nuovo_indirizzo = response.text[43:-27]
125
+ response = requests.get(nuovo_indirizzo)
126
+ soup = BeautifulSoup(response.text, 'lxml')
127
+ #Get season
128
+ season = season - 1
129
+ li_tags = soup.select('ul.nav.navbar-nav > li.dropdown')
130
+ if len(li_tags) != 1:
131
+ link = li_tags[season].find('a')['href']
132
+ response = requests.get(link)
133
+ soup = BeautifulSoup(response.text, 'lxml')
134
+ option_tag = soup.select(f'select[name="ep_select"] > option:nth-of-type({episode})')[0]
135
+ link = option_tag['value']
136
+ #Let's find protect link now
137
+ response = requests.get(link)
138
+ soup = BeautifulSoup(response.text, "lxml", parse_only=SoupStrainer('iframe'))
139
+ protect_link = soup.iframe['src']
140
+ return protect_link
141
+
142
+ else:
143
+ #If there is only one season than
144
+ option_tag = soup.select('select.dynamic_select > option')[episode]
145
+ link = option_tag['value']
146
+ #Let's find protect link now
147
+ response = requests.get(link)
148
+ soup = BeautifulSoup(response.text, "lxml", parse_only=SoupStrainer('iframe'))
149
+ protect_link = soup.iframe['src']
150
+ return protect_link
151
+
152
+
153
+ def true_url(protect_link):
154
+ print(protect_link)
155
+ # Define headers
156
+ headers = {
157
+ "Range": "bytes=0-",
158
+ "Referer": "https://d000d.com/",
159
+ }
160
+ response = requests.get(protect_link)
161
+ link = response.url
162
+ #Get the ID
163
+ doodstream_id = link.rsplit('/e/', 1)[-1]
164
+ # Make a GET request
165
+
166
+ if response.status_code == 200:
167
+ # Get unique timestamp for the request
168
+ real_time = str(int(time.time()))
169
+
170
+ # Regular Expression Pattern for the match
171
+ pattern = r"(\/pass_md5\/.*?)'.*(\?token=.*?expiry=)"
172
+
173
+ # Find the match
174
+ match = re.search(pattern, response.text, re.DOTALL)
175
+
176
+ # If a match was found
177
+ if match:
178
+ # Create real link (match[0] includes all matched elements)
179
+ url =f'https://d000d.com{match[1]}'
180
+ rebobo = requests.get(url, headers=headers)
181
+ real_url = f'{rebobo.text}123456789{match[2]}{real_time}'
182
+ print(real_url)
183
+ return real_url
184
+ else:
185
+ print("No match found in the text.")
186
+ return None
187
+
188
+ print("Error: Could not get the response.")
189
+ return None
190
+
191
+
192
+
193
+ #Get temporaly ID
194
+ def tantifilm(imdb):
195
+ urls = None
196
+ try:
197
+ general = is_movie(imdb)
198
+ ismovie = general[0]
199
+ imdb_id = general[1]
200
+ type = "Tuttifilm"
201
+ if ismovie == 0 :
202
+ season = int(general[2])
203
+ episode = int(general[3])
204
+ if "tt" in imdb:
205
+ if TF_FAST_SEARCH == "0":
206
+ showname,date = get_info_imdb(imdb_id,ismovie,type)
207
+ url,embed_id = search(showname,ismovie,date)
208
+ elif TF_FAST_SEARCH == "1":
209
+ showname = get_info_imdb(imdb_id,ismovie,type)
210
+ url,embed_id = fast_search(showname,ismovie)
211
+ else:
212
+ #else just equals them
213
+ tmdba = imdb_id.replace("tmdb:","")
214
+ if TF_FAST_SEARCH == "0":
215
+ showname,date = get_info_tmdb(tmdba,ismovie,type)
216
+ url,embed_id = search(showname,ismovie,date)
217
+ elif TF_FAST_SEARCH == "1":
218
+ showname= get_info_tmdb(tmdba,ismovie,type)
219
+ url,embed_id = fast_search(showname,ismovie)
220
+ protect_link = get_nuovo_indirizzo_and_protect_link(url,embed_id,season,episode)
221
+ url = true_url(protect_link)
222
+ return url
223
+ elif ismovie == 1:
224
+ if "tt" in imdb:
225
+ #Get showname
226
+ if TF_FAST_SEARCH == "0":
227
+ showname,date = get_info_imdb(imdb_id,ismovie,type)
228
+ tid,url = search(showname,ismovie,date)
229
+ elif TF_FAST_SEARCH == "1":
230
+ showname = get_info_imdb(imdb_id,ismovie,type)
231
+ date = None
232
+ tid,url = fast_search(showname,ismovie)
233
+ else:
234
+
235
+ #else just equals themtantifilm("tt2096673")
236
+
237
+ if TF_FAST_SEARCH == "0":
238
+ showname,date = get_info_tmdb(imdb,ismovie,type)
239
+ tid,url = search(showname,ismovie,date)
240
+ elif TF_FAST_SEARCH == "1":
241
+ showname = get_info_tmdb(imdb,ismovie,type)
242
+ tid,url = fast_search(showname,ismovie)
243
+ protect_link = get_protect_link(tid,url)
244
+ if not isinstance(protect_link, str):
245
+ urls = protect_link
246
+ if urls:
247
+ return urls
248
+ else:
249
+ print("Tantifilm Error v2")
250
+ else:
251
+ url = true_url(protect_link)
252
+ if url:
253
+ return url
254
+
255
+ except Exception as e:
256
+ print("Tantifilm Error: ", e)
257
+ return None