diff --git a/lordchannel.py b/lordchannel.py index e23adc9..34ee478 100644 --- a/lordchannel.py +++ b/lordchannel.py @@ -8,15 +8,40 @@ from convert import get_TMDb_id_from_IMDb_id from info import get_info_tmdb, is_movie, get_info_imdb import config import re +import json LC_DOMAIN = config.LC_DOMAIN -def search(query,date,season,episode,ismovie): - response = requests.get(query) - soup = BeautifulSoup(response.text,"lxml") - cards = soup.find_all('div', class_='col-6 col-sm-4 col-lg-3 col-xl-3') - for card in cards: - a_tag = card.find('a', class_='card__play') - if a_tag is not None: # check if the a_tag exists - href = a_tag['href'] +def search(showname,date,season,episode,ismovie): + cookies = { + 'csrftoken': '7lvc502CZe8Zbx7iSX1xkZOBA1NbDxJZ', + } + + headers = { + 'authority': 'lordchannel.com', + 'accept': '*/*', + 'accept-language': 'it-IT,it;q=0.9,en-US;q=0.8,en;q=0.7', + # 'cookie': 'csrftoken=7lvc502CZe8Zbx7iSX1xkZOBA1NbDxJZ', + 'referer': 'https://lordchannel.com/anime/anime-ita/', + 'sec-ch-ua': '"Not-A.Brand";v="99", "Chromium";v="124"', + 'sec-ch-ua-mobile': '?0', + 'sec-ch-ua-platform': '"Android"', + 'sec-fetch-dest': 'empty', + 'sec-fetch-mode': 'cors', + 'sec-fetch-site': 'same-origin', + 'user-agent': 'Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36', + 'x-requested-with': 'XMLHttpRequest', + } + + params = { + 'media': showname, + '_': '1724421723999', + } + + response = requests.get('https://lordchannel.com/live_search/', params=params, cookies=cookies, headers=headers) + data = json.loads(response.text) + for entry in data['data']: + if entry is not None: # check if the a_tag exists + href = entry['url'] + quality = entry['qualit\u00e0_video'] link = f'https://lordchannel.{LC_DOMAIN}{href}' response = requests.get(link) soup2 = BeautifulSoup(response.text,'lxml') @@ -24,7 +49,6 @@ def search(query,date,season,episode,ismovie): if li_tag is not None: # check if the li_tag exists card_date = li_tag.text[-4:] if card_date == date: - quality = soup2.select('ul.card__list li')[0].text if ismovie == 1: video_url = soup2.find('a', class_="btn-streaming streaming_btn") video_url = video_url['href'] @@ -70,9 +94,7 @@ def lordchannel(imdb): else: tmdba = imdb_id showname,date = get_info_tmdb(tmdba,ismovie,type) - showname = showname.replace(" ", "+").replace("–", "+").replace("—","+") - query = f'https://lordchannel.{LC_DOMAIN}/cerca/?q={showname}' - video_url,quality = search(query,date,season,episode,ismovie) + video_url,quality = search(showname,date,season,episode,ismovie) url = get_m3u8(video_url) url = url.replace('"','') print(url)