Update app.py
Browse files
app.py
CHANGED
@@ -248,6 +248,25 @@ async def get_track_download_url(video_url: str) -> str:
|
|
248 |
return {"error": "Download URL not found"}
|
249 |
|
250 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
251 |
|
252 |
@app.post("/maxs")
|
253 |
async def download_high_quality_video(request: Request):
|
|
|
248 |
return {"error": "Download URL not found"}
|
249 |
|
250 |
|
251 |
+
async def extract_video_info(video_url: str) -> str:
|
252 |
+
api_url = f'https://yt-dl-web.vercel.app/api/info?url={video_url}'
|
253 |
+
session = cloudscraper.create_scraper()
|
254 |
+
response = session.get(api_url, timeout=20)
|
255 |
+
if "url" in response:
|
256 |
+
json_response = response.json()
|
257 |
+
return json_response
|
258 |
+
else:
|
259 |
+
return {"error": "Download URL not found"}
|
260 |
+
|
261 |
+
|
262 |
+
@app.post("/test")
|
263 |
+
async def test_download(request: Request):
|
264 |
+
data = await request.json()
|
265 |
+
video_url = data.get('url')
|
266 |
+
response = await extract_video_info(video_url)
|
267 |
+
return response
|
268 |
+
|
269 |
+
|
270 |
|
271 |
@app.post("/maxs")
|
272 |
async def download_high_quality_video(request: Request):
|