Spaces:
Runtime error
Runtime error
Commit
·
e9bae41
1
Parent(s):
c17f6fc
Update routes/ytApi/getPreview.py
Browse files
routes/ytApi/getPreview.py
CHANGED
|
@@ -15,8 +15,10 @@ def getPreview(request):
|
|
| 15 |
error_code = answer['ytdlp-code']
|
| 16 |
|
| 17 |
duration = helpers.getFromRequest(request, "duration")
|
| 18 |
-
try: duration = int(duration) if duration.isnumeric() and int(duration) <= 90 else 45
|
| 19 |
-
except
|
|
|
|
|
|
|
| 20 |
|
| 21 |
extension = helpers.getFromRequest(request, "extension")
|
| 22 |
if not extension: extension = "ogg"
|
|
|
|
| 15 |
error_code = answer['ytdlp-code']
|
| 16 |
|
| 17 |
duration = helpers.getFromRequest(request, "duration")
|
| 18 |
+
try: duration = int(duration) if ((isinstance(duration, str) and duration.isnumeric()) or isinstance(duration, int)) and int(duration) <= 90 else 45
|
| 19 |
+
except Exception as e:
|
| 20 |
+
print(e)
|
| 21 |
+
duration = 45
|
| 22 |
|
| 23 |
extension = helpers.getFromRequest(request, "extension")
|
| 24 |
if not extension: extension = "ogg"
|