Update app.py
Browse files
app.py
CHANGED
@@ -65,7 +65,8 @@ def prepare_media(source_path_or_url: os.PathLike,
|
|
65 |
if source_type == 'audio_filepath':
|
66 |
audio_file = source_path_or_url
|
67 |
elif source_type == 'youtube_url':
|
68 |
-
|
|
|
69 |
audio_stream = min(yt.streams.filter(only_audio=True), key=lambda s: s.bitrate)
|
70 |
mp4_file = audio_stream.download(output_path='downloaded') # ./downloaded
|
71 |
audio_file = mp4_file[:-3] + 'mp3'
|
|
|
65 |
if source_type == 'audio_filepath':
|
66 |
audio_file = source_path_or_url
|
67 |
elif source_type == 'youtube_url':
|
68 |
+
proxy_handler = {"http": "http://127.0.0.1:1087", "https":"http://127.0.0.1:1087"}
|
69 |
+
yt = YouTube(source_path_or_url, proxies=proxy_handler) #use_oauth=True, allow_oauth_cache=False)
|
70 |
audio_stream = min(yt.streams.filter(only_audio=True), key=lambda s: s.bitrate)
|
71 |
mp4_file = audio_stream.download(output_path='downloaded') # ./downloaded
|
72 |
audio_file = mp4_file[:-3] + 'mp3'
|