Added StreamingCommunity and rewrote Readme.md
This commit is contained in:
@@ -1 +1,2 @@
|
||||
.env
|
||||
streamingcommunity.py
|
||||
@@ -1,19 +1,35 @@
|
||||
# MammaMia
|
||||
A Stremio Addon for HTTPS Stream in Italian
|
||||
Note that for now only filmpertutti is avaiable which uses Mixdrop. Mixdrop allows to see the videos only from the same IP they were generated so, if you want to scrape filmpertutti, you have to host this project locally.
|
||||
|
||||
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.
|
||||
|
||||
|
||||
|
||||
# Installation
|
||||
|
||||
Install required packages
|
||||
|
||||
``
|
||||
pip install -r requirements.txt
|
||||
``
|
||||
|
||||
|
||||
Just execute:
|
||||
Then to start the Flask server just execute:
|
||||
``
|
||||
python3 run.py
|
||||
``
|
||||
# How to add to Stremio
|
||||
Just paste the URL/manifest.json in your search bar.
|
||||
# Enviroment Variables
|
||||
TMDB_KEY = "Your key here"
|
||||
|
||||
DOMAIN = "domain here"
|
||||
| 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
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+3
-12
@@ -1,24 +1,15 @@
|
||||
import requests
|
||||
from tmdbv3api import TMDb, Movie, TV
|
||||
from loadenv import load_env
|
||||
TMDB_KEY, DOMAIN = load_env()
|
||||
|
||||
TMDB_KEY, _, _, _,_ = load_env()
|
||||
def get_TMDb_id_from_IMDb_id(imdb_id):
|
||||
if ":" in imdb_id:
|
||||
season = imdb_id.split(":")[1]
|
||||
episode = imdb_id[-1]
|
||||
ismovie = 0
|
||||
imdb_id = imdb_id.split(":")[0]
|
||||
else:
|
||||
ismovie = 1
|
||||
response = requests.get(f'https://api.themoviedb.org/3/find/{imdb_id}',
|
||||
params={'external_source': 'imdb_id', 'api_key': f'{TMDB_KEY}'})
|
||||
tmbda = response.json()
|
||||
if tmbda['movie_results']:
|
||||
print(tmbda)
|
||||
return tmbda['movie_results'][0]['id'], ismovie
|
||||
return tmbda['movie_results'][0]['id']
|
||||
elif tmbda['tv_results']:
|
||||
print(tmbda['tv_results'][0]['id'])
|
||||
return tmbda['tv_results'][0]['id'], season, episode , ismovie
|
||||
return tmbda['tv_results'][0]['id']
|
||||
else:
|
||||
return None
|
||||
+6
-1
@@ -1,2 +1,7 @@
|
||||
TMDB_KEY= "INSERT YOUR API KEY HERE"
|
||||
DOMAIN = "INSERT DOMAIN"
|
||||
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"
|
||||
|
||||
|
||||
|
||||
+23
-21
@@ -1,21 +1,24 @@
|
||||
|
||||
from tmdbv3api import TMDb, Movie, TV
|
||||
import requests
|
||||
from bs4 import BeautifulSoup
|
||||
from bs4 import BeautifulSoup,SoupStrainer
|
||||
import string
|
||||
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
|
||||
from info import get_info, is_movie
|
||||
from convert_date import convert_US_date
|
||||
import logging
|
||||
|
||||
TMDB_KEY, DOMAIN = load_env()
|
||||
_, 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',
|
||||
'Accept-Language': 'en-US,en;q=0.5'
|
||||
}
|
||||
#Map months to check if date = date
|
||||
month_mapping = {
|
||||
'Jan': 'Gennaio', 'Feb': 'Febbraio', 'Mar': 'Marzo', 'Apr': 'Aprile',
|
||||
'May': 'Maggio', 'Jun': 'Giugno', 'Jul': 'Luglio', 'Aug': 'Agosto',
|
||||
@@ -24,6 +27,7 @@ month_mapping = {
|
||||
|
||||
def search(query,date):
|
||||
response = requests.get(query).json()
|
||||
#Get link tid of every item and then open the link to see if the date = date
|
||||
for json in response:
|
||||
link = json['link']
|
||||
tid = json['id']
|
||||
@@ -38,7 +42,6 @@ def search(query,date):
|
||||
|
||||
# Swap to YY-MM-DD formatting using dateparser
|
||||
release_date = dateparser.parse(date_string, languages=['it']).strftime("%Y-%m-%d")
|
||||
print(release_date)
|
||||
if release_date == date:
|
||||
url = link
|
||||
tid = tid
|
||||
@@ -46,19 +49,20 @@ def search(query,date):
|
||||
return url, tid
|
||||
|
||||
def get_episode_link(season,episode,tid,url):
|
||||
episode = int(episode)
|
||||
season = int(season)
|
||||
#Get the link from where we have to obtain mixdrop link
|
||||
tlink = f'{url}?show_video=true&post_id={tid}&season_id={season-1}&episode_id={episode-1}'
|
||||
return tlink
|
||||
|
||||
|
||||
def get_film(url):
|
||||
#Get the link from where we have to obtain mixdrop link
|
||||
tlink = url + "?show_video=true"
|
||||
return tlink
|
||||
|
||||
def get_real_link(tlink):
|
||||
#Some basic code to get the mixdrop link
|
||||
page = requests.get(tlink, headers=headers)
|
||||
soup = BeautifulSoup(page.content, features="lxml")
|
||||
soup = BeautifulSoup(page.content, features="lxml",parse_only=SoupStrainer('iframe'))
|
||||
iframe_src = soup.find('iframe')['src']
|
||||
|
||||
iframe_page = requests.get(iframe_src, headers=headers)
|
||||
@@ -67,7 +71,6 @@ def get_real_link(tlink):
|
||||
mega_button = iframe_soup.find('div', attrs={'class': 'megaButton', 'rel': 'nofollow'}, string='MIXDROP')
|
||||
if mega_button:
|
||||
real_link = mega_button.get('meta-link')
|
||||
print(f'Real link: {real_link}')
|
||||
return real_link
|
||||
|
||||
def get_true_link(real_link):
|
||||
@@ -82,36 +85,35 @@ def get_true_link(real_link):
|
||||
s = 'https:'
|
||||
for c in schema:
|
||||
s += d[c] if c in d else c
|
||||
print(s)
|
||||
return s
|
||||
|
||||
def get_stream_link(imbd):
|
||||
general = get_TMDb_id_from_IMDb_id(imbd)
|
||||
if len(general)==4 :
|
||||
tmdba,season,episode,ismovie = general
|
||||
else:
|
||||
tmdba,ismovie = general
|
||||
def filmpertutti(imdb):
|
||||
general = is_movie(imdb)
|
||||
ismovie = general[0]
|
||||
imdb_id = general[1]
|
||||
if ismovie == 0 :
|
||||
season = int(general[2])
|
||||
episode = int(general[3])
|
||||
tmdba = get_TMDb_id_from_IMDb_id(imdb_id)
|
||||
type = "Filmpertutti"
|
||||
showname,date = get_info(tmdba,ismovie,type)
|
||||
showname = showname.replace(" ", "+").replace("–", "+").replace("—","+")
|
||||
query = f'https://filmpertutti.{DOMAIN}/wp-json/wp/v2/posts?search={showname}&page=1&_fields=link,id'
|
||||
print(query)
|
||||
#Build the query
|
||||
query = f'https://filmpertutti.{FT_DOMAIN}/wp-json/wp/v2/posts?search={showname}&page=1&_fields=link,id'
|
||||
url,tid = search(query,date)
|
||||
print(ismovie)
|
||||
print(url)
|
||||
if ismovie == 0:
|
||||
episode_link = get_episode_link(season,episode,tid,url)
|
||||
print(episode_link)
|
||||
#Let's get mixdrop link
|
||||
real_link = get_real_link(episode_link)
|
||||
#let's get delivery link, streaming link
|
||||
streaming_link = get_true_link(real_link)
|
||||
print(streaming_link)
|
||||
return streaming_link
|
||||
elif ismovie == 1:
|
||||
film_link = get_film(url)
|
||||
print(film_link)
|
||||
#Let's get mixdrop link
|
||||
real_link = get_real_link(film_link)
|
||||
#let's get delivery link, streaming link
|
||||
streaming_link = get_true_link(real_link)
|
||||
print(streaming_link)
|
||||
return streaming_link
|
||||
@@ -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, DOMAIN, FILMPERTUTTI,STREAMINGCOMMUNITY = load_env()
|
||||
TMDB_KEY,_,_,FILMPERTUTTI,STREAMINGCOMMUNITY = load_env()
|
||||
|
||||
def get_info(tmbda,ismovie,type):
|
||||
tmdb = TMDb()
|
||||
@@ -25,10 +25,18 @@ def get_info(tmbda,ismovie,type):
|
||||
if type == "Filmpertutti":
|
||||
#GET US RELEASE DATE because filmpertutti somewhy uses US release date
|
||||
date = convert_US_date(date)
|
||||
elif type == "StreamingCommunity":
|
||||
date = convert_IT_date(date)
|
||||
print (date)
|
||||
if ismovie==0:
|
||||
return showname,date
|
||||
return showname,date
|
||||
|
||||
|
||||
def is_movie(imdb_id):
|
||||
if "tmdb:" in imdb_id:
|
||||
imdb_id = imdb_id.replace("tmdb:","")
|
||||
if ":" in imdb_id:
|
||||
season = imdb_id.split(":")[1]
|
||||
episode = imdb_id[-1]
|
||||
ismovie = 0
|
||||
imdb_id = imdb_id.split(":")[0]
|
||||
return ismovie,imdb_id,season,episode
|
||||
else:
|
||||
return showname,date
|
||||
ismovie = 1
|
||||
return ismovie,imdb_id
|
||||
+3
-2
@@ -3,7 +3,8 @@ from dotenv import load_dotenv
|
||||
load_dotenv(".env")
|
||||
def load_env():
|
||||
TMDB_KEY = os.getenv('TMDB_KEY')
|
||||
DOMAIN = os.getenv('DOMAIN')
|
||||
FT_DOMAIN = os.getenv('FT_DOMAIN')
|
||||
SC_DOMAIN= os.getenv('SC_DOMAIN')
|
||||
FILMPERTUTTI = os.getenv('FILMPERTUTTI')
|
||||
STREAMINGCOMMUNITY = os.getenv('STREAMINGCOMMUNITY')
|
||||
return TMDB_KEY, DOMAIN, FILMPERTUTTI, STREAMINGCOMMUNITY
|
||||
return TMDB_KEY, FT_DOMAIN, SC_DOMAIN, FILMPERTUTTI, STREAMINGCOMMUNITY
|
||||
@@ -1,7 +1,9 @@
|
||||
from flask import Flask, jsonify, abort
|
||||
from filmpertutti import get_stream_link
|
||||
from filmpertutti import filmpertutti
|
||||
from streamingcommunity import streaming_community
|
||||
from loadenv import load_env
|
||||
TMDB_KEY, DOMAIN, FILMPERTUTTI, STREAMINGCOMMUNITY = load_env()
|
||||
TMDB_KEY, FT_DOMAIN, SC_DOMAIN, FILMPERTUTTI, STREAMINGCOMMUNITY = load_env()
|
||||
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
@@ -36,15 +38,26 @@ def root():
|
||||
def addon_stream(type, id):
|
||||
if type not in MANIFEST['types']:
|
||||
abort(404)
|
||||
if FILMPERTUTTI == 1:
|
||||
url = get_stream_link(id) # call the function to dynamically get stream links
|
||||
elif STREAMINGCOMMUNITY == 1:
|
||||
return "Not implemented yet"
|
||||
streams = {'streams': []}
|
||||
if STREAMINGCOMMUNITY == "1":
|
||||
url_streaming_community = streaming_community(id)
|
||||
print(url_streaming_community)
|
||||
if url_streaming_community is not None:
|
||||
streams['streams'].append({'title': 'StreamingCommunity 1080p', 'url': f'{url_streaming_community}?rendition=1080p'})
|
||||
streams['streams'].append({'title': 'StreamingCommunity 720p', 'url': f'{url_streaming_community}?rendition=720p'})
|
||||
|
||||
# If FILMPERTUTTI == 1, scrape that site
|
||||
if FILMPERTUTTI == "1":
|
||||
url_filmpertutti = filmpertutti(id)
|
||||
if url_filmpertutti is not None:
|
||||
streams['streams'].append({'title': 'Filmpertutti', 'url': url_filmpertutti})
|
||||
|
||||
streams = {'streams': [{'title': 'Stream URL', 'url': url}]}
|
||||
# If no streams were added, abort with a 404 error
|
||||
if not streams['streams']:
|
||||
abort(404)
|
||||
|
||||
return respond_with(streams)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(host='0.0.0.0', port=8080)
|
||||
|
||||
+86
-32
@@ -1,48 +1,102 @@
|
||||
from tmdbv3api import TMDb, Movie, TV
|
||||
import requests
|
||||
import logging
|
||||
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
|
||||
TMDB_KEY= load_env()
|
||||
from info import get_info, is_movie
|
||||
#Get domain
|
||||
_, _,SC_DOMAIN,_ ,_= load_env()
|
||||
|
||||
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',
|
||||
'Accept-Language': 'en-US,en;q=0.5'
|
||||
}
|
||||
def streaming_community(imbd):
|
||||
print(load_env)
|
||||
general = get_TMDb_id_from_IMDb_id(imbd)
|
||||
if len(general)==4 :
|
||||
tmdba,season,episode,ismovie = general
|
||||
|
||||
def search(query,date,ismovie):
|
||||
#Do a request to get the ID of serie/move and it's slug in the URL
|
||||
response = requests.get(query).json()
|
||||
for item in response['data']:
|
||||
tid = item['id']
|
||||
slug = item['slug']
|
||||
return tid,slug
|
||||
|
||||
|
||||
def get_film(tid):
|
||||
#Access the iframe
|
||||
url = f'https://streamingcommunity.{SC_DOMAIN}/iframe/{tid}'
|
||||
response = requests.get(url, headers=headers)
|
||||
iframe = BeautifulSoup(response.text, 'lxml')
|
||||
#Get the link of iframe
|
||||
iframe = iframe.find('iframe').get("src")
|
||||
#Get the ID containted in the src of iframe
|
||||
vixid = iframe.split("/embed/")[1].split("?")[0]
|
||||
#Build the url with 1080p, to get the highest resolution
|
||||
url = f'https://vixcloud.co/playlist/{vixid}'
|
||||
return url
|
||||
|
||||
def get_season_episode_id(tid,slug,season,episode):
|
||||
#Set some basic headers for the request
|
||||
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",
|
||||
'x-inertia': 'true',
|
||||
#Version of streaming community
|
||||
'x-inertia-version': 'c1bdf1189cb68fca28151c8e909bd053'
|
||||
}
|
||||
#Get episode ID
|
||||
response = requests.get(f'https://streamingcommunity.{SC_DOMAIN}/titles/{tid}-{slug}/stagione-{season}', headers=headers)
|
||||
# Print the json got
|
||||
json_response = response.json().get('props', {}).get('loadedSeason', {}).get('episodes', [])
|
||||
for dict_episode in json_response:
|
||||
if dict_episode['number'] == episode:
|
||||
return dict_episode['id']
|
||||
|
||||
def get_episode_link(episode_id,tid):
|
||||
#The parameters for the request
|
||||
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 = requests.get(f"https://streamingcommunity.{SC_DOMAIN}/iframe/{tid}", params=params)
|
||||
|
||||
# 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]
|
||||
url = f"https://vixcloud.co/playlist/{vixid}"
|
||||
return url
|
||||
|
||||
|
||||
def streaming_community(imdb):
|
||||
general = is_movie(imdb)
|
||||
ismovie = general[0]
|
||||
imdb_id = general[1]
|
||||
if ismovie == 0 :
|
||||
season = int(general[2])
|
||||
episode = int(general[3])
|
||||
if "tt" in imdb:
|
||||
#If it is a imbd then conver it to tmbd
|
||||
tmdba = get_TMDb_id_from_IMDb_id(imdb_id)
|
||||
else:
|
||||
tmdba,ismovie = general
|
||||
#else just equals them
|
||||
tmdba = imdb_id.replace("tmdb:","")
|
||||
type = "StreamingCommunity"
|
||||
showname,date = get_info(tmdba,ismovie,type)
|
||||
showname = showname.replace(" ", "+").replace("–", "+").replace("—","+")
|
||||
query = f'https://streamingcommunity.boston/api/search?q={showname}'
|
||||
date,tid,slug = search(query,date)
|
||||
if ismovie == 0:
|
||||
query = f'https://streamingcommunity.{SC_DOMAIN}/api/search?q={showname}'
|
||||
tid,slug = search(query,date,ismovie)
|
||||
if ismovie == 1:
|
||||
#TID means temporaly ID
|
||||
url = get_film(tid)
|
||||
return "NOT IMPLEMENTED YET"
|
||||
|
||||
|
||||
|
||||
def search(query,date):
|
||||
response = requests.get(query).json()
|
||||
for json in response:
|
||||
release_date = json['last_air_date']
|
||||
tid = json['id']
|
||||
slug = json['slug']
|
||||
if date == release_date:
|
||||
return date,tid,slug
|
||||
def get_film(tid):
|
||||
url = f'https://streamingcommunity.boston/watch/{tid}'
|
||||
response = requests.get(url, headers=headers)
|
||||
soup = BeautifulSoup(response.text, 'lxml', parse_only=SoupStrainer('iframe'))
|
||||
vixid = soup['src']
|
||||
vixid = vixid.split("/embed/")[1].split("?")[0]
|
||||
print (vixid)
|
||||
|
||||
streaming_community("tt16426418")
|
||||
print(url)
|
||||
return url
|
||||
if ismovie == 0:
|
||||
#Uid = URL ID
|
||||
episode_id = get_season_episode_id(tid,slug,season,episode)
|
||||
url = get_episode_link(episode_id,tid)
|
||||
print(url)
|
||||
return url
|
||||
Reference in New Issue
Block a user