Update app.py
Browse files
app.py
CHANGED
@@ -117,11 +117,15 @@ async def match():
|
|
117 |
title = track_info["entitiesByUniqueId"][entityUniqueId]["title"]
|
118 |
search_results = ytmusic.search(title, filter="songs")
|
119 |
first_song = next((song for song in search_results if 'videoId' in song and song['videoId']), {}) if search_results else {}
|
120 |
-
|
121 |
-
|
|
|
|
|
122 |
# If no URLs found, return an error
|
123 |
raise HTTPException(status_code=404, detail="No matching URL found")
|
124 |
|
|
|
|
|
125 |
class ApiRotator:
|
126 |
def __init__(self, apis):
|
127 |
self.apis = apis
|
|
|
117 |
title = track_info["entitiesByUniqueId"][entityUniqueId]["title"]
|
118 |
search_results = ytmusic.search(title, filter="songs")
|
119 |
first_song = next((song for song in search_results if 'videoId' in song and song['videoId']), {}) if search_results else {}
|
120 |
+
videoId = first_song["videoId"]
|
121 |
+
ym_url = f'https://www.youtube.com/watch?v={videoId}'
|
122 |
+
return {"filename": {title}, "url": ym_url}
|
123 |
+
|
124 |
# If no URLs found, return an error
|
125 |
raise HTTPException(status_code=404, detail="No matching URL found")
|
126 |
|
127 |
+
|
128 |
+
|
129 |
class ApiRotator:
|
130 |
def __init__(self, apis):
|
131 |
self.apis = apis
|