Update app.py
Browse files
app.py
CHANGED
@@ -12,7 +12,8 @@ from ctypes import ArgumentError
|
|
12 |
from html_helper import *
|
13 |
from model_helper import *
|
14 |
|
15 |
-
from pytube import YouTube
|
|
|
16 |
import torchaudio
|
17 |
import glob
|
18 |
import gradio as gr
|
@@ -67,8 +68,9 @@ def prepare_media(source_path_or_url: os.PathLike,
|
|
67 |
# Download from youtube
|
68 |
try:
|
69 |
# Try PyTube first
|
70 |
-
proxy_handler = {"http": "http://127.0.0.1:1087", "https":"http://127.0.0.1:1087"}
|
71 |
-
yt = YouTube(source_path_or_url, proxies=proxy_handler)
|
|
|
72 |
audio_stream = min(yt.streams.filter(only_audio=True), key=lambda s: s.bitrate)
|
73 |
mp4_file = audio_stream.download(output_path='downloaded') # ./downloaded
|
74 |
audio_file = mp4_file[:-3] + 'mp3'
|
|
|
12 |
from html_helper import *
|
13 |
from model_helper import *
|
14 |
|
15 |
+
# from pytube import YouTube
|
16 |
+
from pytubefix import YouTube
|
17 |
import torchaudio
|
18 |
import glob
|
19 |
import gradio as gr
|
|
|
68 |
# Download from youtube
|
69 |
try:
|
70 |
# Try PyTube first
|
71 |
+
# proxy_handler = {"http": "http://127.0.0.1:1087", "https":"http://127.0.0.1:1087"}
|
72 |
+
# yt = YouTube(source_path_or_url, proxies=proxy_handler)
|
73 |
+
yt = YouTube(source_path_or_url)
|
74 |
audio_stream = min(yt.streams.filter(only_audio=True), key=lambda s: s.bitrate)
|
75 |
mp4_file = audio_stream.download(output_path='downloaded') # ./downloaded
|
76 |
audio_file = mp4_file[:-3] + 'mp3'
|