aboutsummaryrefslogtreecommitdiffstats
path: root/src/model/youload_playlist.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/model/youload_playlist.py')
-rw-r--r--src/model/youload_playlist.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/model/youload_playlist.py b/src/model/youload_playlist.py
index 51f8758..1856c64 100644
--- a/src/model/youload_playlist.py
+++ b/src/model/youload_playlist.py
@@ -1,5 +1,5 @@
from pytube import Playlist
-from moviepy.editor import VideoFileClip
+import ffmpeg
import os
def make_alpha_numeric(string: str) -> str:
@@ -52,13 +52,11 @@ class YouLoadPlayList:
elif self.download_type == "mp3":
file_path = video.streams.first().download(output_path=self.folder_name, filename_prefix=filename_prefix)
- # Get video from mp4.
- video_audio = VideoFileClip(file_path)
-
- # Get mp3.
+ # To mp3.
file_path_mp3 = file_path[:-4] + ".mp3"
- video_audio.audio.write_audiofile(file_path_mp3)
+ ffmpeg.input(file_path).output(file_path_mp3).run()
+ # Remove mp4 file.
os.remove(file_path)
else:
video.streams.get_by_resolution(self.download_type).download(output_path=self.folder_name, filename_prefix=filename_prefix)