This commit is contained in:
TylerCG 2025-04-20 11:19:11 -04:00
parent 4640a5b57c
commit fa6f7fb436
2 changed files with 23 additions and 23 deletions

View File

@ -78,7 +78,6 @@ class dropout():
def series(): def series():
json_data=[] json_data=[]
try:
page_html=requests.get('https://www.dropout.tv/series') page_html=requests.get('https://www.dropout.tv/series')
# If you want to parse the HTML # If you want to parse the HTML
soup = BeautifulSoup(page_html.text, 'html.parser') soup = BeautifulSoup(page_html.text, 'html.parser')
@ -99,9 +98,6 @@ class dropout():
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):

View File

@ -19,7 +19,11 @@ templates = Jinja2Templates(directory="/app/templates")
# api # api
@app.get("/dropoutUpdate") @app.get("/dropoutUpdate")
async def dropoutUpdate(): async def dropoutUpdate():
return await run_in_threadpool(download.dropout.series()) try:
download.dropout.series()
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)})
@app.get("/dropoutSeries", response_class=JSONResponse) @app.get("/dropoutSeries", response_class=JSONResponse)
async def dropoutSeries(): async def dropoutSeries():