added response

This commit is contained in:
TylerCG 2025-04-20 10:59:39 -04:00
parent 819bcedd31
commit abc74fb307

View File

@ -78,27 +78,30 @@ class dropout():
def series(): def series():
json_data=[] json_data=[]
page_html=requests.get('https://www.dropout.tv/series') try:
# If you want to parse the HTML page_html=requests.get('https://www.dropout.tv/series')
soup = BeautifulSoup(page_html.text, 'html.parser') # If you want to parse the HTML
# Example: Find all elements with a specific class soup = BeautifulSoup(page_html.text, 'html.parser')
elements = soup.find_all(class_='browse-item-link') # Example: Find all elements with a specific class
# Extract URLs from href attributes elements = soup.find_all(class_='browse-item-link')
urls = [element['href'] for element in elements if 'href' in element.attrs] # Extract URLs from href attributes
urls = [element['href'] for element in elements if 'href' in element.attrs]
for url in urls: for url in urls:
info_data={} info_data={}
name=url.replace('https://www.dropout.tv/','').replace('-s-',"'s-").replace('-',' ').title().replace('Of','of').replace("'S","'s") name=url.replace('https://www.dropout.tv/','').replace('-s-',"'s-").replace('-',' ').title().replace('Of','of').replace("'S","'s")
info_data['SHOW'] = name info_data['SHOW'] = name
info_data['URL'] = url info_data['URL'] = url
info_data['SEASONS'] = grab.season(url) info_data['SEASONS'] = grab.season(url)
json_data.append(info_data) json_data.append(info_data)
# Sort the json_data by the 'SHOW' key # Sort the json_data by the 'SHOW' key
sorted_json_data = sorted(json_data, key=lambda x: x['SHOW']) sorted_json_data = sorted(json_data, key=lambda x: x['SHOW'])
with open('/data/dropout.json', 'w') as json_file:
with open('/data/dropout.json', 'w') as json_file: json.dump(sorted_json_data, json_file, indent=4)
json.dump(sorted_json_data, json_file, indent=4) return JSONResponse(status_code=200, content={"status": "success", "message": "Series information gather successfully."})
except Exception as e:
return JSONResponse(status_code=500, content={"status": "error", "message": str(e)})
class youtube(): class youtube():
def ydl(url, location): def ydl(url, location):