diff --git a/scripts/video_to_audio_converter/README.md b/scripts/video_to_audio_converter/README.md new file mode 100644 index 0000000..dae5cf2 --- /dev/null +++ b/scripts/video_to_audio_converter/README.md @@ -0,0 +1,5 @@ +Its basically use to convert any youtube video to audio form! + +Just you have to paste the url in video_url!! + +Thankx diff --git a/scripts/video_to_audio_converter/requirement.txt b/scripts/video_to_audio_converter/requirement.txt new file mode 100644 index 0000000..c9e6bda --- /dev/null +++ b/scripts/video_to_audio_converter/requirement.txt @@ -0,0 +1,3 @@ +import YouTube +import pytube +import os \ No newline at end of file diff --git a/scripts/video_to_audio_converter/video_to_audio.py b/scripts/video_to_audio_converter/video_to_audio.py new file mode 100644 index 0000000..ee05667 --- /dev/null +++ b/scripts/video_to_audio_converter/video_to_audio.py @@ -0,0 +1,24 @@ +from pytube import YouTube +import pytube +import os + +def main(): + video_url = input('Enter YouTube video URL: ') + + if os.name == 'nt': + path = os.getcwd() + '\\' + else: + path = os.getcwd() + '/' + + name = pytube.extract.video_id(video_url) + YouTube(video_url).streams.filter(only_audio=True).first().download(filename=name) + location = path + name + '.mp4' + renametomp3 = path + name + '.mp3' + + if os.name == 'nt': + os.system('ren {0} {1}'. format(location, renametomp3)) + else: + os.system('mv {0} {1}'. format(location, renametomp3)) + +if __name__ == '__main__': + main() \ No newline at end of file