Added Accurate Search for Streaming Community but for series

This commit is contained in:
UrloMythus
2024-07-11 21:07:46 +02:00 Unverified
parent 0ab5e94b2b
commit 0e13ada65f
5 changed files with 38 additions and 17 deletions
+1 -1
View File
@@ -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 | | 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| |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. | |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| |HOST| The host for the Flask APP|
|PORT| The port for the Flask APP. Default: 8080 | |PORT| The port for the Flask APP. Default: 8080 |
+3 -2
View File
@@ -2,13 +2,14 @@
"Siti": { "Siti": {
"StreamingCommunity": { "StreamingCommunity": {
"enabled": "1", "enabled": "1",
"domain": "boston" "domain": "boston",
"fast_search": "0"
}, },
"Filmpertutti": { "Filmpertutti": {
"enabled": "1", "enabled": "1",
"domain": "makeup" "domain": "makeup"
}, },
"Tuttifilm":{ "Tantifilm":{
"enabled": "1", "enabled": "1",
"domain": "bond", "domain": "bond",
"fast_search": "0" "fast_search": "0"
+1
View File
@@ -13,6 +13,7 @@ SC_DOMAIN = SITE["StreamingCommunity"]['domain']
TF_DOMAIN = SITE["Filmpertutti"]['enabled'] TF_DOMAIN = SITE["Filmpertutti"]['enabled']
FILMPERTUTTI = SITE["Filmpertutti"]['enabled'] FILMPERTUTTI = SITE["Filmpertutti"]['enabled']
STREAMINGCOMMUNITY = SITE["StreamingCommunity"]['enabled'] STREAMINGCOMMUNITY = SITE["StreamingCommunity"]['enabled']
SC_FAST_SEARCH = SITE["StreamingCommunity"]['fast_search']
#General #General
GENERAL = config['General'] GENERAL = config['General']
dotenv = GENERAL["load_env"] dotenv = GENERAL["load_env"]
+8 -3
View File
@@ -2,6 +2,8 @@ from loadenv import load_env
from tmdbv3api import TMDb, Movie, TV from tmdbv3api import TMDb, Movie, TV
from convert_date import convert_US_date, convert_IT_date from convert_date import convert_US_date, convert_IT_date
import requests import requests
import config
SC_FAST_SEARCH = config.SC_FAST_SEARCH
TMDB_KEY= load_env() TMDB_KEY= load_env()
def get_info_tmdb(tmbda,ismovie,type): def get_info_tmdb(tmbda,ismovie,type):
@@ -14,9 +16,13 @@ def get_info_tmdb(tmbda,ismovie,type):
showname = show.name showname = show.name
if type == "Filmpertutti": if type == "Filmpertutti":
date= show.first_air_date date= show.first_air_date
elif type == "StreamingCommunity":
date = show.last_air_date
print("Real date",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: else:
movie = Movie() movie = Movie()
show= movie.details(tmbda) show= movie.details(tmbda)
@@ -55,7 +61,6 @@ def get_info_imdb(imdb_id, ismovie, type):
def is_movie(imdb_id): def is_movie(imdb_id):
if "tmdb:" in imdb_id: if "tmdb:" in imdb_id:
imdb_id = imdb_id.replace("tmdb:","") imdb_id = imdb_id.replace("tmdb:","")
+25 -11
View File
@@ -10,6 +10,7 @@ import config
import json import json
#Get domain #Get domain
SC_DOMAIN= config.SC_DOMAIN SC_DOMAIN= config.SC_DOMAIN
SC_FAST_SEARCH = config.SC_FAST_SEARCH
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', '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,13 +36,18 @@ def get_version():
version = "65e52dcf34d64173542cd2dc6b8bb75b" version = "65e52dcf34d64173542cd2dc6b8bb75b"
return version 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 #Do a request to get the ID of serie/move and it's slug in the URL
response = requests.get(query).json() response = requests.get(query).json()
for item in response['data']: for item in response['data']:
tid = item['id'] tid = item['id']
slug = item['slug'] slug = item['slug']
return tid,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
def get_film(tid): def get_film(tid):
@@ -95,20 +101,28 @@ def streaming_community(imdb):
general = is_movie(imdb) general = is_movie(imdb)
ismovie = general[0] ismovie = general[0]
imdb_id = general[1] imdb_id = general[1]
type = "StreamingCommunity"
if ismovie == 0 : if ismovie == 0 :
season = int(general[2]) season = int(general[2])
episode = int(general[3]) episode = int(general[3])
if "tt" in imdb: #Check if fast search is enabled or disabled
#Get showname if SC_FAST_SEARCH == "1":
showname = get_info_imdb(imdb_id,ismovie,"StreamingCommunity") if "tt" in imdb:
else: #Get showname
#else just equals them showname = get_info_imdb(imdb_id,ismovie,type)
tmdba = imdb_id.replace("tmdb:","") n_season = None
type = "StreamingCommunity" else:
showname = get_info_tmdb(tmdba,ismovie,type) #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:","")
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("—","+") showname = showname.replace(" ", "+").replace("–", "+").replace("—","+")
query = f'https://streamingcommunity.{SC_DOMAIN}/api/search?q={showname}' query = f'https://streamingcommunity.{SC_DOMAIN}/api/search?q={showname}'
tid,slug = search(query) tid,slug = search(query,n_season)
if ismovie == 1: if ismovie == 1:
#TID means temporaly ID #TID means temporaly ID
url = get_film(tid) url = get_film(tid)