Spaces:
Paused
Paused
UrloMythus commited on
Commit Β·
1ca4abf
1
Parent(s): 600ba70
- filmpertutti.py +17 -5
- info.py +29 -1
- streamingcommunity.py +4 -7
filmpertutti.py
CHANGED
|
@@ -7,7 +7,7 @@ import re
|
|
| 7 |
from datetime import datetime
|
| 8 |
import dateparser
|
| 9 |
from convert import get_TMDb_id_from_IMDb_id
|
| 10 |
-
from info import
|
| 11 |
from convert_date import convert_US_date
|
| 12 |
import logging
|
| 13 |
import config
|
|
@@ -93,12 +93,23 @@ def filmpertutti(imdb):
|
|
| 93 |
general = is_movie(imdb)
|
| 94 |
ismovie = general[0]
|
| 95 |
imdb_id = general[1]
|
|
|
|
| 96 |
if ismovie == 0 :
|
| 97 |
season = int(general[2])
|
| 98 |
episode = int(general[3])
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
showname = showname.replace(" ", "+").replace("β", "+").replace("β","+")
|
| 103 |
#Build the query
|
| 104 |
query = f'https://filmpertutti.{FT_DOMAIN}/wp-json/wp/v2/posts?search={showname}&page=1&_fields=link,id'
|
|
@@ -122,4 +133,5 @@ def filmpertutti(imdb):
|
|
| 122 |
#let's get delivery link, streaming link
|
| 123 |
streaming_link = get_true_link(real_link)
|
| 124 |
print(streaming_link)
|
| 125 |
-
return streaming_link
|
|
|
|
|
|
| 7 |
from datetime import datetime
|
| 8 |
import dateparser
|
| 9 |
from convert import get_TMDb_id_from_IMDb_id
|
| 10 |
+
from info import get_info_tmdb, is_movie, get_info_imdb
|
| 11 |
from convert_date import convert_US_date
|
| 12 |
import logging
|
| 13 |
import config
|
|
|
|
| 93 |
general = is_movie(imdb)
|
| 94 |
ismovie = general[0]
|
| 95 |
imdb_id = general[1]
|
| 96 |
+
type = "Filmpertutti"
|
| 97 |
if ismovie == 0 :
|
| 98 |
season = int(general[2])
|
| 99 |
episode = int(general[3])
|
| 100 |
+
if "tt" in imdb:
|
| 101 |
+
if ismovie == 0:
|
| 102 |
+
#Get showname and date
|
| 103 |
+
showname,date = get_info_imdb(imdb_id,ismovie,type)
|
| 104 |
+
else:
|
| 105 |
+
#THIS IS needed cause the only way to get all releases dates is by giving a tmdb ID not a IMDB
|
| 106 |
+
tmdba = get_TMDb_id_from_IMDb_id(imdb_id)
|
| 107 |
+
showname,date = get_info_tmdb(tmdba,ismovie,type)
|
| 108 |
+
|
| 109 |
+
elif "tmdb" in imdb:
|
| 110 |
+
#Get showname and date
|
| 111 |
+
tmdba = imdb_id.replace("tmdb:","")
|
| 112 |
+
showname,date = get_info_tmdb(tmdba,ismovie,type)
|
| 113 |
showname = showname.replace(" ", "+").replace("β", "+").replace("β","+")
|
| 114 |
#Build the query
|
| 115 |
query = f'https://filmpertutti.{FT_DOMAIN}/wp-json/wp/v2/posts?search={showname}&page=1&_fields=link,id'
|
|
|
|
| 133 |
#let's get delivery link, streaming link
|
| 134 |
streaming_link = get_true_link(real_link)
|
| 135 |
print(streaming_link)
|
| 136 |
+
return streaming_link
|
| 137 |
+
filmpertutti("tt16426418")
|
info.py
CHANGED
|
@@ -1,9 +1,10 @@
|
|
| 1 |
from loadenv import load_env
|
| 2 |
from tmdbv3api import TMDb, Movie, TV
|
| 3 |
from convert_date import convert_US_date, convert_IT_date
|
|
|
|
| 4 |
TMDB_KEY= load_env()
|
| 5 |
|
| 6 |
-
def
|
| 7 |
tmdb = TMDb()
|
| 8 |
tmdb.api_key = f'{TMDB_KEY}'
|
| 9 |
tmdb.language = 'it'
|
|
@@ -28,6 +29,33 @@ def get_info(tmbda,ismovie,type):
|
|
| 28 |
return showname,date
|
| 29 |
|
| 30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
def is_movie(imdb_id):
|
| 32 |
if "tmdb:" in imdb_id:
|
| 33 |
imdb_id = imdb_id.replace("tmdb:","")
|
|
|
|
| 1 |
from loadenv import load_env
|
| 2 |
from tmdbv3api import TMDb, Movie, TV
|
| 3 |
from convert_date import convert_US_date, convert_IT_date
|
| 4 |
+
import requests
|
| 5 |
TMDB_KEY= load_env()
|
| 6 |
|
| 7 |
+
def get_info_tmdb(tmbda,ismovie,type):
|
| 8 |
tmdb = TMDb()
|
| 9 |
tmdb.api_key = f'{TMDB_KEY}'
|
| 10 |
tmdb.language = 'it'
|
|
|
|
| 29 |
return showname,date
|
| 30 |
|
| 31 |
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
def get_info_imdb(imdb_id, ismovie, type):
|
| 35 |
+
|
| 36 |
+
resp = requests.get(f'https://api.themoviedb.org/3/find/{imdb_id}?api_key={TMDB_KEY}&language=it&external_source=imdb_id')
|
| 37 |
+
data = resp.json()
|
| 38 |
+
if ismovie == 0:
|
| 39 |
+
showname = data['tv_results'][0]['name']
|
| 40 |
+
if type == "Filmpertutti":
|
| 41 |
+
date= data['tv_results'][0]['first_air_date']
|
| 42 |
+
print("Real date",date)
|
| 43 |
+
return showname, date
|
| 44 |
+
elif type == "StreamingCommunity":
|
| 45 |
+
return showname
|
| 46 |
+
|
| 47 |
+
elif ismovie == 1:
|
| 48 |
+
showname= data['movie_results'][0]['title']
|
| 49 |
+
if type == "Filmpertutti":
|
| 50 |
+
return
|
| 51 |
+
elif type == "StreamingCommunity":
|
| 52 |
+
return showname
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
|
| 59 |
def is_movie(imdb_id):
|
| 60 |
if "tmdb:" in imdb_id:
|
| 61 |
imdb_id = imdb_id.replace("tmdb:","")
|
streamingcommunity.py
CHANGED
|
@@ -5,7 +5,7 @@ from bs4 import BeautifulSoup,SoupStrainer
|
|
| 5 |
from datetime import datetime
|
| 6 |
import dateparser
|
| 7 |
from convert import get_TMDb_id_from_IMDb_id
|
| 8 |
-
from info import
|
| 9 |
import config
|
| 10 |
import json
|
| 11 |
#Get domain
|
|
@@ -99,16 +99,13 @@ def streaming_community(imdb):
|
|
| 99 |
season = int(general[2])
|
| 100 |
episode = int(general[3])
|
| 101 |
if "tt" in imdb:
|
| 102 |
-
#
|
| 103 |
-
|
| 104 |
-
showname = requests.get(f'https://v3.sg.media-imdb.com/suggestion/a/{imdb_id}.json')
|
| 105 |
-
showname = showname.json()
|
| 106 |
-
showname = showname['d'][-1]['l']
|
| 107 |
else:
|
| 108 |
#else just equals them
|
| 109 |
tmdba = imdb_id.replace("tmdb:","")
|
| 110 |
type = "StreamingCommunity"
|
| 111 |
-
showname =
|
| 112 |
showname = showname.replace(" ", "+").replace("β", "+").replace("β","+")
|
| 113 |
query = f'https://streamingcommunity.{SC_DOMAIN}/api/search?q={showname}'
|
| 114 |
tid,slug = search(query)
|
|
|
|
| 5 |
from datetime import datetime
|
| 6 |
import dateparser
|
| 7 |
from convert import get_TMDb_id_from_IMDb_id
|
| 8 |
+
from info import get_info_tmdb, is_movie, get_info_imdb
|
| 9 |
import config
|
| 10 |
import json
|
| 11 |
#Get domain
|
|
|
|
| 99 |
season = int(general[2])
|
| 100 |
episode = int(general[3])
|
| 101 |
if "tt" in imdb:
|
| 102 |
+
#Get showname
|
| 103 |
+
showname = get_info_imdb(imdb_id,ismovie,"StreamingCommunity")
|
|
|
|
|
|
|
|
|
|
| 104 |
else:
|
| 105 |
#else just equals them
|
| 106 |
tmdba = imdb_id.replace("tmdb:","")
|
| 107 |
type = "StreamingCommunity"
|
| 108 |
+
showname = get_info_tmdb(tmdba,ismovie,type)
|
| 109 |
showname = showname.replace(" ", "+").replace("β", "+").replace("β","+")
|
| 110 |
query = f'https://streamingcommunity.{SC_DOMAIN}/api/search?q={showname}'
|
| 111 |
tid,slug = search(query)
|