mirror of
https://github.com/metafy-social/python-scripts.git
synced 2025-03-15 18:19:52 +00:00
video to audio converter
This commit is contained in:
parent
309a904dd3
commit
fd7789455c
5
scripts/video_to_audio_converter/README.md
Normal file
5
scripts/video_to_audio_converter/README.md
Normal file
@ -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
|
3
scripts/video_to_audio_converter/requirement.txt
Normal file
3
scripts/video_to_audio_converter/requirement.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
import YouTube
|
||||||
|
import pytube
|
||||||
|
import os
|
24
scripts/video_to_audio_converter/video_to_audio.py
Normal file
24
scripts/video_to_audio_converter/video_to_audio.py
Normal file
@ -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()
|
Loading…
x
Reference in New Issue
Block a user