diff --git a/__pycache__/filmpertutti.cpython-311.pyc b/__pycache__/filmpertutti.cpython-311.pyc index bab179b..3297d42 100644 Binary files a/__pycache__/filmpertutti.cpython-311.pyc and b/__pycache__/filmpertutti.cpython-311.pyc differ diff --git a/filmpertutti.py b/filmpertutti.py index 0358579..67044e0 100644 --- a/filmpertutti.py +++ b/filmpertutti.py @@ -85,24 +85,13 @@ def get_mamma(tmbda,ismovie): return showname,date def search(query,date): - response = requests.get(query) - soup = BeautifulSoup(response.text, 'lxml') - test= soup.find('div', class_='elementor-posts-container elementor-posts elementor-posts--skin-classic elementor-grid') - # Find all articles - articles = test.select('article', class_='elementor-post elementor-grid-item post-629565') - - # Loop through each article - for article in articles: - # Find the link inside the article - link = article.find('a', class_='elementor-post__thumbnail__link') - - # Extract the href attribute from the link - href = link['href'] - #replace base url for easier scraping - #Get the correct serie by checking if the date is equals - series_response = requests.get(href, headers=headers) + response = requests.get(query).json() + for json in response: + link = json['link'] + tid = json['id'] + series_response = requests.get(link, headers=headers) series_soup = BeautifulSoup(series_response.text, 'lxml') - release_span = series_soup.find('span', class_='released') + release_span = series_soup.find('span', class_='released') if release_span: if release_span.text != "Data di uscita: N/A": date_string = release_span.text.split(': ')[-1] # Get the date part @@ -113,19 +102,12 @@ def search(query,date): release_date = dateparser.parse(date_string, languages=['it']).strftime("%Y-%m-%d") print(release_date) if release_date == date: - url = href + url = link + tid = tid break - return url + return url, tid -def get_episode_link(season,episode,url): - response = requests.get(url) - # Extract the 'link' field from the headers - link_field = response.headers.get('Link') - links = link_field.split(',') - links = [link.split(';')[0].strip('<>') for link in links] - second_link = links[2] - #Get the ID of the serie (not tmbd or imbd) - tid = second_link.split("=")[1] +def get_episode_link(season,episode,tid,url): episode = int(episode) season = int(season) tlink = f'{url}?show_video=true&post_id={tid}&season_id={season-1}&episode_id={episode-1}' @@ -172,15 +154,14 @@ def get_stream_link(imbd): else: tmdba,ismovie = info showname,date = get_mamma(tmdba,ismovie) - - query = f'https://filmpertutti.{DOMAIN}/?s=+{showname}' - query = query.replace(" ", "+").replace("–", "+").replace("—","+") + showname = showname.replace(" ", "+").replace("–", "+").replace("—","+") + query = f'https://filmpertutti.{DOMAIN}/wp-json/wp/v2/posts?search={showname}&page=1&_fields=link,id' print(query) - url = search(query,date) + url,tid = search(query,date) print(ismovie) print(url) if ismovie == 0: - episode_link = get_episode_link(season,episode,url) + episode_link = get_episode_link(season,episode,tid,url) print(episode_link) #Let's get mixdrop link real_link = get_real_link(episode_link) @@ -195,3 +176,4 @@ def get_stream_link(imbd): #let's get delivery link, streaming link streaming_link = get_true_link(real_link) return streaming_link +