Added Accurate Search for Streaming Community but for series
This commit is contained in:
@@ -237,7 +237,7 @@ In the repo there is a config.json that you can modify to change some aspects of
|
||||
|-------------------------|---|
|
||||
| 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|
|
||||
|fast_search|"1" for enabled, "0" for disabled. It enables a faster search for TantiFilm 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. |
|
||||
|HOST| The host for the Flask APP|
|
||||
|PORT| The port for the Flask APP. Default: 8080 |
|
||||
|
||||
+3
-2
@@ -2,13 +2,14 @@
|
||||
"Siti": {
|
||||
"StreamingCommunity": {
|
||||
"enabled": "1",
|
||||
"domain": "boston"
|
||||
"domain": "boston",
|
||||
"fast_search": "0"
|
||||
},
|
||||
"Filmpertutti": {
|
||||
"enabled": "1",
|
||||
"domain": "makeup"
|
||||
},
|
||||
"Tuttifilm":{
|
||||
"Tantifilm":{
|
||||
"enabled": "1",
|
||||
"domain": "bond",
|
||||
"fast_search": "0"
|
||||
|
||||
@@ -13,6 +13,7 @@ SC_DOMAIN = SITE["StreamingCommunity"]['domain']
|
||||
TF_DOMAIN = SITE["Filmpertutti"]['enabled']
|
||||
FILMPERTUTTI = SITE["Filmpertutti"]['enabled']
|
||||
STREAMINGCOMMUNITY = SITE["StreamingCommunity"]['enabled']
|
||||
SC_FAST_SEARCH = SITE["StreamingCommunity"]['fast_search']
|
||||
#General
|
||||
GENERAL = config['General']
|
||||
dotenv = GENERAL["load_env"]
|
||||
|
||||
@@ -2,6 +2,8 @@ from loadenv import load_env
|
||||
from tmdbv3api import TMDb, Movie, TV
|
||||
from convert_date import convert_US_date, convert_IT_date
|
||||
import requests
|
||||
import config
|
||||
SC_FAST_SEARCH = config.SC_FAST_SEARCH
|
||||
TMDB_KEY= load_env()
|
||||
|
||||
def get_info_tmdb(tmbda,ismovie,type):
|
||||
@@ -14,9 +16,13 @@ def get_info_tmdb(tmbda,ismovie,type):
|
||||
showname = show.name
|
||||
if type == "Filmpertutti":
|
||||
date= show.first_air_date
|
||||
elif type == "StreamingCommunity":
|
||||
date = show.last_air_date
|
||||
print("Real date",date)
|
||||
return showname,date
|
||||
elif type == "StreamingCommunity":
|
||||
if SC_FAST_SEARCH == "0":
|
||||
n_season = show.number_of_seasons
|
||||
return showname,n_season
|
||||
|
||||
else:
|
||||
movie = Movie()
|
||||
show= movie.details(tmbda)
|
||||
@@ -55,7 +61,6 @@ def get_info_imdb(imdb_id, ismovie, type):
|
||||
|
||||
|
||||
|
||||
|
||||
def is_movie(imdb_id):
|
||||
if "tmdb:" in imdb_id:
|
||||
imdb_id = imdb_id.replace("tmdb:","")
|
||||
|
||||
+18
-4
@@ -10,6 +10,7 @@ import config
|
||||
import json
|
||||
#Get domain
|
||||
SC_DOMAIN= config.SC_DOMAIN
|
||||
SC_FAST_SEARCH = config.SC_FAST_SEARCH
|
||||
|
||||
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',
|
||||
@@ -35,12 +36,17 @@ def get_version():
|
||||
version = "65e52dcf34d64173542cd2dc6b8bb75b"
|
||||
return version
|
||||
|
||||
def search(query):
|
||||
def search(query,n_season):
|
||||
#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']
|
||||
number_of_seasons = item['seasons_count']
|
||||
if SC_FAST_SEARCH == "0":
|
||||
if number_of_seasons == n_season:
|
||||
return tid,slug
|
||||
elif SC_FAST_SEARCH == "1":
|
||||
return tid,slug
|
||||
|
||||
|
||||
@@ -95,20 +101,28 @@ def streaming_community(imdb):
|
||||
general = is_movie(imdb)
|
||||
ismovie = general[0]
|
||||
imdb_id = general[1]
|
||||
type = "StreamingCommunity"
|
||||
if ismovie == 0 :
|
||||
season = int(general[2])
|
||||
episode = int(general[3])
|
||||
#Check if fast search is enabled or disabled
|
||||
if SC_FAST_SEARCH == "1":
|
||||
if "tt" in imdb:
|
||||
#Get showname
|
||||
showname = get_info_imdb(imdb_id,ismovie,"StreamingCommunity")
|
||||
showname = get_info_imdb(imdb_id,ismovie,type)
|
||||
n_season = None
|
||||
else:
|
||||
#I just set n season to None to avoid bugs, but it is not needed if Fast search is enabled
|
||||
n_season = None
|
||||
#else just equals them
|
||||
tmdba = imdb_id.replace("tmdb:","")
|
||||
type = "StreamingCommunity"
|
||||
showname = get_info_tmdb(tmdba,ismovie,type)
|
||||
elif SC_FAST_SEARCH == "0":
|
||||
tmdba = get_TMDb_id_from_IMDb_id(imdb_id)
|
||||
showname,n_season = get_info_tmdb(tmdba,ismovie,type)
|
||||
showname = showname.replace(" ", "+").replace("–", "+").replace("—","+")
|
||||
query = f'https://streamingcommunity.{SC_DOMAIN}/api/search?q={showname}'
|
||||
tid,slug = search(query)
|
||||
tid,slug = search(query,n_season)
|
||||
if ismovie == 1:
|
||||
#TID means temporaly ID
|
||||
url = get_film(tid)
|
||||
|
||||
Reference in New Issue
Block a user