Spaces:
Build error
Build error
juancopi81
commited on
Commit
•
d5c9693
1
Parent(s):
195e557
Add file path to audio
Browse files- app.py +1 -0
- youtubeaudioextractor.py +6 -8
app.py
CHANGED
@@ -59,6 +59,7 @@ def datapipeline(url: str) -> Any:
|
|
59 |
json_scenes = text_processor.get_json_scenes(transcribed_text)
|
60 |
print("Scenes ready")
|
61 |
video = video_creator.create_video(json_scenes)
|
|
|
62 |
return video, video
|
63 |
|
64 |
css = """
|
|
|
59 |
json_scenes = text_processor.get_json_scenes(transcribed_text)
|
60 |
print("Scenes ready")
|
61 |
video = video_creator.create_video(json_scenes)
|
62 |
+
print("Video at", video)
|
63 |
return video, video
|
64 |
|
65 |
css = """
|
youtubeaudioextractor.py
CHANGED
@@ -11,15 +11,13 @@ class YouTubeAudioExtractor(ABC):
|
|
11 |
class PytubeAudioExtractor(YouTubeAudioExtractor):
|
12 |
|
13 |
def __init__(self,
|
14 |
-
only_audio: bool = True
|
15 |
-
extension: str = ".mp3") -> None:
|
16 |
self.only_audio = only_audio
|
17 |
-
self.extension = extension
|
18 |
|
19 |
-
def extract(self,
|
20 |
-
|
|
|
21 |
yt = pt.YouTube(url)
|
22 |
stream = yt.streams.filter(only_audio=self.only_audio)[0]
|
23 |
-
filename
|
24 |
-
|
25 |
-
return filename
|
|
|
11 |
class PytubeAudioExtractor(YouTubeAudioExtractor):
|
12 |
|
13 |
def __init__(self,
|
14 |
+
only_audio: bool = True) -> None:
|
|
|
15 |
self.only_audio = only_audio
|
|
|
16 |
|
17 |
+
def extract(self,
|
18 |
+
url: str,
|
19 |
+
save_path: str = "yt_audio.mp3") -> str:
|
20 |
yt = pt.YouTube(url)
|
21 |
stream = yt.streams.filter(only_audio=self.only_audio)[0]
|
22 |
+
stream.download(filename=save_path)
|
23 |
+
return "yt_audio.mp3"
|
|