MammaMia version 2.0.0

This commit is contained in:
UrloMythus
2025-09-15 17:31:03 +02:00 Unverified
parent 87d5253580
commit 1ac0869350
47 changed files with 1513 additions and 1241 deletions
+19 -26
View File
@@ -1,6 +1,6 @@
#LOAD THE CONFIG
import json
import logging
# Open the configuration file
with open('config.json') as f:
# Load JSON data from file
@@ -8,36 +8,24 @@ with open('config.json') as f:
# Accessing SC_DOMAIN
SITE = config["Siti"]
FT_DOMAIN = SITE["Filmpertutti"]['url']
SC_DOMAIN = SITE["StreamingCommunity"]['url']
TF_DOMAIN = SITE["Tantifilm"]['url']
LC_DOMAIN = SITE["LordChannel"]['url']
SW_DOMAIN = SITE["StreamingWatch"]['url']
AW_DOMAIN = SITE['AnimeWorld']['url']
SKY_DOMAIN = SITE['SkyStreaming']['url']
CB_DOMAIN = SITE['CB01']['url']
DDL_DOMAIN = SITE['DDLStream']['url']
DLHD_DOMAIN = SITE['DaddyLiveHD']['url']
GS_DOMAIN = SITE['Guardaserie']['url']
GHD_DOMAIN = SITE['GuardaHD']['url']
OST_DOMAIN = SITE['Onlineserietv']['domain']
ES_DOMAIN = SITE['Eurostreaming']['url']
GF_DOMAIN = SITE['Guardaflix']['url']
GO_DOMAIN = SITE['Guardoserie']['url']
SC = SITE['StreamingCommunity']['enabled']
FT = SITE['Filmpertutti']['enabled']
TF = SITE['Tantifilm']['enabled']
LC = SITE['LordChannel']['enabled']
SW = SITE['StreamingWatch']['enabled']
AW = SITE['AnimeWorld']['enabled']
SKY = SITE['SkyStreaming']['enabled']
CB = SITE['CB01']['enabled']
DDL = SITE['DDLStream']['enabled']
MYSTERIUS = SITE['Mysterius']['enabled']
GS = SITE['Guardaserie']['enabled']
GHD = SITE['GuardaHD']['enabled']
OST = SITE['Onlineserietv']['enabled']
ES= SITE['Eurostreaming']['enabled']
DLHD = SITE['DaddyLiveHD']['enabled']
TF_ForwardProxy = SITE['Tantifilm']["TF_ForwardProxy"]
GF = SITE['Guardaflix']['enabled']
GO = SITE['Guardoserie']['enabled']
SC_ForwardProxy = SITE['StreamingCommunity']["SC_ForwardProxy"]
GS_ForwardProxy = SITE['Guardaserie']["GS_ForwardProxy"]
GH_ForwardProxy = SITE['GuardaHD']["GH_ForwardProxy"]
@@ -45,22 +33,21 @@ VX_ForwardProxy = SITE['StreamingCommunity']["VX_ForwardProxy"]
AW_ForwardProxy = SITE['AnimeWorld']["AW_ForwardProxy"]
MX_ForwardProxy = SITE['CB01']["MX_ForwardProxy"]
CB_ForwardProxy = SITE['CB01']["CB_ForwardProxy"]
OST_ForwardProxy = SITE['Onlineserietv']["OST_ForwardProxy"]
ES_ForwardProxy = SITE['Eurostreaming']['ES_ForwardProxy']
GF_ForwardProxy = SITE['Guardaflix']['GF_ForwardProxy']
GO_ForwardProxy = SITE['Guardoserie']['GO_ForwardProxy']
SW_ForwardProxy = SITE['StreamingWatch']['SW_ForwardProxy']
GS_PROXY = SITE['Guardaserie']["GS_PROXY"]
GH_PROXY = SITE['GuardaHD']["GH_PROXY"]
TF_PROXY = SITE['Tantifilm']["TF_PROXY"]
CB_PROXY = SITE['CB01']["CB_PROXY"]
SC_PROXY = SITE['StreamingCommunity']["SC_PROXY"]
VX_PROXY = SITE['StreamingCommunity']["VX_PROXY"]
AW_PROXY = SITE['AnimeWorld']["AW_PROXY"]
MX_PROXY = SITE['CB01']["MX_PROXY"]
OST_PROXY = SITE['Onlineserietv']["OST_PROXY"]
ES_PROXY = SITE['Eurostreaming']['ES_PROXY']
ips4_device_key = SITE['DDLStream']['cookies']["ips4_device_key"]
ips4_IPSSessionFront = SITE['DDLStream']['cookies']["ips4_IPSSessionFront"]
ips4_member_id = SITE['DDLStream']['cookies']["ips4_member_id"]
ips4_login_key = SITE['DDLStream']['cookies']["ips4_login_key"]
GF_PROXY = SITE['Guardaflix']['GF_PROXY']
GO_PROXY = SITE['Guardoserie']['GO_PROXY']
SW_PROXY = SITE['StreamingWatch']['SW_PROXY']
#General
GENERAL = config['General']
dotenv = GENERAL["load_env"]
@@ -68,6 +55,12 @@ HOST = GENERAL["HOST"]
PORT = GENERAL["PORT"]
Icon = GENERAL["Icon"]
Name = GENERAL["Name"]
Public_Instance = GENERAL["Public_Instance"]
Remote_Instance = GENERAL["Remote_Instance"]
LEVEL = GENERAL["level"]
Global_Proxy = GENERAL["Global_Proxy"]
def setup_logging(LEVEL):
LEVEL = LEVEL.upper()
level = getattr(logging, LEVEL, logging.DEBUG)
logging.basicConfig(level=level,format='%(message)s')
logger = logging.getLogger(__name__)
return logger
-2
View File
@@ -13,10 +13,8 @@ async def get_TMDb_id_from_IMDb_id(imdb_id,client):
else:
return None
async def get_IMDB_id_from_TMDb_id(tmdb_id,client):
print(tmdb_id)
url = f"https://api.themoviedb.org/3/movie/{tmdb_id}?api_key={TMDB_KEY}"
response = await client.get(url)
print(response.text)
if response.status_code == 200:
data = response.json()
imdb_id = data.get('imdb_id')
+21 -58
View File
@@ -1,17 +1,4 @@
import Src.Utilities.config as config
SKY_DOMAIN = config.SKY_DOMAIN
okru = {
"rai-1": "https://ok.ru/videoembed/9340203179632?nochat=1",
"rai-2": "https://ok.ru/videoembed/9267281010288?nochat=1",
"canale-5": "https://ok.ru/videoembed/7871149252208?nochat=1",
"italia-1": "https://ok.ru/videoembed/7393558339184?nochat=1",
"rai-premium": "https://ok.ru/videoembed/7363152715376?nochat=1",
"rai-movie": "https://ok.ru/videoembed/7384012693104?nochat=1",
"tv8": "https://ok.ru/videoembed/8077072998000?nochat=1",
"rsi-la-2": "https://ok.ru/videoembed/7681648107120?nochat=1",
"mediaset-extra": "https://ok.ru/videoembed/7363151601264?nochat=1",
"mediaset-infinity": "https://ok.ru/videoembed/6323249159792%3Fnochat=1"
}
STREAM = {
"channels": [
@@ -29,7 +16,7 @@ STREAM = {
"name": "Full HD Http",
"genres": ["Rai"],
"poster": "https://i.imgur.com/bb72vqh.jpeg",
"url": "http://173.208.52.200/rai1/index.m3u8"
"url": "https://viamotionhsi.netplus.ch/live/eds/rai1/browser-HLS8/rai1.m3u8"
},
{
"id": "rai-2",
@@ -37,7 +24,7 @@ STREAM = {
"name": "Full HD Http",
"genres": ["Rai"],
"poster": "https://i.imgur.com/jX95Qod.jpeg",
"url": "http://173.208.52.200/rai2/index.m3u8"
"url": "https://viamotionhsi.netplus.ch/live/eds/rai2/browser-HLS8/rai2.m3u8"
},
{
"id": "rai-3",
@@ -45,7 +32,7 @@ STREAM = {
"name": "Full HD Http",
"genres": ["Rai"],
"poster": "https://i.imgur.com/fgAh9if.jpeg",
"url": "http://173.208.52.200/rai3/index.m3u8"
"url": "https://viamotionhsi.netplus.ch/live/eds/rai3/browser-HLS8/rai3.m3u8"
},
{
"id": "rai-4",
@@ -53,7 +40,7 @@ STREAM = {
"name": "Full HD Http",
"genres": ["Rai"],
"poster": "https://i.imgur.com/NryLzhA.jpeg",
"url": "http://173.208.52.200/rai4/index.m3u8"
"url": "https://raiquattro1-dash-live.akamaized.net/dash/live/663977/raiquattro1/manifest.mpd"
},
{
"id": "rai-premium",
@@ -61,7 +48,7 @@ STREAM = {
"name": "Full HD",
"genres": ["Rai"],
"poster": "https://www.sorrisi.com/guidatv/bundles/tvscnewsite/css/images/loghi/rai-premium_c.png",
"url": "https://mediapolis.rai.it/relinker/relinkerServlet.htm?cont=746992"
"url": "https://raipremium1-dash-live.akamaized.net/dash/live/663979/raipremium1/manifest.mpd"
},
{
"id": "rai-4k",
@@ -78,7 +65,7 @@ STREAM = {
"name": "",
"genres": ["Rai"],
"poster": "https://is1-ssl.mzstatic.com/image/thumb/Purple221/v4/31/05/eb/3105eb24-a953-7bb9-876d-0fcfb0a19055/AppIcon-0-0-1x_U007epad-0-10-0-0-85-220.png/1200x630wa.png",
"url": "https://streamcdnb4-8e7439fdb1694c8da3a0fd63e4dda518.msvdn.net/rainews1/hls/playlist_mo.m3u8"
"url": "https://streamcdnb2-8e7439fdb1694c8da3a0fd63e4dda518.msvdn.net/rainews1/hls/playlist_mo.m3u8"
},
{
"id": "rai-movie",
@@ -86,7 +73,7 @@ STREAM = {
"name": "",
"genres": ["Rai"],
"poster": "https://www.sorrisi.com/guidatv/bundles/tvscnewsite/css/images/loghi/rai-movie_c.png",
"url": "https://m3u.iranvids.com/rai-movie/output.m3u8"
"url": "https://raimovie1-dash-live.akamaized.net/dash/live/663983/raimovie1/manifest.mpd"
},
{
"id": "rai-sport",
@@ -94,7 +81,7 @@ STREAM = {
"name": "",
"genres": ["Rai"],
"poster": "https://www.sorrisi.com/guidatv/bundles/tvscnewsite/css/images/loghi/rai-sport_c.png",
"url": "https://m3u.iranvids.com/rai-sport01/output.m3u8"
"url": "https://viamotionhsi.netplus.ch/live/eds/raisport1/browser-HLS8/raisport1.m3u8"
},
{
"id": "rete-4",
@@ -102,7 +89,7 @@ STREAM = {
"name": "Full HD Http",
"genres": ["Mediaset"],
"poster": "https://upload.wikimedia.org/wikipedia/commons/thumb/5/5f/Rete_4_2018.svg/1024px-Rete_4_2018.svg.png",
"url": "http://173.208.52.200/rete4/index.m3u8"
"url": "https://live02-seg.msf.cdn.mediaset.net/live/ch-r4/r4-clr.isml/index.m3u8"
},
{
"id": "euronews",
@@ -118,7 +105,7 @@ STREAM = {
"name": "Full HD Http",
"genres": ["Mediaset"],
"poster": "https://www.sorrisi.com/guidatv/bundles/tvscnewsite/css/images/loghi/canale-5_c.png",
"url": "http://173.208.52.200/canale5/index.m3u8"
"url": "https://viamotionhsi.netplus.ch/live/eds/canale5/browser-HLS8/canale5.m3u8"
},
{
"id": "italia-1",
@@ -126,7 +113,7 @@ STREAM = {
"name": "Full HD Http",
"genres": ["Mediaset"],
"poster": "https://upload.wikimedia.org/wikipedia/en/thumb/e/e2/Italia_1.svg/1024px-Italia_1.svg.png",
"url": "http://173.208.52.200/italia1/index.m3u8"
"url": "https://viamotionhsi.netplus.ch/live/eds/italia1/browser-HLS8/italia1.m3u8"
},
{
"id": "topcrime",
@@ -543,12 +530,12 @@ webru_dlhd = {
}
extra_sources = {
"rai-1": ["https://m3u.iranvids.com/rai01/output.m3u8"],
"rai-2": ["https://m3u.iranvids.com/rai02/output.m3u8"],
"rai-3": ["https://dash2.antik.sk/live/test_rai_tre_tizen/playlist.m3u8","https://wzstreaming.rai.it/TVlive/liveStream/playlist.m3u8","https://list.iptvcat.com/my_list/s/1f22856f68f2fba4a993c47f47c78a64.m3u8","https://list.iptvcat.com/my_list/s/a372048a4fb440e752aec141aa02885f.m3u8","https://list.iptvcat.com/my_list/s/c7efe17aa0dc8096561967bfb828d4f3.m3u8","https://list.iptvcat.com/my_list/s/2d1f14bbb3370d263d8d3f0d9f5128e0.m3u8"],
"rete-4":["https://tvit.leicaflorianrobert.dev/mediaset/rete-4/stream.m3u8","https://live02-seg.msf.cdn.mediaset.net/live/ch-r4/r4-clr.isml/index.m3u8"],
"canale-5":["https://live02-seg.msf.cdn.mediaset.net/live/ch-c5/c5-clr.isml/index.m3u8","https://tvit.leicaflorianrobert.dev/mediaset/canale-5/stream.m3u8"],
"italia-1":["https://tvit.leicaflorianrobert.dev/mediaset/italia-1/stream.m3u8","https://live02-seg.msf.cdn.mediaset.net/live/ch-i1/i1-clr.isml/index.m3u8"],
"rai-1": ["https://ilglobotv-live.akamaized.net/channels/RAI1/Live.m3u8"],
"rai-2": ["https://ilglobotv-live.akamaized.net/channels/RAI2/Live.m3u8"],
"rai-3": ["https://ilglobotv-live.akamaized.net/channels/RAI2/Live.m3u8","https://dash2.antik.sk/live/test_rai_tre_tizen/playlist.m3u8","https://wzstreaming.rai.it/TVlive/liveStream/playlist.m3u8","https://list.iptvcat.com/my_list/s/1f22856f68f2fba4a993c47f47c78a64.m3u8","https://list.iptvcat.com/my_list/s/a372048a4fb440e752aec141aa02885f.m3u8","https://list.iptvcat.com/my_list/s/c7efe17aa0dc8096561967bfb828d4f3.m3u8","https://list.iptvcat.com/my_list/s/2d1f14bbb3370d263d8d3f0d9f5128e0.m3u8"],
"rete-4":["https://tvit.leicaflorianrobert.dev/mediaset/rete-4/stream.m3u8","https://timlivetu0.cb.ticdn.it/Content/DASH/Live/channel(rete4)/manifest.mpd"],
"canale-5":["https://timlivetu0.cb.ticdn.it/Content/DASH/Live/channel(canale5)/manifest.mpd","https://tvit.leicaflorianrobert.dev/mediaset/canale-5/stream.m3u8",'https://timlivetu0.cb.ticdn.it/Content/DASH/Live/channel(canale5)/manifest.mpd','https://live02-seg.msf.cdn.mediaset.net/live/ch-c5/c5-clr.isml/index.m3u8'],
"italia-1":["https://tvit.leicaflorianrobert.dev/mediaset/italia-1/stream.m3u8","https://live02-seg.msf.cdn.mediaset.net/live/ch-i1/i1-clr.isml/index.m3u8",'https://timlivetu0.cb.ticdn.it/Content/DASH/Live/channel(italia1)/manifest.mpd'],
"rai-4k": ["https://list.iptvcat.com/my_list/s/fbf04fbd9694eee71b5af9f12e49538d.m3u8"],
"rai-news":["https://8e7439fdb1694c8da3a0fd63e4dda518.msvdn.net/rainews1/hls/playlist_mo.m3u8"],
"topcrime": ["https://tvit.leicaflorianrobert.dev/mediaset/top-crime/stream.m3u8"],
@@ -564,33 +551,7 @@ extra_sources = {
"doctor-who": ["https://amg00793-amg00793c17-samsung-it-4577.playouts.now.amagi.tv/playlist/amg00793-bbcstudios-drwhoitaly-samsungit/playlist.m3u8"],
"supertennis": ["https://live-embed.supertennix.hiway.media/restreamer/supertennix_client/gpu-a-c0-16/restreamer/outgest/h24_supertennix/manifest.m3u8"]
}
skystreaming ={
"sky-sport-tennis": f"{SKY_DOMAIN}/embed/MKCKP",
"sky-sport-24": f"{SKY_DOMAIN}/embed/GB7zq",
"sky-sport-251": f"{SKY_DOMAIN}/embed/drHbM",
"sky-sport-252": f"{SKY_DOMAIN}/embed/m5kfg",
"sky-sport-253": f"{SKY_DOMAIN}/embed/YprHf",
"sky-sport-254": f"{SKY_DOMAIN}/embed/wroRV",
"sky-sport-255": f"{SKY_DOMAIN}/embed/0TixN",
"sky-sport-256": f"{SKY_DOMAIN}/embed/8g8bh",
"sky-sport-257": f"{SKY_DOMAIN}/embed/ri859",
"sky-sport-258": f"{SKY_DOMAIN}/embed/UoJuW",
"sky-sport-259": f"{SKY_DOMAIN}/embed/squCy",
"sky-sport-260": f"{SKY_DOMAIN}/embed/Z5h2e",
"sky-sport-261": f"{SKY_DOMAIN}/embed/Hz9FW",
"sky-sport-uno": f"{SKY_DOMAIN}/embed/tb1np",
"sky-sport-f1": f"{SKY_DOMAIN}/embed/MLkym",
"sky-sport-motogp": f"{SKY_DOMAIN}/embed/ARFFv",
"sky-sport-calcio": f"{SKY_DOMAIN}/embed/STOZT",
"sky-sport-arena": f"{SKY_DOMAIN}/embed/NkEda",
"sky-sport-max": f"{SKY_DOMAIN}/embed/4QzWz",
"sky-sport-nba": f"{SKY_DOMAIN}/embed/saR8j",
"sky-sport-golf": f"{SKY_DOMAIN}/embed/s9L5f",
"eurosport-1": f"{SKY_DOMAIN}/embed/Vyv99",
"eurosport-2": f"{SKY_DOMAIN}/embed/um8E5",
"dazn-zona-a": ["https://hls.kangal.sbs/hls/serie/index.m3u8","https://hls.kangal.sbs/hls/serie/index.m3u8"],
"sportitalia": "https://hls.kangal.sbs/hls/sportitalia/index.m3u8",
}
huhu = {
"canale-5": "1101559666",
"sky-sport-motogp": "2090703806",
@@ -619,5 +580,7 @@ provider_map = {
"GS": "GUARDASERIE",
"GHD": "GUARDAHD",
"OST": "ONLINESERIETV",
"ES": "EUROSTREAMING"
"ES": "EUROSTREAMING",
"GO": "GUARDOSERIE",
"GF": "GUARDAFLIX"
}
+7 -3
View File
@@ -14,6 +14,11 @@ from fake_headers import Headers
"""Unpacker for Dean Edward's p.a.c.k.e.r"""
import re
from bs4 import BeautifulSoup, SoupStrainer
import logging
import Src.Utilities.config as config
from Src.Utilities.config import setup_logging
level = config.LEVEL
logger = setup_logging(level)
def detect(source):
if "eval(function(p,a,c,k,e,d)" in source:
@@ -142,7 +147,7 @@ async def eval_solver(stream_link,proxies, ForwardProxy, client):
headers["User-Agent"] = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36"
headers["accept-language"] = 'en-US,en;q=0.5'
response = await client.get( ForwardProxy + stream_link, allow_redirects=True, timeout=30, headers = headers, proxies = proxies, impersonate = "chrome124")
print("Eval:",response.status_code)
logger.debug("Eval:",response.status_code)
soup = BeautifulSoup(response.text, "lxml",parse_only=SoupStrainer("script"))
script_all = soup.find_all("script")
for i in script_all:
@@ -158,7 +163,7 @@ async def eval_solver(stream_link,proxies, ForwardProxy, client):
m3u8_url = match.group(1)
return m3u8_url
except Exception as e:
print("Eval solver error\n",e)
logger.debug("Eval solver error\n",e)
raise Exception("Error in eval_solver")
@@ -167,7 +172,6 @@ async def test_animeworld():
from curl_cffi.requests import AsyncSession
async with AsyncSession() as client:
results = await eval_solver("https://mixdrop.cv/e/l6kqxrm4t4l4or",{},"",client)
print("https:"+results)
if __name__ == "__main__":
import asyncio
+24 -1
View File
@@ -57,6 +57,10 @@ def get_info_tmdb(tmbda,ismovie,type):
date = show.first_air_date
date = date.split("-")[0]
return showname,date
elif type == "Guardoserie":
date = show.first_air_date
date = date.split("-")[0]
return showname,date
elif ismovie == 1:
movie = Movie()
@@ -97,6 +101,14 @@ def get_info_tmdb(tmbda,ismovie,type):
date = show.release_date
date = date.split("-")[0]
return showname,date
elif type == "Guardoserie":
date = show.release_date
date = date.split("-")[0]
return showname,date
elif type == 'Guardaflix':
date = show.release_date
date = date.split("-")[0]
return showname,date
async def get_info_imdb(imdb_id, ismovie, type,client):
resp = await client.get(f'https://api.themoviedb.org/3/find/{imdb_id}?api_key={TMDB_KEY}&language=it&external_source=imdb_id')
@@ -141,7 +153,10 @@ async def get_info_imdb(imdb_id, ismovie, type,client):
date = data['tv_results'][0]['first_air_date']
date = date.split("-")[0]
return showname,date
elif type == "Guardoserie":
date = data['tv_results'][0]['first_air_date']
date = date.split("-")[0]
return showname,date
elif ismovie == 1:
showname= data['movie_results'][0]['title']
if type == "Filmpertutti":
@@ -172,6 +187,14 @@ async def get_info_imdb(imdb_id, ismovie, type,client):
date = data['movie_results'][0]['release_date']
date = date.split("-")[0]
return showname,date
elif type == "Guardoserie":
date = data['movie_results'][0]['release_date']
date = date.split("-")[0]
return showname,date
elif type == 'Guardaflix':
date = data['movie_results'][0]['release_date']
date = date.split("-")[0]
return showname,date
async def get_info_kitsu(kitsu_id,client):
+1 -6
View File
@@ -1,8 +1,6 @@
import os
import Src.Utilities.config as config
MYSTERIUS = config.MYSTERIUS
dotenv = config.dotenv
Public_Instance = config.Public_Instance
#You need to keep dotenv disabled on remote servers
if dotenv == "1":
from dotenv import load_dotenv
@@ -12,10 +10,7 @@ if dotenv == "1":
def load_env():
env_vars = {}
env_vars['TMDB_KEY'] = os.getenv('TMDB_KEY')
if MYSTERIUS == "1":
env_vars['MYSTERIUS_KEY'] = os.getenv('MYSTERIUS_KEY')
env_vars['PROXY_CREDENTIALS'] = os.getenv('PROXY')
if Public_Instance == "1":
env_vars['ALTERNATIVE_LINK'] = os.getenv('ALTERNATIVE_LINK')
env_vars['ForwardProxy'] = os.getenv('FORWARDPROXY')
env_vars['PORT_ENV'] = os.getenv('PORT')
return env_vars
-132
View File
@@ -1,132 +0,0 @@
from urllib.parse import urlparse, parse_qs,unquote,quote
from fastapi import APIRouter, HTTPException, Response, Request
from curl_cffi.requests import AsyncSession
import Src.Utilities.config as config
from Src.Utilities.loadenv import load_env
env_vars = load_env()
SC_PROXY = config.SC_PROXY
VX_PROXY = config.VX_PROXY
import json
import re
import random
proxies = {}
proxies2 = {}
if VX_PROXY == "1":
PROXY_CREDENTIALS = env_vars.get('PROXY_CREDENTIALS')
proxy_list = json.loads(PROXY_CREDENTIALS)
proxy = random.choice(proxy_list)
if proxy == "":
proxies2 = {}
else:
proxies2 = {
"http": proxy,
"https": proxy
}
if SC_PROXY == "1":
PROXY_CREDENTIALS = env_vars.get('PROXY_CREDENTIALS')
proxy_list = json.loads(PROXY_CREDENTIALS)
proxy = random.choice(proxy_list)
if proxy == "":
proxies = {}
else:
proxies = {
"http": proxy,
"https": proxy
}
if VX_PROXY == "1":
proxies2 = proxies
SC_ForwardProxy = config.SC_ForwardProxy
VX_ForwardProxy = config.VX_ForwardProxy
if SC_ForwardProxy == "1":
ForwardProxy = env_vars.get('ForwardProxy')
else:
ForwardProxy = ""
if VX_ForwardProxy == "1":
ForwardProxy = env_vars.get('ForwardProxy')
else:
ForwardProxy = ""
router = APIRouter()
User_Agent= "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:127.0) Gecko/20100101 Firefox/127.0"
async def fetch_m3u8(url):
"""Fetch the M3U8 file from the URL and store it in memory."""
async with AsyncSession() as client:
response = await client.get(ForwardProxy + url,headers = {"User-Agent": User_Agent, "user-agent": User_Agent}, proxies = proxies2)
response.raise_for_status() # Raise an error for bad responses
return response.text
@router.get("/clone/manifest.m3u8")
async def clone_m3u8(d: str = None):
if d:
try:
d = unquote(d)
m3u8_content = await fetch_m3u8(d)
return Response(content=m3u8_content, media_type='application/vnd.apple.mpegurl')
except Exception as e:
print(f"Failed to fetch M3U8 file: {e}")
raise HTTPException(status_code=404, detail="M3U8 content not found")
#This is just for testing, ignore that endpoint and the func
@router.api_route("/vixcloud/manifest.m3u8", methods=["GET", "HEAD"])
async def clone2_m3u8(d:str,token:str,expires:str,h:str = None, b:str = None, request: Request = None):
try:
m3u8 = f'{d}?token={token}&expires={expires}'
if h:
m3u8 = m3u8 + f'&h={h}'
if b:
m3u8 = m3u8 + f'&b={b}'
forwarded_proto = request.headers.get("x-forwarded-proto")
scheme = forwarded_proto if forwarded_proto else request.url.scheme
instance_url = f"{scheme}://{request.url.netloc}"
m3u8_content = await fetch_m3u8(m3u8)
modified_playlist = m3u8_content.replace("https://vixcloud.co/playlist/", f"{instance_url}/clony/")
return Response(content=modified_playlist, media_type='application/vnd.apple.mpegurl')
except Exception as e:
print(f"Failed to fetch M3U8 file: {e}")
raise HTTPException(status_code=404, detail="M3U8 content not found")
@router.api_route("/clony/{segment:path}", methods=["GET", "HEAD"])
async def clony_m3u8(segment: str, request: Request):
base_url = "https://vixcloud.co/playlist/"
full_url = f"{base_url}{segment}?{request.query_params}"
print(full_url, "A",request.query_params)
if "rendition=1080p" in full_url or "type=subtitle" in full_url:
print(full_url)
raise HTTPException(status_code=404, detail="Requested variant not available.")
m3u8_content = await fetch_m3u8(full_url)
if "sc-u12" not in m3u8_content:
m3u8_content = re.sub(r"https://sc-[a-zA-Z0-9]+-\d+.scws-content.net", "https://sc-u12-01.scws-content.net", m3u8_content)
return Response(content=m3u8_content, media_type='application/vnd.apple.mpegurl')
@router.api_route('/storage/enc.key')
async def get_key():
async with AsyncSession(timeout = 20) as client:
response = await client.get(ForwardProxy + 'https://vixcloud.co/storage/enc.key', headers = {"User-Agent": User_Agent, "user-agent": User_Agent}, proxies = proxies2)
response_headers = {
'date': response.headers['date'],
'content-length': response.headers['content-length'],
'content-type': 'application/octet-stream',
'access-control-allow-origin': '*'
}
return Response(
response.content,
response.status_code,
response_headers
)
#r"https://sc-b1-([0-2][0-9]|30).scws-content.net", "https://sc-u9-01.scws-content.net", m3u8_content)
'''
forwarded_proto = request.headers.get("x-forwarded-proto")
scheme = forwarded_proto if forwarded_proto else request.url.scheme
instance_url = f"{scheme}://{request.url.netloc}"
url_streaming_community = url_streaming_community.replace("?","&")
url_streaming_community = instance_url + "/vixcloud/manifest.m3u8?d=" + url_streaming_community
'''
+27
View File
@@ -0,0 +1,27 @@
import logging
import Src.Utilities.config as config
from Src.Utilities.config import setup_logging
import urllib.parse
level = config.LEVEL
logger = setup_logging(level)
async def transform_mfp(mfp_stream_url,client):
try:
response = await client.get(mfp_stream_url)
data = response.json()
url = data['mediaflow_proxy_url'] + "?api_password=" + data['query_params']['api_password'] + "&d=" + urllib.parse.quote(data['destination_url'])
for i in data['request_headers']:
url += f"&h_{i}={urllib.parse.quote(data['request_headers'][i])}"
return url
except Exception as e:
logger.warning(f"Converting MFP failed {e}")
return None
async def build_mfp(MFP_CREDENTIALS,url,host,client):
MFP_url = MFP_CREDENTIALS[0]
MFP_password = MFP_CREDENTIALS[1]
url_mfp = f'{MFP_url}/extractor/video?api_password={MFP_password}&d={url}&host={host}&redirect_stream=false'
#To build pieces together
url_mfp = await transform_mfp(url_mfp,client)
return url_mfp