diff --git a/README.md b/README.md index 10a666d..0a2839f 100644 --- a/README.md +++ b/README.md @@ -1,62 +1,111 @@ + # MammaMia + + A Stremio Addon for high quality HTTPS Stream in Italian -While hosting, this project, remember that Filmpertutti uses Mixdrop. Mixdrop only allows seeing the videos only from the same IP where they were generated so, if you want to scrape filmpertutti, you have to host this project locally. Else, you can only scrape streamingcommunity. -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. + + +While hosting, this project, remember that Filmpertutti uses Mixdrop. Mixdrop only allows seeing the videos only from the same IP where they were generated so, if you want to scrape filmpertutti, you have to host this project locally. Else, you can only scrape streamingcommunity. + +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. + # Installation + ## Local + Install required packages + + `` + pip install -r requirements.txt + `` + + Then to start the Flask server just execute: + `` + python3 run.py + `` + ## Hugging Face -To host this project with Hugging Face, go to the [linked](https://huggingface.co/spaces/MammaMia-Urlo/MammaMia/) page and follow these steps - 1. Create an Hugging Face Account - 2. Click on three dots on the top (right) part of the screen - 3. Click Duplicate this Space - 4. Insert TMDB Key - 5. Clone the Project - 6. You are done! - 7. To install it on Stremio altought, you will need the Direct URL. It can be found on three dots --> Embed This Space --> Direct URL - 8. Do not forget to add /manifest.json - On Hugging Face you are forced to use the 8080 port because it is the only one allowed to send/get network requests. +To host this project with Hugging Face, go to the [linked](https://huggingface.co/spaces/MammaMia-Urlo/MammaMia/) page and follow these steps + + + +1. Create an Hugging Face Account + +2. Click on three dots on the top (right) part of the screen + +3. Click Duplicate this Space + +4. Insert TMDB Key + +5. Clone the Project + +6. You are done! + +7. To install it on Stremio altought, you will need the Direct URL. It can be found on three dots --> Embed This Space --> Direct URL + +8. Do not forget to add /manifest.json + +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 needs to be disabled (it should be by default if you clone the project from HF) + ## Render -To install this project on [Render](https://render.com/) follow these steps: - 1. Create an Account - 2. Create a Web Service - 3. Clone the repo - 4. Among the other environment variables, put PORT = 8080. This is needed because render needs the Port given as an environment variable. - 5. As build command put `` pip install -r requirements `` and as run command put ``python3 run.py `` - 6. Then just finish Render Setup and you are done :) - - +To install this project on [Render](https://render.com/) follow these steps: + +1. Create an Account + +2. Create a Web Service + +3. Clone the repo + +4. Among the other environment variables, put PORT = 8080. This is needed because render needs the Port given as an environment variable. + +5. As build command put `` pip install -r requirements `` and as run command put ``python3 run.py `` + +6. Then just finish Render Setup and you are done :) +Remember, load_env needs to be disabled in the config.json + + + + # How to add to Stremio + Just paste the URL/manifest.json in your search bar. + # Enviroment Variables + + | Enviroment Variable | Value | |-------------------------|---| |TMDB_KEY|INSERT YOUR API KEY HERE| -| FT_DOMAIN | INSERT FILMPERTUTTI DOMAIN | -|SC_DOMAIN | INSERT STREAMINGCOMMUNITY DOMAIN| -|FILMPERTUTTI|Put "1" if you want Filmpertutti to be enabled, "0" if disabled Altought keep in mind that you will only be able to use it if you get the link from the same IP of your streaming server.| -|STREAMINGCOMMUNITY|Put "1" if enabled, "0" if disabled| - - Here is [linked](https://developer.themoviedb.org/docs/getting-started) a tutorial about how to get a TMDB KEY +# Config +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: +| Enviroment Variable | 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 TuttiFilm Provider but in case there are two movies/series with the exactly same name then it might take the wrong one| +|load_env|Put "1" if enabled, "0" if disabled. It needs to be enable if you need to load a .env file. On remote hosting services, like Hugging Face or Render, it needs to be disabled. | + + + diff --git a/__pycache__/config.cpython-311.pyc b/__pycache__/config.cpython-311.pyc new file mode 100644 index 0000000..1ba4652 Binary files /dev/null and b/__pycache__/config.cpython-311.pyc differ diff --git a/__pycache__/convert.cpython-311.pyc b/__pycache__/convert.cpython-311.pyc index 3531123..cc4cfff 100644 Binary files a/__pycache__/convert.cpython-311.pyc and b/__pycache__/convert.cpython-311.pyc differ diff --git a/__pycache__/filmpertutti.cpython-311.pyc b/__pycache__/filmpertutti.cpython-311.pyc index 254eebc..7fd3c9b 100644 Binary files a/__pycache__/filmpertutti.cpython-311.pyc and b/__pycache__/filmpertutti.cpython-311.pyc differ diff --git a/__pycache__/info.cpython-311.pyc b/__pycache__/info.cpython-311.pyc index da7c0a5..044c2a6 100644 Binary files a/__pycache__/info.cpython-311.pyc and b/__pycache__/info.cpython-311.pyc differ diff --git a/__pycache__/loadenv.cpython-311.pyc b/__pycache__/loadenv.cpython-311.pyc index deb16fe..a75f4fb 100644 Binary files a/__pycache__/loadenv.cpython-311.pyc and b/__pycache__/loadenv.cpython-311.pyc differ diff --git a/__pycache__/streamingcommunity.cpython-311.pyc b/__pycache__/streamingcommunity.cpython-311.pyc index 7567d43..9e7b94a 100644 Binary files a/__pycache__/streamingcommunity.cpython-311.pyc and b/__pycache__/streamingcommunity.cpython-311.pyc differ diff --git a/config.json b/config.json new file mode 100644 index 0000000..7fb570e --- /dev/null +++ b/config.json @@ -0,0 +1,21 @@ +{ + "Siti": { + "StreamingCommunity": { + "enabled": "1", + "domain": "boston" + }, + "Filmpertutti": { + "enabled": "1", + "domain": "casino" + }, + "Tuttifilm":{ + "enabled": "1", + "domain": "bond", + "fast_search": "0" + } + }, + "General":{ + "load_env": "1" + } + } + \ No newline at end of file diff --git a/config.py b/config.py new file mode 100644 index 0000000..865f73b --- /dev/null +++ b/config.py @@ -0,0 +1,18 @@ +#LOAD THE CONFIG +import json + +# Open the configuration file +with open('config.json') as f: + # Load JSON data from file + config = json.load(f) + +# Accessing SC_DOMAIN +SITE = config["Siti"] +FT_DOMAIN = SITE["Filmpertutti"]['domain'] +SC_DOMAIN = SITE["StreamingCommunity"]['domain'] +TF_DOMAIN = SITE["Filmpertutti"]['enabled'] +FILMPERTUTTI = SITE["Filmpertutti"]['enabled'] +STREAMINGCOMMUNITY = SITE["StreamingCommunity"]['enabled'] +#General +GENERAL = config['General'] +dotenv = GENERAL["load_env"] diff --git a/convert.py b/convert.py index f18a3ed..d5531c7 100644 --- a/convert.py +++ b/convert.py @@ -1,7 +1,7 @@ import requests from tmdbv3api import TMDb, Movie, TV from loadenv import load_env -TMDB_KEY, _, _, _,_ = load_env() +TMDB_KEY= load_env() def get_TMDb_id_from_IMDb_id(imdb_id): response = requests.get(f'https://api.themoviedb.org/3/find/{imdb_id}', params={'external_source': 'imdb_id', 'api_key': f'{TMDB_KEY}'}) diff --git a/example.env b/example.env index be021ba..c9e95ab 100644 --- a/example.env +++ b/example.env @@ -1,7 +1,3 @@ TMDB_KEY= "INSERT YOUR API KEY HERE" -FT_DOMAIN = "INSERT FILMPERTUTTI DOMAIN" -SC_DOMAIN = "INSERT STREAMINGCOMMUNITY DOMAIN" -FILMPERTUTTI= "Put 1 if enabled, 0 if disabled" -STREAMINGCOMMUNITY = "Put 1 if enabled, 0 if disabled" diff --git a/filmpertutti.py b/filmpertutti.py index bc6a294..1f991ae 100644 --- a/filmpertutti.py +++ b/filmpertutti.py @@ -7,12 +7,13 @@ import re from datetime import datetime import dateparser from convert import get_TMDb_id_from_IMDb_id -from loadenv import load_env from info import get_info, is_movie from convert_date import convert_US_date import logging +import config + +FT_DOMAIN = config.FT_DOMAIN -_, FT_DOMAIN,_,_ ,_= load_env() #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', diff --git a/info.py b/info.py index 0cdd4a9..6b5deff 100644 --- a/info.py +++ b/info.py @@ -1,7 +1,7 @@ from loadenv import load_env from tmdbv3api import TMDb, Movie, TV from convert_date import convert_US_date, convert_IT_date -TMDB_KEY,_,_,FILMPERTUTTI,STREAMINGCOMMUNITY = load_env() +TMDB_KEY= load_env() def get_info(tmbda,ismovie,type): tmdb = TMDb() diff --git a/loadenv.py b/loadenv.py index ed4144d..16232d1 100644 --- a/loadenv.py +++ b/loadenv.py @@ -1,10 +1,13 @@ import os -from dotenv import load_dotenv -load_dotenv(".env") +import config + +dotenv = config.dotenv +#You need to keep dotenv disabled on remote servers +if dotenv == "1": + from dotenv import load_dotenv + load_dotenv(".env") + + def load_env(): TMDB_KEY = os.getenv('TMDB_KEY') - FT_DOMAIN = os.getenv('FT_DOMAIN') - SC_DOMAIN= os.getenv('SC_DOMAIN') - FILMPERTUTTI = os.getenv('FILMPERTUTTI') - STREAMINGCOMMUNITY = os.getenv('STREAMINGCOMMUNITY') - return TMDB_KEY, FT_DOMAIN, SC_DOMAIN, FILMPERTUTTI, STREAMINGCOMMUNITY \ No newline at end of file + return TMDB_KEY \ No newline at end of file diff --git a/run.py b/run.py index 8cc2083..553a9ea 100644 --- a/run.py +++ b/run.py @@ -1,8 +1,12 @@ from flask import Flask, jsonify, abort from filmpertutti import filmpertutti from streamingcommunity import streaming_community -from loadenv import load_env -TMDB_KEY, FT_DOMAIN, SC_DOMAIN, FILMPERTUTTI, STREAMINGCOMMUNITY = load_env() +import json +import config + +FILMPERTUTTI = config.FILMPERTUTTI +STREAMINGCOMMUNITY = config.STREAMINGCOMMUNITY + app = Flask(__name__) diff --git a/streamingcommunity.py b/streamingcommunity.py index 7b6e464..0d06f77 100644 --- a/streamingcommunity.py +++ b/streamingcommunity.py @@ -5,10 +5,10 @@ from bs4 import BeautifulSoup,SoupStrainer from datetime import datetime import dateparser from convert import get_TMDb_id_from_IMDb_id -from loadenv import load_env from info import get_info, is_movie +import config #Get domain -_, _,SC_DOMAIN,_ ,_= load_env() +SC_DOMAIN= config.SC_DOMAIN 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', @@ -83,7 +83,7 @@ def streaming_community(imdb): tmdba = get_TMDb_id_from_IMDb_id(imdb_id) showname = requests.get(f'https://v3.sg.media-imdb.com/suggestion/a/{imdb_id}.json') showname = showname.json() - showname = showname['d'][0]['l'] + showname = showname['d'][-1]['l'] else: #else just equals them tmdba = imdb_id.replace("tmdb:","")