Update app.py
Browse files
app.py
CHANGED
@@ -88,12 +88,16 @@ def extract_track_info(entities_by_unique_id: dict, platform: str):
|
|
88 |
return entity["title"], entity["artistName"]
|
89 |
return None, None
|
90 |
|
91 |
-
|
92 |
-
url: str
|
93 |
|
94 |
@app.post("/match")
|
95 |
-
async def match(
|
96 |
-
|
|
|
|
|
|
|
|
|
|
|
97 |
|
98 |
if not track_url:
|
99 |
raise HTTPException(status_code=400, detail="No URL provided")
|
|
|
88 |
return entity["title"], entity["artistName"]
|
89 |
return None, None
|
90 |
|
91 |
+
|
|
|
92 |
|
93 |
@app.post("/match")
|
94 |
+
async def match(request: Request):
|
95 |
+
try:
|
96 |
+
data = await request.json()
|
97 |
+
except Exception as e:
|
98 |
+
logging.error(f"Error parsing JSON: {e}")
|
99 |
+
raise HTTPException(status_code=400, detail="Invalid JSON")
|
100 |
+
track_url = data.get('url')
|
101 |
|
102 |
if not track_url:
|
103 |
raise HTTPException(status_code=400, detail="No URL provided")
|