Skip to content

Instantly share code, notes, and snippets.

Created December 8, 2020 05:39
What would you like to do?
from pytube import YouTube
import pytube
import os
def main():
video_url = input('Enter YouTube video URL: ')
if == 'nt':
path = os.getcwd() + '\\'
path = os.getcwd() + '/'
name = pytube.extract.video_id(video_url)
location = path + name + '.mp4'
renametomp3 = path + name + '.mp3'
if == 'nt':
os.system('ren {0} {1}'. format(location, renametomp3))
os.system('mv {0} {1}'. format(location, renametomp3))
if __name__ == '__main__':
Copy link

weeblip commented May 17, 2021

I am facing an error. I followed everything precisely and when i enter the url in the 'Enter YouTube video URL' tab it shows 'The syntax of the command is incorrect.' as an error. any solutions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment