Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
from pathlib import Path
|
2 |
import subprocess
|
3 |
-
from re import compile, findall
|
4 |
from time import sleep
|
5 |
from typing import Literal
|
6 |
from urllib.parse import quote_plus
|
@@ -43,7 +43,7 @@ def download_yt_audio_api(youtube_id: str) -> Path:
|
|
43 |
response = client.get(api_response_url)
|
44 |
response.raise_for_status()
|
45 |
data = response.json()
|
46 |
-
file_name = data['info']['title'].replace(' ', '_')
|
47 |
video_id = data.get('id')
|
48 |
if not video_id:
|
49 |
raise ValueError("ошибка на стороне апи!")
|
|
|
1 |
from pathlib import Path
|
2 |
import subprocess
|
3 |
+
from re import compile, findall, sub
|
4 |
from time import sleep
|
5 |
from typing import Literal
|
6 |
from urllib.parse import quote_plus
|
|
|
43 |
response = client.get(api_response_url)
|
44 |
response.raise_for_status()
|
45 |
data = response.json()
|
46 |
+
file_name = sub(r'[^A-Za-zА-Яа-я_]', '', data['info']['title'].replace(' ', '_'))
|
47 |
video_id = data.get('id')
|
48 |
if not video_id:
|
49 |
raise ValueError("ошибка на стороне апи!")
|