diff --git a/.gitignore b/.gitignore index a1b9cbb..66d3ae4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .env -__pycache__/ \ No newline at end of file +__pycache__/ +.vercel diff --git a/Dockerfile b/Dockerfile index 9ac8777..533965b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,6 @@ FROM python:3.10-slim-buster WORKDIR /app # Copy the current directory contents into the container at /app -# (including run.py, filmpertutti.py, and requirements.txt) ADD . /app # Install any needed packages specified in requirements.txt RUN pip install --no-cache-dir -r requirements.txt diff --git a/Dockerfiles/Dockerfile-auto-update-no-config b/Dockerfiles/Dockerfile-auto-update-no-config index a00613a..7b0fcfc 100644 --- a/Dockerfiles/Dockerfile-auto-update-no-config +++ b/Dockerfiles/Dockerfile-auto-update-no-config @@ -1,4 +1,4 @@ - Use an official Python runtime as a parent image +#Use an official Python runtime as a parent image FROM python:3.10-slim-buster # Set the working directory in the container to /app diff --git a/README.md b/README.md index abbeb5b..0ebf201 100644 --- a/README.md +++ b/README.md @@ -13,28 +13,11 @@ -A Stremio Addon for high quality HTTPS Streams in Italian +A Stremio Addon for HTTPS Streams in Italian Movies, Series, Anime and Live TV are supported. - - - - - - - - -While hosting, this project, remember that Filmpertutti uses Mixdrop. Mixdrop only allows seeing the videos from the same IP where they were generated so, if you want to scrape filmpertutti, you will have to host this project locally. Else, you can only scrape other providers. - - - - - - - -Hosting your own instance is suggested, but you can use the public instance [linked](https://mammamia-urlo-mammamia.hf.space/) in the About Page of the repo. - + @@ -111,45 +94,21 @@ To host this project with Hugging Face, go to the [linked](https://huggingface.c - - - - 2. Go to [linked](https://huggingface.co/spaces/MammaMia-Urlo/CloneThisSpace) page and click on three dots on the top (right) part of the screen - - - - - - 3. Click Duplicate this Space - - - - - - 4. Insert TMDB Key and set visibility to Public + +5. Duplicate the Project - - - - - - -5. Clone the Project - - -6. Go into settings and click on Factory Rebuild. - - +6. Go on the Github of the [Repo](https://github.com/UrloMythus/MammaMia/), and after creating a Github Account click on Fork -> Create New Fork -> Create One. +7. After that go back to your HuggingFace Space and click on Files --> Click on Dockerfile ---> Click on edit ---> Where there is "YourUsername" put your Github username and where there is "YourRepoName" insert the name of the fork. +8. When you are done click Commit Changes to main 7. You are done! - @@ -158,24 +117,11 @@ To host this project with Hugging Face, go to the [linked](https://huggingface.c 8. To install it on Stremio altought, you will need the Direct URL. It can be found on three dots --> Embed This Space --> Direct URL If you do not find it it means your space is Private. To fix so go to Settings and click Set Visibility to Public. + - - - - -9. How do I handle updates? To update the addon you will have to Factory Rebuild your space (in Settings) and, if there are any changes to config.json, copy them from [here](https://github.com/UrloMythus/MammaMia/blob/main/config.json) to the config.json in your Space, under Files. - - -10. How can I use Live TV? For now it won't work on public instances. Wait until next update. - - - - - -Technical Details: -On Hugging Face you are forced to use the 8080 port because it is the only one allowed to send/get network requests. Moreover, remember that load_env and Public Instance need to be disabled in the config.json (it should be by default if you clone the project from HF) - + +How do I handle Updates ? First of all you will need to go to your GitHub Repo and click Sync Changes. Then go into your HuggingFace Space ---> Settings ---> Factory Reset @@ -184,7 +130,7 @@ On Hugging Face you are forced to use the 8080 port because it is the only one a ## Render - +[](https://render.com/deploy?repo=https://github.com/UrloMythus/MammaMia) @@ -244,13 +190,14 @@ To install this project on [Render](https://render.com/) follow these steps: -Remember, load_env and Public Instance needs to be disabled in the config.json +Remember, load_env and Public Instance needs to be disabled in the config.json and Remote_Instance needs to be set to 1 - +# Vercel +[](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2FUrloMythus%2FMammaMia&env=PORT,TMDB_KEY&envDescription=PORT%20(8080)%20and%20API%20KEY%20of%20TMDB&envLink=https%3A%2F%2Fgithub.com%2FUrloMythus%2FMammaMia%2Fblob%2Fmain%2Fexample.env) @@ -285,8 +232,8 @@ Open your instance URL and configure MammaMia. Once you are done you can click o | Enviroment Variable | Value | |-------------------------|---| |TMDB_KEY|INSERT YOUR API KEY HERE| - - +|FORWARDPROXY| "YOURFORWARDPROXY/" For sites with Cloudfare Protections| +|PROXY | ["PROXY1","PROXY2"] For sites with Cloudfare Protections, use as many as you wish| @@ -306,7 +253,9 @@ Here is [linked](https://www.themoviedb.org/settings/api) a tutorial about how t -In the repo there is a config.json that you can modify to change some aspects of the addon like the domains of the sites. Down here all explained: +In the repo there is a config.json that you can modify to change some aspects of the addon like the domains of the sites. "1" means True, "0" means False + +Down here all explained: @@ -315,18 +264,20 @@ In the repo there is a config.json that you can modify to change some aspects of | Config | Value | |-------------------------|---| | Domain | The domain of the site, must be a string | -|enabled | If the site is enabled or not. "1" means true. "0" means false. Remember, there is no point in enabling filmpertutti on a remote server since it's IP-LOCKED| -|fast_search|"1" for enabled, "0" for disabled. It enables a faster search for supported providers but it is less accurate| -|load_env|Put "1" if enabled, "0" if disabled. It needs to be enabled if you need to load a .env file. On remote hosting services, like Hugging Face or Render, it needs to be disabled. | +|enabled | If the site is enabled or not. This will override user-preference while configuration the add-on| +|**_ForwardProxy|If that site needs to use a ForwardProxy which needs to be given in the enviroment variables +|**_Proxy| If that site needs to use Proxies which need to be given in the enviroment variables +|Cookies| Cookies needed for a specific site to work. To get them you will need to log in the site and obtain cookies using Dev Tools. +|load_env|It needs to be enabled if you need to load a .env file. On remote hosting services, like Hugging Face or Render, it needs to be disabled. | |HOST| The host for the Fast API APP| |PORT| The port for the Fast API APP. Default: 8080 | - +|Icon| The Icon for the Add-On.| +|Public_Instance| If it's the main public instance. Most of users shouldn't care about this| +|Remote_Instance| Set to "1" if the server where the add-on is hosted has not the same IP of the one where Stremio Server is.| +|Global_Proxy| Whatever to enable a Global Proxy which will be valid for every request in the add-on. For now Mysterius must be kept disabled if you do not know what you are doing. - -For now Tantifilm, even if its player is not IP-Locked, does not work on Hugging Face. - Check those links to get the new Domain for the providers. @@ -355,14 +306,22 @@ Check those links to get the new Domain for the providers. [ANIMEWORLD](https://t.me/AnimeWorldITA2) +[CB01](https://cb01official.community/) + +## Mediaflow Proxy + +This project uses Mediaflow-Proxy to bypass some protections. You can find instructions about how to install it [here](https://github.com/mhdzumair/mediaflow-proxy/). +Not only some provider won't play without it, as said in the config, but also most of paid channels won't. ## Credits - Big thanks to [Lovi0](https://github.com/Lovi-0), the creator of StreamingCommunity downloader, for helping me with some aspects of this project. - - This project uses [MediaFlowProxy](https://github.com/mhdzumair/mediaflow-proxy/) in order to be able to play some Live TV channels. Big thanks to his creator, [mhdzumair](https://github.com/mhdzumair) + - This project uses [MediaFlowProxy](https://github.com/mhdzumair/mediaflow-proxy/) in order to be able to play some Live TV channels and to proxy some streams. Big thanks to his creator, [mhdzumair](https://github.com/mhdzumair) ## Disclaimer -This project does not host any illegal content on his servers, if you want any content to be taken down, please contact the actual owners of those sites. -The Live TV sources are taken from online sites, avaiable on the web and indixed by Google. + +We hereby issue this notice to inform you that this Add-On just function like an ordinary browser (like your browser) that fetch video files from internet, and do not violate the provisions of the Digital Millennium Copyright Act (DMCA). The Content these extensions may access is not hosted or made avaiable by us or the Stremio application but the websites they are browsing in their autonomous mode. It is sole responsibility of the user and his/her countries' or states' law. If you think they are violating any intellectual property then please contact the actual file hosts not the owners of this repository or the Stremio app. + +Thank You. diff --git a/Src/API/cb01.py b/Src/API/cb01.py index 2a0a9d2..4b4abd0 100644 --- a/Src/API/cb01.py +++ b/Src/API/cb01.py @@ -5,12 +5,11 @@ from Src.Utilities.convert import get_TMDb_id_from_IMDb_id from fake_headers import Headers import Src.Utilities.config as config from Src.Utilities.loadenv import load_env -HF = config.HF - -env_vars = load_env() -ForwardProxy_list = config.ForwardProxy -ForwardProxy = ForwardProxy_list[0] -PROXY_CREDENTIALS = env_vars.get('PROXY_CREDENTIALS') +CB_DOMAIN = config.CB_DOMAIN +CB_PROXY = config.CB_PROXY +if CB_PROXY == "1": + env_vars = load_env() + PROXY_CREDENTIALS = env_vars.get('PROXY_CREDENTIALS') fake_headers = Headers() async def get_stayonline(link,client): @@ -22,14 +21,13 @@ async def get_stayonline(link,client): data = {'id': link.split("/")[-2], 'ref': ''} response = await client.post('https://stayonline.pro/ajax/linkEmbedView.php', headers=headers, data=data) real_url = response.json()['data']['value'] - print(real_url) return real_url async def get_uprot(link,client): if "msf" in link: link = link.replace("msf","mse") - if PROXY_CREDENTIALS : + if CB_PROXY == "1": import json import random proxy_list = json.loads(PROXY_CREDENTIALS) @@ -45,18 +43,22 @@ async def get_uprot(link,client): proxies = {} headers = fake_headers.generate() - print(ForwardProxy + link) - response = await client.get(ForwardProxy + link, headers=headers, allow_redirects=True, timeout=10, proxies=proxies) + response = await client.get(link, headers=headers, allow_redirects=True, timeout=10, proxies=proxies, impersonate = "chrome124") soup = BeautifulSoup(response.text, "lxml") maxstream_url = soup.find("a") maxstream_url = maxstream_url.get("href") return maxstream_url -async def get_true_link_mixdrop(real_link,client): +async def get_true_link_mixdrop(real_link,client,MFP): try: import string + if "club" in real_link: + real_link = real_link.replace("club","ps").split('/2')[0] + + if MFP == "1": + return real_link headers = fake_headers.generate() - response = await client.get(real_link, headers=headers, allow_redirects=True,timeout = 30) + response = await client.get(real_link, headers=headers, allow_redirects=True,timeout = 30, impersonate = "chrome124") [s1, s2] = re.search(r"\}\('(.+)',.+,'(.+)'\.split", response.text).group(1, 2) schema = s1.split(";")[2][5:-1] terms = s2.split("|") @@ -70,11 +72,24 @@ async def get_true_link_mixdrop(real_link,client): print(s) return s except Exception as e: + print(e) return None async def get_true_link_maxstream(maxstream_url,client): headers = fake_headers.generate() + if CB_PROXY == "1": + import json + import random + proxy_list = json.loads(PROXY_CREDENTIALS) + proxy = random.choice(proxy_list) + if proxy == " ": + proxies = { + "http": proxy, + "https": proxy + } + else: + proxies = {} # Send a GET request to the Maxstream URL - response = await client.get(ForwardProxy + maxstream_url, headers=headers, allow_redirects=True, timeout=10) + response = await client.get(maxstream_url, headers=headers, allow_redirects=True, timeout=10,proxies = proxies, impersonate = "chrome124") [s1, s2] = re.search(r"\}\('(.+)',.+,'(.+)'\.split", response.text).group(1, 2) terms = s2.split("|") urlset_index = terms.index('urlset') @@ -111,9 +126,11 @@ async def search_movie(showname,date,client): try: showname = showname.replace(" ","+") headers = fake_headers.generate() - headers['Referer'] = 'https://cb01.technology/' - query = f'https://cb01.technology/?s={showname}' - response = await client.get(query,headers=headers) + headers['Referer'] = f'https://cb01new.{CB_DOMAIN}/' + query = f'https://cb01new.{CB_DOMAIN}/?s={showname}' + response = await client.get(query,headers=headers, impersonate = "chrome124") + if response.status_code != 200: + print(f"CB01 Failed to fetch search results: {response.status_code}") soup = BeautifulSoup(response.text, 'lxml',parse_only=SoupStrainer('div', class_='card-content')) cards = soup.find_all('div', class_='card-content') year_pattern = re.compile(r'(19|20)\d{2}') @@ -121,18 +138,15 @@ async def search_movie(showname,date,client): # Find the link inside the current card link_tag = card.find('h3', class_='card-title').find('a') href = link_tag['href'] - # Find the date span and extract possible years - date_span = card.find('span', style=re.compile('color')) - if date_span: - date_text = date_span.text + + date_text = href.split("/")[-2] # Search for the first occurrence of a year (starting with 19 or 20) - match = year_pattern.search(date_text) - if match: - year = match.group(0) - if year == date : # Check if the year is 2011 - print(f"Link: {href}") - return href + match = year_pattern.search(date_text) + if match: + year = match.group(0) + if year == date : # Check if the year is 2011 + return href except Exception as e: print(f'MammaMia: Error in search_series cb01: {e}') @@ -141,9 +155,11 @@ async def search_series(showname,date,client): try: showname = showname.replace(" ","+") headers = fake_headers.generate() - headers['Referer'] = 'https://cb01.technology/serietv/' - query = f'https://cb01.technology/serietv/?s={showname}' - response = await client.get(query,headers=headers) + headers['Referer'] = f'https://cb01new.{CB_DOMAIN}/serietv/' + query = f'https://cb01new.{CB_DOMAIN}/serietv/?s={showname}' + response = await client.get(query,headers=headers,impersonate = "chrome124") + if response.status_code != 200: + print(f"CB01 Failed to fetch search results: {response.status_code}") soup = BeautifulSoup(response.text, 'lxml',parse_only=SoupStrainer('div', class_='card-content')) cards = soup.find_all('div', class_='card-content') year_pattern = re.compile(r'(19|20)\d{2}') @@ -161,23 +177,35 @@ async def search_series(showname,date,client): if match: year = match.group(0) if year == date : # Check if the year is 2011 - print(f"Link: {href}") return href except Exception as e: print(f'MammaMia: Error in search_series cb01: {e}') -async def movie_redirect_url(link,client): +async def movie_redirect_url(link,client,MFP): headers = fake_headers.generate() - response = client.get(link, headers=headers, allow_redirects=True, timeout=10) + response = await client.get(link, headers=headers, allow_redirects=True, timeout=10, impersonate = "chrome124") # Extract the redirect URL from the HTML - soup = BeautifulSoup(response.text, "lxml",parse_only=SoupStrainer('div', id='iframen1')) - redirect_url = soup.find("div", id="iframen1").get("data-src") + soup = BeautifulSoup(response.text, "lxml",parse_only=SoupStrainer('div')) + redirect_url = soup.find("div", id="iframen2").get("data-src") + try: + if "stayonline" in redirect_url: + mixdrop_real_link = await get_stayonline(redirect_url,client) + final_url = await get_true_link_mixdrop(mixdrop_real_link,client,MFP) + return final_url + except Exception as e: + redirect_url = soup.find("div", id="iframen1").get("data-src") + if "stayonline" in maxstream_link: + maxstream_link =await get_stayonline(maxstream_link,client) + maxstream_real_link = await get_uprot(maxstream_link,client) + final_url = await get_true_link_maxstream(maxstream_real_link,client) + return(final_url) + return redirect_url -async def series_redirect_url(link,season,episode,client): +async def series_redirect_url(link,season,episode,client,MFP): if len(episode) == 1: episode = f'0{episode}' headers = fake_headers.generate() - response = await client.get(link, headers=headers, allow_redirects=True, timeout=10) + response = await client.get(link, headers=headers, allow_redirects=True, timeout=10,impersonate = "chrome124") soup = BeautifulSoup(response.text, "lxml") seasons_text = soup.find_all('div', class_='sp-head') for season_text in seasons_text: @@ -190,11 +218,11 @@ async def series_redirect_url(link,season,episode,client): sp_body = season_text.find_next('div', class_='sp-body') link_tag = sp_body.find('a') uprot_long = link_tag.get('href') - response = await client.get(uprot_long, headers=headers, allow_redirects=True, timeout=10) + response = await client.get(uprot_long, headers=headers, allow_redirects=True, timeout=10, impersonate = "chrome124") season = "01" episode = "04" pattern1 = rf"(?i)\S*?\.{season}x{episode}\S*?\.mkv.*?href=['\"](.*?)['\"]" - pattern2 = rf"\S*\.S{season}E{episode}\S*?\.mkv.*?href=['\"](.*?)['\"]" + pattern2 = rf"\S*\.S{season}E{episode}\S*?\.mkv|\.mp4|\.avi.*?href=['\"](.*?)['\"]" match = re.search(pattern1, response.text) if match: maxstream_link = match.group(1) @@ -202,13 +230,11 @@ async def series_redirect_url(link,season,episode,client): match = re.search(pattern2, response.text) if match: maxstream_link = match.group(1) - print(maxstream_link) if "stayonline" in maxstream_link: maxstream_link =await get_stayonline(maxstream_link,client) maxstream_real_link = await get_uprot(maxstream_link,client) final_url = await get_true_link_maxstream(maxstream_real_link,client) - print(final_url) - + return final_url else: pattern = re.compile(r'4×03\s*–.*?Maxstream\s*–.*?Mixdrop', re.DOTALL) match = pattern.search(response.text) @@ -217,21 +243,19 @@ async def series_redirect_url(link,season,episode,client): print(f"Maxstream: {maxstream_link}") print(f"Mixdrop: {mixdrop_link}") mixdrop_real_link = await get_stayonline(mixdrop_link,client) - final_url = await get_true_link_mixdrop(mixdrop_real_link,client) + final_url = await get_true_link_mixdrop(mixdrop_real_link,client,MFP) if final_url == None: if "stayonline" in maxstream_link: maxstream_link =await get_stayonline(maxstream_link,client) maxstream_real_link = await get_uprot(maxstream_link,client) - final_url = await get_true_link_maxstream(maxstream_real_link,client) - print(final_url) - + final_url = await get_true_link_maxstream(maxstream_real_link,client) + return final_url - -async def cb01(id,client): +async def cb01(id,client,MFP): try: - general = is_movie(id) + general = await is_movie(id) ismovie = general[0] real_id = general[1] type = "Cb01" @@ -243,12 +267,14 @@ async def cb01(id,client): season = general[2] episode = general[3] link = await search_series(showname,date,client) - redirect_url = await series_redirect_url(link,season,episode,client) + final_url = await series_redirect_url(link,season,episode,client,MFP) + return final_url elif ismovie == 1: season = None episode = None link = await search_movie(showname,date,client) - redirect_url = await movie_redirect_url(link,client) + redirect_url = await movie_redirect_url(link,client,MFP) + return redirect_url except Exception as e: print(f'MammaMia: Error in cb01: {e}') return None @@ -275,8 +301,10 @@ async def test_animeworld(): from curl_cffi.requests import AsyncSession async with AsyncSession() as client: # Replace with actual id, for example 'anime_id:episode' format - test_id = "tt0158552:1:1" # This is an example ID format - results = await cb01(test_id, client) + test_id = "tt14948432" # This is an example ID format + MFP = "1" + results = await cb01(test_id, client,MFP) + print(results) if __name__ == "__main__": import asyncio diff --git a/Src/API/cool.py b/Src/API/cool.py index 863a00b..e6e866c 100644 --- a/Src/API/cool.py +++ b/Src/API/cool.py @@ -29,12 +29,9 @@ async def get_links(slug,season,episode,ismovie,client): response = await client.get(f'https://altadefinizioneapp.com/api/post/urls/stream/{slug}',cookies=cookies,headers=headers) elif ismovie == 0: - print("HERE SEASON",season) - print("HERE EPISODE",episode) request_url =f'https://altadefinizioneapp.com/api/post/urls/stream/{slug}/{season}/{episode}' print(request_url) response = await client.get(request_url,cookies=cookies,headers=headers) - print(response.text) try: video_data = response.json() # Assuming this is the JSON response containing video streams if 'streams' not in video_data: @@ -92,7 +89,6 @@ async def search_imdb(showname,tmdba,client): tmdb_id = ''.join(char for char in tmdb_id if char.isdigit()) if tmdb_id == tmdba: slug = item.get('slug') - print(slug) return slug @@ -100,11 +96,9 @@ async def search_imdb(showname,tmdba,client): def parse_links(resolution_links): results = {} if resolution_links: - print("Video links:") for resolution, link in resolution_links.items(): if "cdn.altadefinizione-originale.com" in link or "cdn.altadefinizioneapp.com" in link: link = link.replace("cdn.altadefinizione-originale.com","protectlinknt.b-cdn.net").replace("cdn.altadefinizioneapp.com","protectlinknt.b-cdn.net") - print(f"{resolution}: {link}") results[resolution] = link return results else: @@ -114,7 +108,7 @@ def parse_links(resolution_links): async def cool(imdb,client): try: type = "Cool" - general = is_movie(imdb) + general = await is_movie(imdb) ismovie = general[0] imdb_id = general[1] if ismovie == 0 : diff --git a/Src/API/ddlstream.py b/Src/API/ddlstream.py index 0f61ae5..2c955d0 100644 --- a/Src/API/ddlstream.py +++ b/Src/API/ddlstream.py @@ -3,16 +3,23 @@ import re from bs4 import BeautifulSoup, SoupStrainer from Src.Utilities.info import get_info_imdb, is_movie, get_info_tmdb import urllib.parse +import Src.Utilities.config as config +import urllib.parse +DDL_DOMAIN = config.DDL_DOMAIN +ips4_device_key = config.ips4_device_key +ips4_login_key = config.ips4_login_key +ips4_member_id = config.ips4_member_id +ips4_IPSSessionFront = config.ips4_IPSSessionFront cookies = { - 'ips4_device_key': 'b6f084be79c28bb53ecfc556fd7a2a70', - 'ips4_IPSSessionFront': 'f2b9db91793e084cf2003a07c563e6aa', - 'ips4_member_id': '4029711', - 'ips4_login_key': '41b6a70b16cce2fd39482f5b21a9c35f', + 'ips4_device_key': ips4_device_key, + 'ips4_IPSSessionFront': ips4_IPSSessionFront, + 'ips4_member_id': ips4_member_id, + 'ips4_login_key': ips4_login_key, } async def search_series(client,id,season,episode,showname): showname = showname.replace(" ", "%20").replace("–", "+").replace("—","+") - response = await client.get(f"https://ddlstreamitaly.co/search/?&q={showname}%20{season}%20Streaming&type=videobox_video&quick=1&nodes=11&search_and_or=and&search_in=titles&sortby=relevancy") + response = await client.get(f"https://ddlstreamitaly.{DDL_DOMAIN}/search/?&q={showname}%20{season}%20Streaming&type=videobox_video&quick=1&nodes=11,36&search_and_or=and&search_in=titles&sortby=relevancy") soup = BeautifulSoup(response.text, 'lxml',parse_only=SoupStrainer('a')) a_tags = soup.find_all('a', {'data-linktype': 'link'}) for a in a_tags: @@ -58,10 +65,7 @@ async def get_episode(client,link,episode): } - - episode = "6" response = await client.get(link, cookies = cookies, headers = headers, params = params, impersonate="chrome120") - print(link) pattern = rf']*>\s*Part {episode}\s*' match = re.search(pattern, response.text) @@ -71,9 +75,9 @@ async def get_episode(client,link,episode): return mp4_link async def search_movie(client,showname,id): - showname = showname.replace(" ", "%20").replace("–", "+").replace("—","+") - showname = urllib.parse.quote_plus(showname) - link = f"https://ddlstreamitaly.co/search/?&q={showname}%20Streaming&quick=1&nodes=11&search_and_or=and&search_in=titles&sortby=relevancy" + showname = showname.replace("–", "+").replace("—","+") + showname = urllib.parse.quote(showname) + link = f"https://ddlstreamitaly.{DDL_DOMAIN}/search/?&q={showname}%20Streaming&quick=1&nodes=11&search_and_or=and&search_in=titles&sortby=relevancy" response = await client.get(link,impersonate = "chrome120") soup = BeautifulSoup(response.text, 'lxml',parse_only=SoupStrainer('a')) a_tags = soup.find_all('a', {'data-linktype': 'link'}) @@ -116,13 +120,12 @@ async def get_mp4(client,link): async def ddlstream(imdb,client): try: - general = is_movie(imdb) + general = await is_movie(imdb) ismovie = general[0] id = general[1] type = "DDLStream" if "tt" in imdb: showname = await get_info_imdb(id,ismovie,type,client) - print(showname) else: showname = get_info_tmdb(id,ismovie,type) if ismovie == 0: @@ -131,24 +134,22 @@ async def ddlstream(imdb,client): page_link = await search_series(client,id,season,episode,showname) mp4_link = await get_episode(client,page_link,episode) final_url = await get_mp4(client,mp4_link) - print(final_url) return final_url else: page_link = await search_movie(client,showname,id) mp4_link = page_link + "?area=online" final_url = await get_mp4(client,mp4_link) - print(final_url) return final_url except Exception as e: print(f"MammaMia: DDLStream Failed {e}") - return None,None + return None -''' + async def test_animeworld(): from curl_cffi.requests import AsyncSession async with AsyncSession() as client: - test_id = "tt6263850" # This is an example ID format + test_id = "tt14948432" # This is an example ID format results = await ddlstream(test_id, client) print(results) @@ -158,4 +159,3 @@ if __name__ == "__main__": #python3 -m Src.API.ddlstream -''' \ No newline at end of file diff --git a/Src/API/epg.py b/Src/API/epg.py index 858ac06..09ec14c 100644 --- a/Src/API/epg.py +++ b/Src/API/epg.py @@ -186,11 +186,11 @@ async def epg_guide(id,client): elif id in convert_bho_2: new_id = convert_bho_2[id] new_id = new_id.replace(" ","%20") - response = await client.get(f"https://mammamia-urlo-boh2.hf.space/{new_id}/now") + response = await client.get(f"https://aimammam-boh2.hf.space/{new_id}/now") elif id in convert_bho_3: new_id = convert_bho_3[id] new_id = new_id.replace(" ","%20") - response = await client.get(f"https://mammamia-urlo-boh3.hf.space/{new_id}/now") + response = await client.get(f"https://aimammam-boh3.hf.space/{new_id}/now") data = response.json() description = data['description'].replace("- EPG by epg-guide.com","").replace("No description","") title = data['title'] @@ -204,10 +204,10 @@ async def epg_guide(id,client): - -#async def test_animeworld(): +''' +async def test_animeworld(): async with httpx.AsyncClient() as client: - test_id = "rai-news" # Replace with actual ID + test_id = "rai-1" # Replace with actual ID try: results = await epg_guide(test_id, client) print(results) @@ -216,7 +216,8 @@ async def epg_guide(id,client): except Exception as e: print(f"An error occurred: {e}") -#if __name__ == "__main__": +if __name__ == "__main__": import httpx import asyncio asyncio.run(test_animeworld()) +''' \ No newline at end of file diff --git a/Src/API/filmpertutti.py b/Src/API/filmpertutti.py index e474ab3..9dd7475 100644 --- a/Src/API/filmpertutti.py +++ b/Src/API/filmpertutti.py @@ -4,13 +4,12 @@ from bs4 import BeautifulSoup,SoupStrainer import string import re import dateparser -from Src.Utilities.convert import get_TMDb_id_from_IMDb_id +from Src.Utilities.convert import get_TMDb_id_from_IMDb_id, get_IMDB_id_from_TMDb_id from Src.Utilities.info import get_info_tmdb, is_movie, get_info_imdb from Src.Utilities.convert_date import convert_US_date import Src.Utilities.config as config FT_DOMAIN = config.FT_DOMAIN import urllib.parse -WOA = 0 #Some basic headers headers = { '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', @@ -22,8 +21,19 @@ month_mapping = { 'May': 'Maggio', 'Jun': 'Giugno', 'Jul': 'Luglio', 'Aug': 'Agosto', 'Sep': 'Settembre', 'Oct': 'Ottobre', 'Nov': 'Novembre', 'Dec': 'Dicembre' } +async def get_streamtape(link,client): + headers = { + 'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36', + } + response = await client.get(link, headers=headers, impersonate = "chrome124") + regex = r"id=.*?(?=')" + matches = re.findall(regex, response.text) + i = 0 + final_url = next((f"https://streamtape.com/get_video?{matches[i + 1]}" for i in range(len(matches) - 1) if matches[i] == matches[i + 1]), None) + return final_url -async def search(query,date,client,season,ismovie): + +async def search(query,imdb_id,client,season,ismovie): response = await client.get(query) response = response.json() #Get link tid of every item and then open the link to see if the date = date @@ -32,36 +42,30 @@ async def search(query,date,client,season,ismovie): tid = json['id'] series_response = await client.get(link, headers=headers, allow_redirects=True, timeout = 30) series_soup = BeautifulSoup(series_response.text, 'lxml') - release_span = series_soup.find('span', class_='released') - if release_span: - if release_span.text != "Data di uscita: N/A": - date_string = release_span.text.split(': ')[-1] # Get the date part - release_date = date_string[-4:] - if WOA: - for eng, ita in month_mapping.items(): - date_string = re.sub(rf'\b{eng}\b', ita, date_string) - - # Swap to YY-MM-DD formatting using dateparser - release_date = dateparser.parse(date_string, languages=['it']).strftime("%Y-%m-%d") - if release_date == date: - url = link - tid = tid - if ismovie == 0: - Seasons = series_soup.find_all('span', class_="season-name") - i = 0 - for item in Seasons: - season_text = item.text.strip() - if season in season_text and "SUB" not in season_text: - actual_season = i - return url, tid, actual_season - else: - i = i + 1 - continue - else: - actual_season = None - return url, tid, actual_season + imdb_pattern = r"'imdb_id':\s*'([^']+)'" + imdb_match = re.search(imdb_pattern, series_response.text) + if imdb_match: + id = imdb_match.group(1) + if id == imdb_id: + url = link + tid = tid + if ismovie == 0: + Seasons = series_soup.find_all('span', class_="season-name") + i = 0 + for item in Seasons: + season_text = item.text.strip() + if season in season_text and "SUB" not in season_text: + actual_season = i + return url, tid, actual_season + else: + i = i + 1 + continue + else: + actual_season = None + return url, tid, actual_season + else: - print("") + print("There's no IMDB_ID") def get_episode_link(actual_season,episode,tid,url): #Get the link from where we have to obtain mixdrop link @@ -75,18 +79,25 @@ def get_film(url): return tlink async def get_real_link(tlink,client): - #Some basic code to get the mixdrop link - page = await client.get(tlink, headers=headers, allow_redirects=True) - soup = BeautifulSoup(page.content, features="lxml",parse_only=SoupStrainer('iframe')) - iframe_src = soup.find('iframe')['src'] - iframe_page = await client.get(iframe_src, headers=headers, allow_redirects=True, timeout = 30) - iframe_soup = BeautifulSoup(iframe_page.content, features="lxml") + try: + #Some basic code to get the mixdrop link + page = await client.get(tlink, headers=headers, allow_redirects=True) + soup = BeautifulSoup(page.content, features="lxml",parse_only=SoupStrainer('iframe')) + iframe_src = soup.find('iframe')['src'] + iframe_page = await client.get(iframe_src, headers=headers, allow_redirects=True, timeout = 30) + iframe_soup = BeautifulSoup(iframe_page.content, features="lxml", parse_only=SoupStrainer('div',class_="megaButton")) - mega_button = iframe_soup.find('div', attrs={'class': 'megaButton', 'rel': 'nofollow'}, string='MIXDROP') - if mega_button: - real_link = mega_button.get('meta-link') - return real_link - + mega_button = iframe_soup.find('div', attrs={'class': 'megaButton', 'rel': 'nofollow'}, string='MIXDROP') + if mega_button: + real_link = mega_button.get('meta-link') + return real_link + else: + mega_button = iframe_soup.find('div', attrs={'class': 'megaButton', 'rel': 'nofollow'}, string='STREAMTAPE') + real_link = mega_button.get('meta-link') + return real_link + except Exception as e: + print(f"Error: {e}") + return None async def get_true_link(real_link,client): response = await client.get(real_link, headers=headers, allow_redirects=True,timeout = 30) [s1, s2] = re.search(r"\}\('(.+)',.+,'(.+)'\.split", response.text).group(1, 2) @@ -101,70 +112,85 @@ async def get_true_link(real_link,client): s += d[c] if c in d else c return s -async def filmpertutti(imdb,client): - general = is_movie(imdb) - ismovie = general[0] - imdb_id = general[1] - type = "Filmpertutti" - if ismovie == 0 : - season = general[2] - episode = int(general[3]) - if "tt" in imdb: - if ismovie == 0: - #Get showname and date - showname,date = await get_info_imdb(imdb_id,ismovie,type,client) - else: - #THIS IS needed cause the only way to get all releases dates is by giving a tmdb ID not a IMDB - showname,date = await get_info_imdb(imdb_id,ismovie,type, client) - season = None - - elif "tmdb" in imdb: - #Get showname and date - tmdba = imdb_id.replace("tmdb:","") - showname,date = get_info_tmdb(tmdba,ismovie,type) - showname = showname.replace(" ", "+").replace("–", "+").replace("—","+") - showname = urllib.parse.quote_plus(showname) - #Build the query - query = f'https://filmpertutti.{FT_DOMAIN}/wp-json/wp/v2/posts?search={showname}&page=1&_fields=link,id' +async def filmpertutti(imdb,client,MFP): try: - url,tid,actual_season = await search(query,date,client,season,ismovie) - except: - print("MammaMia: No results found for Filmpertutti") - return None - if ismovie == 0: - episode_link = get_episode_link(actual_season,episode,tid,url) - #Let's get mixdrop link - real_link = await get_real_link(episode_link,client) - #let's get delivery link, streaming link - streaming_link = await get_true_link(real_link,client) - print(streaming_link) - return streaming_link - elif ismovie == 1: - film_link = get_film(url) - #Let's get mixdrop link - real_link = await get_real_link(film_link,client) - #let's get delivery link, streaming link - streaming_link = await get_true_link(real_link,client) - return streaming_link - + general = await is_movie(imdb) + ismovie = general[0] + imdb_id = general[1] + type = "Filmpertutti" + if ismovie == 0 : + season = general[2] + episode = int(general[3]) + else: + season = None + episode = None + if "tt" in imdb: + showname = await get_info_imdb(imdb_id,ismovie,type,client) + elif "tmdb" in imdb: + #Get showname and date + tmdba = imdb_id.replace("tmdb:","") + imdb_id = await get_IMDB_id_from_TMDb_id(tmdba,client) + showname = get_info_tmdb(tmdba,ismovie,type) + showname = showname.replace(" ", "+").replace("–", "+").replace("—","+") + showname = urllib.parse.quote_plus(showname) + # Build the query + query = f'https://filmpertutti.{FT_DOMAIN}/wp-json/wp/v2/posts?search={showname}&page=1&_fields=link,id' + try: + url,tid,actual_season = await search(query,imdb_id,client,season,ismovie) + except: + print("MammaMia: No results found for Filmpertutti") + return None,None + if ismovie == 0: + episode_link = get_episode_link(actual_season,episode,tid,url) + #Let's get mixdrop link + real_link = await get_real_link(episode_link,client) + if MFP == "1": + if "mixdrop" in real_link: + Host = "Mixdrop" + elif "streamtape" in real_link: + Host = "Streamtape" + return real_link, Host + #let's get delivery link, streaming link + if "mixdrop" in real_link: + streaming_link = await get_true_link(real_link,client) + elif "streamtape" in real_link: + streaming_link = await get_streamtape(real_link,client) + Host = None + return streaming_link, Host + elif ismovie == 1: + film_link = get_film(url) + #Let's get mixdrop link + real_link = await get_real_link(film_link,client) + if MFP == "1": + if "mixdrop" in real_link: + Host = "Mixdrop" + elif "streamtape" in real_link: + Host = "Streamtape" + return real_link, Host + if "mixdrop" in real_link: + streaming_link = await get_true_link(real_link,client) + elif "streamtape" in real_link: + streaming_link = await get_streamtape(real_link,client) + #let's get delivery link, streaming link + Host = None + return streaming_link, Host + except Exception as e: + print(f"Filmpertutti failed: {e}") + return None,None -''' async def test_animeworld(): from curl_cffi.requests import AsyncSession async with AsyncSession() as client: + MFP = "1" # Replace with actual id, for example 'anime_id:episode' format - test_id = "tt4655480:1:1" # This is an example ID format - results = await filmpertutti(test_id, client) + test_id = "tt0413573:19:1" # This is an example ID format + results = await filmpertutti(test_id, client,MFP) if __name__ == "__main__": import asyncio asyncio.run(test_animeworld()) -''' - - - diff --git a/Src/API/guardahd.py b/Src/API/guardahd.py new file mode 100644 index 0000000..75d569c --- /dev/null +++ b/Src/API/guardahd.py @@ -0,0 +1,102 @@ +from Src.Utilities.info import is_movie +from bs4 import BeautifulSoup,SoupStrainer +import re +import Src.Utilities.config as config +from fake_headers import Headers +from Src.Utilities.loadenv import load_env +import json, random +env_vars = load_env() +GH_PROXY = config.GH_PROXY +proxies = {} +if GH_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 + } +GH_ForwardProxy = config.GH_ForwardProxy +if GH_ForwardProxy == "1": + ForwardProxy = env_vars.get('ForwardProxy') +else: + ForwardProxy = "" +#Get domain + +GHD_DOMAIN = config.GHD_DOMAIN + +random_headers = Headers() + + +async def get_supervideo_link(link,client): + headers = random_headers.generate() + response = await client.get(ForwardProxy + link, headers=headers, allow_redirects=True,timeout = 30) + s2 = re.search(r"\}\('(.+)',.+,'(.+)'\.split", response.text).group(2) + terms = s2.split("|") + file_index = terms.index('file') + #I start to loop from file cause hfs it's one or two position after it usually. + + for i in range(file_index,len(terms)): + if "hfs" in terms[i]: + hfs = terms[i] + break + urlset_index = terms.index('urlset') + hls_index = terms.index('hls') + result = terms[urlset_index + 1 : hls_index] + #If the len is >1 then you have to merge the elements from the last to the first + reversed_elements = result[::-1] + base_url =f"https://{hfs}.serversicuro.cc/hls/" + if len(reversed_elements) == 1: + final_url = base_url + "," + reversed_elements[0] + ".urlset/master.m3u8" + lenght = len(reversed_elements) + i = 1 + for element in reversed_elements: + base_url += element + "," + if lenght == i: + base_url += ".urlset/master.m3u8" + else: + i += 1 + final_url = base_url + return final_url + +async def search(clean_id,client): + headers = random_headers.generate() + response = await client.get(ForwardProxy + f"https://mostraguarda.{GHD_DOMAIN}/set-movie-a/{clean_id}", allow_redirects=True, impersonate = "chrome124", headers = headers, proxies = proxies) + if response.status_code != 200: + print(f"GuardaHD Failed to fetch search results: {response.status_code}") + soup = BeautifulSoup(response.text,'lxml',parse_only=SoupStrainer('li')) + li_tag = soup.find('li', class_='') + href = "https:" + li_tag['data-link'] + return href + + + +async def guardahd(id,client): + try: + general = await is_movie(id) + ismovie = general[0] + clean_id = general[1] + if ismovie == 0: + return None + supervideo_link = await search(clean_id,client) + final_url = await get_supervideo_link(supervideo_link,client) + return final_url + except Exception as e: + print("MammaMia: Guardaserie Failed",e) + return None + +async def test_script(): + from curl_cffi.requests import AsyncSession + async with AsyncSession() as client: + # Replace with actual id, for example 'anime_id:episode' format + test_id = "tt0816692" # This is an example ID format + results = await guardahd(test_id, client) + print(results) + +if __name__ == "__main__": + import asyncio + asyncio.run(test_script()) + \ No newline at end of file diff --git a/Src/API/guardaserie.py b/Src/API/guardaserie.py new file mode 100644 index 0000000..cf22cb7 --- /dev/null +++ b/Src/API/guardaserie.py @@ -0,0 +1,129 @@ +from Src.Utilities.info import is_movie +from bs4 import BeautifulSoup,SoupStrainer +import re +import Src.Utilities.config as config +from fake_headers import Headers +from Src.Utilities.loadenv import load_env +import json, random +env_vars = load_env() +GS_PROXY = config.GS_PROXY +proxies = {} +if GS_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 + } +GS_ForwardProxy = config.GS_ForwardProxy +if GS_ForwardProxy == "1": + ForwardProxy = env_vars.get('ForwardProxy') +else: + ForwardProxy = "" +#Get domain +GS_DOMAIN = config.GS_DOMAIN +random_headers = Headers() + +async def get_supervideo_link(link,client): + headers = random_headers.generate() + response = await client.get(ForwardProxy + link, headers=headers, allow_redirects=True,timeout = 30) + s2 = re.search(r"\}\('(.+)',.+,'(.+)'\.split", response.text).group(2) + terms = s2.split("|") + file_index = terms.index('file') + #I start to loop from file cause hfs it's one or two position after it usually. + + for i in range(file_index,len(terms)): + if "hfs" in terms[i]: + hfs = terms[i] + break + urlset_index = terms.index('urlset') + hls_index = terms.index('hls') + result = terms[urlset_index + 1 : hls_index] + #If the len is >1 then you have to merge the elements from the last to the first + reversed_elements = result[::-1] + base_url =f"https://{hfs}.serversicuro.cc/hls/" + if len(reversed_elements) == 1: + final_url = base_url + "," + reversed_elements[0] + ".urlset/master.m3u8" + lenght = len(reversed_elements) + i = 1 + for element in reversed_elements: + base_url += element + "," + if lenght == i: + base_url += ".urlset/master.m3u8" + else: + i += 1 + final_url = base_url + return final_url + + + + + + + +async def search(clean_id,client): + try: + headers = random_headers.generate() + response = await client.get(ForwardProxy + f'https://guardaserie.{GS_DOMAIN}/?story={clean_id}&do=search&subaction=search', allow_redirects=True, impersonate = "chrome124", headers = headers, proxies = proxies) + if response.status_code != 200: + print(f"Guardaserie Failed to fetch search results: {response.status_code}") + soup = BeautifulSoup(response.text,'lxml',parse_only=SoupStrainer('div',class_="mlnh-2")) + div_mlnh2 = soup.select_one('div.mlnh-2:nth-of-type(2)') + a_tag = div_mlnh2.find('h2').find('a') + href = a_tag['href'] + return href + + except Exception as e: + return None + + + +async def player_url(page_url, season, episode,client): + try: + headers = random_headers.generate() + response = await client.get(ForwardProxy + page_url, allow_redirects=True, impersonate = "chrome124", headers = headers, proxies = proxies) + soup = BeautifulSoup(response.text,'lxml',parse_only=SoupStrainer('a')) + a_tag = soup.find('a', id = f"serie-{season}_{episode}") + href = a_tag['data-link'] + return href + except Exception as e: + return None + + + + + +async def guardaserie(id,client): + try: + general = await is_movie(id) + ismovie = general[0] + clean_id = general[1] + season = general[2] + episode = general[3] + if ismovie == 1: + return None + page_url = await search(clean_id,client) + supervideo_link =await player_url(page_url,season,episode,client) + final_url = await get_supervideo_link(supervideo_link,client) + return final_url + except Exception as e: + print("MammaMia: Guardaserie Failed",e) + return None + + + +async def test_script(): + from curl_cffi.requests import AsyncSession + async with AsyncSession() as client: + # Replace with actual id, for example 'anime_id:episode' format + test_id = "tt16288804:1:1" # This is an example ID format + results = await guardaserie(test_id, client) + print(results) + +if __name__ == "__main__": + import asyncio + asyncio.run(test_script()) \ No newline at end of file diff --git a/Src/API/lordchannel.py b/Src/API/lordchannel.py index 37a569e..28c48f6 100644 --- a/Src/API/lordchannel.py +++ b/Src/API/lordchannel.py @@ -62,16 +62,15 @@ async def search(showname,date,season,episode,ismovie,client): async def get_m3u8(video_url,client): response = await client.get(video_url, allow_redirects=True, impersonate = "chrome120") - pattern = r'const\s+videoData\s*=\s*\[(.*?)\];' + pattern = r'https?://[^\s]+\.m3u8' match = re.search(pattern, response.text) if match: - video_data = match.group(1).strip().split(', ') - url = video_data[0] + url = match.group(0) return url async def lordchannel(imdb,client): try: - general = is_movie(imdb) + general = await is_movie(imdb) ismovie = general[0] imdb_id = general[1] type = "LordChannel" @@ -99,7 +98,6 @@ async def lordchannel(imdb,client): print("MammaMia: Lordchannel Failed",e) return None,None - ''' async def test_animeworld(): from curl_cffi.requests import AsyncSession @@ -110,4 +108,5 @@ async def test_animeworld(): if __name__ == "__main__": import asyncio asyncio.run(test_animeworld()) + #python3 -m Src.API.lordchannel ''' \ No newline at end of file diff --git a/Src/API/streamingcommunity.py b/Src/API/streamingcommunity.py index 6a66168..86bb9d5 100644 --- a/Src/API/streamingcommunity.py +++ b/Src/API/streamingcommunity.py @@ -9,8 +9,27 @@ from urllib.parse import urlparse, parse_qs from fake_headers import Headers from Src.Utilities.loadenv import load_env import urllib.parse +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" env_vars = load_env() +SC_PROXY = config.SC_PROXY +proxies = {} +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 + } +SC_ForwardProxy = config.SC_ForwardProxy +if SC_ForwardProxy == "1": + ForwardProxy = env_vars.get('ForwardProxy') +else: + ForwardProxy = "" #Get domain SC_DOMAIN = config.SC_DOMAIN Public_Instance = config.Public_Instance @@ -27,7 +46,7 @@ async def get_version(client): random_headers['Referer'] = f"https://streamingcommunity.{SC_DOMAIN}/" random_headers['Origin'] = f"https://streamingcommunity.{SC_DOMAIN}" base_url = f'https://streamingcommunity.{SC_DOMAIN}/richiedi-un-titolo' - response = await client.get(base_url, headers=random_headers, allow_redirects = True, impersonate="chrome120") + response = await client.get(ForwardProxy + base_url, headers=random_headers, allow_redirects = True, impersonate="chrome124", proxies = proxies) #Soup the response soup = BeautifulSoup(response.text, "lxml") @@ -46,7 +65,7 @@ async def search(query,date,ismovie, client,SC_FAST_SEARCH,movie_id): random_headers['Accept'] = 'application/json' # Assuming the API returns JSON random_headers['Content-Type'] = 'application/json' #Do a request to get the ID of serie/move and it's slug in the URL - response = await client.get(query, headers = random_headers, allow_redirects=True) + response = await client.get(ForwardProxy + query, headers = random_headers, allow_redirects=True, impersonate = "chrome124", proxies = proxies) print(response) response = response.json() @@ -64,7 +83,7 @@ async def search(query,date,ismovie, client,SC_FAST_SEARCH,movie_id): random_headers = headers.generate() random_headers['Referer'] = "https://streamingcommunity.buzz/" random_headers['Origin'] = "https://streamingcommunity.buzz" - response = await client.get ( f'https://streamingcommunity.{SC_DOMAIN}/titles/{tid}-{slug}', headers = random_headers, allow_redirects=True,impersonate = "chrome120") + response = await client.get ( ForwardProxy + f'https://streamingcommunity.{SC_DOMAIN}/titles/{tid}-{slug}', headers = random_headers, allow_redirects=True,impersonate = "chrome124", proxies = proxies) soup = BeautifulSoup(response.text, "lxml") data = json.loads(soup.find("div", {"id": "app"}).get("data-page")) version = data['version'] @@ -87,9 +106,11 @@ async def get_film(tid,version,client): random_headers['Origin'] = "https://streamingcommunity.buzz" random_headers['x-inertia'] = "true" random_headers['x-inertia-version'] = version + random_headers['User-Agent'] = User_Agent + random_headers['user-agent'] = User_Agent #Access the iframe url = f'https://streamingcommunity.{SC_DOMAIN}/iframe/{tid}' - response = await client.get(url, headers=random_headers, allow_redirects=True,impersonate = "chrome120") + response = await client.get(ForwardProxy + url, headers=random_headers, allow_redirects=True,impersonate = "chrome124", proxies = proxies) iframe = BeautifulSoup(response.text, 'lxml') #Get the link of iframe iframe = iframe.find('iframe').get("src") @@ -98,25 +119,33 @@ async def get_film(tid,version,client): parsed_url = urlparse(iframe) query_params = parse_qs(parsed_url.query) random_headers = headers.generate() - random_headers['Referer'] = "https://streamingcommunity.buzz/" - random_headers['Origin'] = "https://streamingcommunity.buzz" + random_headers['Referer'] = f"https://streamingcommunity.{SC_DOMAIN}/" + random_headers['Origin'] = f"https://streamingcommunity.{SC_DOMAIN}" random_headers['x-inertia'] = "true" random_headers['x-inertia-version'] = version + random_headers['User-Agent'] = User_Agent + random_headers['user-agent'] = User_Agent #Get real token and expires by looking at the page in the iframe, vixcloud/embed - resp = await client.get(iframe, headers = random_headers, allow_redirects=True,impersonate= "chrome120") + resp = await client.get(ForwardProxy + iframe, headers = random_headers, allow_redirects=True,impersonate= "chrome124", proxies = proxies) soup= BeautifulSoup(resp.text, "lxml") script = soup.find("body").find("script").text token = re.search(r"'token':\s*'(\w+)'", script).group(1) expires = re.search(r"'expires':\s*'(\d+)'", script).group(1) quality = re.search(r'"quality":(\d+)', script).group(1) + base_url = re.search(r"url:\s*'(https?://[^']+)'", script).group(1) #Example url https://vixcloud.co/playlist/231315?b=1&token=bce060eec3dc9d1965a5d258dc78c964&expires=1728995040&rendition=1080p - url = f'https://vixcloud.co/playlist/{vixid}.m3u8?expires={expires}' + url = f'https://vixcloud.co/playlist/{vixid}.m3u8?token={token}&expires={expires}' if 'canPlayFHD' in query_params: canPlayFHD = 'h=1' url += "&h=1" + if 'b=1' in base_url: + url += "&b=1" + ''' if 'b' in query_params: b = 'b=1' url += "&b=1" + ''' + ''' if quality == "1080": if "&h" in url: url = url @@ -125,7 +154,8 @@ async def get_film(tid,version,client): elif quality == "1080" and "&b" and "&h" not in url: url = url + "&h=1" else: - url = url + f"&token={token}" + url = url + f"&token={token}" + ''' url720 = f'https://vixcloud.co/playlist/{vixid}.m3u8' return url,url720,quality @@ -135,9 +165,10 @@ async def get_season_episode_id(tid,slug,season,episode,version,client): random_headers['Origin'] = "https://streamingcommunity.buzz" random_headers['x-inertia'] = "true" random_headers['x-inertia-version'] = version + #Set some basic headers for the request #Get episode ID - response = await client.get(f'https://streamingcommunity.{SC_DOMAIN}/titles/{tid}-{slug}/stagione-{season}', headers=random_headers, allow_redirects=True, impersonate = "chrome120") + response = await client.get(ForwardProxy + f'https://streamingcommunity.{SC_DOMAIN}/titles/{tid}-{slug}/stagione-{season}', headers=random_headers, allow_redirects=True, impersonate = "chrome124", proxies = proxies) # Print the json got json_response = response.json().get('props', {}).get('loadedSeason', {}).get('episodes', []) for dict_episode in json_response: @@ -147,42 +178,49 @@ async def get_season_episode_id(tid,slug,season,episode,version,client): async def get_episode_link(episode_id,tid,version,client): #The parameters for the request random_headers = headers.generate() - random_headers['Referer'] = "https://streamingcommunity.buzz/" - random_headers['Origin'] = "https://streamingcommunity.buzz" + random_headers['Referer'] = f"https://streamingcommunity.{SC_DOMAIN}/" + random_headers['Origin'] = f"https://streamingcommunity.{SC_DOMAIN}" + random_headers['User-Agent'] = User_Agent + random_headers['user-agent'] = User_Agent params = { 'episode_id': episode_id, 'next_episode': '1' } #Let's try to get the link from iframe source # Make a request to get iframe source - response = await client.get(f"https://streamingcommunity.{SC_DOMAIN}/iframe/{tid}", params=params, headers = random_headers, allow_redirects=True, impersonate = "chrome120") + response = await client.get(ForwardProxy + f"https://streamingcommunity.{SC_DOMAIN}/iframe/{tid}", params=params, headers = random_headers, allow_redirects=True, impersonate = "chrome124", proxies = proxies) # Parse response with BeautifulSoup to get iframe source soup = BeautifulSoup(response.text, "lxml") iframe = soup.find("iframe").get("src") vixid = iframe.split("/embed/")[1].split("?")[0] random_headers = headers.generate() - random_headers['Referer'] = "https://streamingcommunity.buzz/" - random_headers['Origin'] = "https://streamingcommunity.buzz" + random_headers['Referer'] = f"https://streamingcommunity.{SC_DOMAIN}/" + random_headers['Origin'] = f"https://streamingcommunity.{SC_DOMAIN}" random_headers['x-inertia'] = "true" random_headers['x-inertia-version'] = version + random_headers['User-Agent'] = User_Agent + random_headers['user-agent'] = User_Agent parsed_url = urlparse(iframe) query_params = parse_qs(parsed_url.query) #Get real token and expires by looking at the page in the iframe, vixcloud/embed - resp = await client.get(iframe, headers = random_headers, allow_redirects=True, impersonate = "chrome120") + resp = await client.get(ForwardProxy + iframe, headers = random_headers, allow_redirects=True, impersonate = "chrome124", proxies = proxies) soup= BeautifulSoup(resp.text, "lxml") script = soup.find("body").find("script").text token = re.search(r"'token':\s*'(\w+)'", script).group(1) expires = re.search(r"'expires':\s*'(\d+)'", script).group(1) quality = re.search(r'"quality":(\d+)', script).group(1) + base_url = re.search(r"url:\s*'(https?://[^']+)'", script).group(1) + #Example url https://vixcloud.co/playlist/231315?b=1&token=bce060eec3dc9d1965a5d258dc78c964&expires=1728995040&rendition=1080p - url = f'https://vixcloud.co/playlist/{vixid}.m3u8?expires={expires}' + url = f'https://vixcloud.co/playlist/{vixid}.m3u8?token={token}&expires={expires}' if 'canPlayFHD' in query_params: canPlayFHD = 'h=1' url += "&h=1" - if 'b' in query_params: + if 'b=1' in base_url: b = 'b=1' url += "&b=1" + ''' if quality == "1080": if "&h" in url: url = url @@ -191,13 +229,15 @@ async def get_episode_link(episode_id,tid,version,client): elif quality == "1080" and "&b" and "&h" not in url: url = url + "&h=1" else: - url = url + f"&token={token}" + url = url + f"&token={token}" + ''' url720 = f'https://vixcloud.co/playlist/{vixid}.m3u8' return url,url720,quality async def streaming_community(imdb,client,SC_FAST_SEARCH): try: + ''' if Public_Instance == "1": Weird_Link = json.loads(Alternative_Link) link_post = random.choice(Weird_Link) @@ -207,7 +247,8 @@ async def streaming_community(imdb,client,SC_FAST_SEARCH): quality_sc = response.headers.get('x-quality-sc') print(quality_sc,url_streaming_community) return url_streaming_community,url_720_streaming_community,quality_sc - general = is_movie(imdb) + ''' + general = await is_movie(imdb) ismovie = general[0] imdb_id = general[1] @@ -271,16 +312,15 @@ async def streaming_community(imdb,client,SC_FAST_SEARCH): except Exception as e: print("MammaMia: StreamingCommunity failed",e) return None,None,None,None -''' + async def test_animeworld(): from curl_cffi.requests import AsyncSession async with AsyncSession() as client: # Replace with actual id, for example 'anime_id:episode' format - test_id = "tt0095765" # This is an example ID format + test_id = "tt6468322:1:1" # This is an example ID format results = await streaming_community(test_id, client,"0") print(results) if __name__ == "__main__": import asyncio - asyncio.run(test_animeworld()) -''' \ No newline at end of file + asyncio.run(test_animeworld()) \ No newline at end of file diff --git a/Src/API/streamingwatch.py b/Src/API/streamingwatch.py index ed141bc..3f2424a 100644 --- a/Src/API/streamingwatch.py +++ b/Src/API/streamingwatch.py @@ -4,7 +4,6 @@ from Src.Utilities.info import get_info_tmdb, is_movie, get_info_imdb import Src.Utilities.config as config import re import json -import urllib.parse SW_DOMAIN = config.SW_DOMAIN async def wponce_get(client): response = await client.get(f"https://www.streamingwatch.{SW_DOMAIN}/contatto/") @@ -44,15 +43,19 @@ async def search(showname,season,episode,date,ismovie,client): } response = await client.post(query,cookies=cookies, headers=headers, data=data) soup = BeautifulSoup(response.content,'lxml') - page_date = soup.find(id = 'search-cat-year').text.strip() - if page_date == date: - href = soup.find('a')['href'] - response = await client.get(href, allow_redirects=True, impersonate = "chrome120") - soup = BeautifulSoup(response.text,'lxml',parse_only=SoupStrainer('iframe')) - iframe = soup.find('iframe') - hdplayer = iframe.get('data-lazy-src') + all_page_dates = soup.find_all(id = 'search-cat-year') + all_hrefs = soup.find_all('a') + for temp_data,temp_href in zip(all_page_dates,all_hrefs): + page_date = temp_data.text.strip() + if date == page_date: + href = temp_href['href'] + href = soup.find('a')['href'] + response = await client.get(href, allow_redirects=True, impersonate = "chrome120") + soup = BeautifulSoup(response.text,'lxml',parse_only=SoupStrainer('iframe')) + iframe = soup.find('iframe') + hdplayer = iframe.get('data-lazy-src') - return hdplayer + return hdplayer elif ismovie == 0: #Some series have the name in english so we first search with the categories option and then we use the obtained ID to get all the episodes id_response = await client.get(f'https://streamingwatch.{SW_DOMAIN}/wp-json/wp/v2/categories?search={showname}&_fields=id', allow_redirects=True, impersonate = "chrome120") @@ -75,10 +78,11 @@ async def hls_url(hdplayer,client): response = await client.get(hdplayer, allow_redirects=True, impersonate = "chrome120") match = re.search(r'sources:\s*\[\s*\{\s*file\s*:\s*"([^"]*)"', response.text) url = match.group(1) + return url async def streamingwatch(imdb,client): try: - general = is_movie(imdb) + general = await is_movie(imdb) ismovie = general[0] imdb_id = general[1] type = "StreamingWatch" @@ -97,24 +101,25 @@ async def streamingwatch(imdb,client): else: tmdba = imdb_id showname,date = get_info_tmdb(tmdba,ismovie,type) - showname = showname.replace(" ", "+").replace("–", "+").replace("—","+") + showname = showname.replace(" ", "+").replace("–", "+").replace("—","+").replace("&","") hdplayer = await search(showname,season,episode,date,ismovie,client) url = await hls_url(hdplayer,client) - print(f"MammaMia: StreamingWatch found results for {showname}") - return url + if url: + #Fix for Exoplayer which needs .m3u8 in the url to play the file + url = url + ".m3u8" + return url,hdplayer except Exception as e: print("MammaMia: StreamingWatch Failed",e) - return None + return None,None -''' + async def test_animeworld(): from curl_cffi.requests import AsyncSession async with AsyncSession() as client: # Replace with actual id, for example 'anime_id:episode' format - test_id = "tt16426418" # This is an example ID format + test_id = "tt1431045" # This is an example ID format results = await streamingwatch(test_id, client) if __name__ == "__main__": import asyncio asyncio.run(test_animeworld()) -''' \ No newline at end of file diff --git a/Src/API/tantifilm.py b/Src/API/tantifilm.py index 10ed2e8..9410394 100644 --- a/Src/API/tantifilm.py +++ b/Src/API/tantifilm.py @@ -4,23 +4,26 @@ import time from Src.Utilities.info import is_movie,get_info_imdb,get_info_tmdb import Src.Utilities.config as config from Src.Utilities.loadenv import load_env -HF = config.HF env_vars = load_env() -PROXY_CREDENTIALS = env_vars.get('PROXY_CREDENTIALS') -ForwardProxy_list = config.ForwardProxy -ForwardProxy = ForwardProxy_list[0] +TF_PROXY = config.TF_PROXY +if TF_PROXY == "1": + PROXY_CREDENTIALS = env_vars.get('PROXY_CREDENTIALS') +TF_FORWARDPROXY = config.TF_ForwardProxy +if TF_FORWARDPROXY == "1": + ForwardProxy = env_vars.get('ForwardProxy') +else: + ForwardProxy = "" TF_DOMAIN = config.TF_DOMAIN import urllib.parse async def search(showname,ismovie,date,client): - showname = showname.replace(" ","%20") - showname = urllib.parse.quote_plus(showname) + showname = showname.replace(" ","+") url = f'https://www.tanti.bond/ajax/posts?q={showname}' - response = await client.post(url, allow_redirects=True, impersonate = "chrome120") + response = await client.get(url, allow_redirects=True) response = response.json()['data'] if ismovie == 1: for link in response: url = link['url'] - response = client.get(url, allow_redirects=True, impersonate = "chrome120") + response = await client.get(url, allow_redirects=True, impersonate = "chrome120") pattern = r'Data di rilascio\s*\s*
Configure your providers: Note that if you enable Fast Search results will be less accurate but faster.
Filmpertutti and Tantifilm won't work if you are not using a local (on your PC) instance.
Configure your providers: Note that if you enable Fast Search results will be less accurate but faster