How to write a python script for downloading a video from YouTube and saving it to a directory?

0 votes
I want to download a video from YouTube using a python script and save it to a particular location. How do I do it?
Sep 4 in Python by Arvind
• 2,960 points
477 views

1 answer to this question.

0 votes

First download pytube using the following code 

pip install pytube

Then download the video using the following

from pytube import YouTube
yt = YouTube("https://www.youtube.com/watch?v=n06H7OcPd-g")
yt = yt.get('mp4','720p')
yt.download('/path/to/download/directory')
answered Sep 4 by Neel
• 3,010 points

Related Questions In Python

0 votes
1 answer
0 votes
1 answer

How to create and read from a temporary file in Python?

Hi, there is a very simple solution ...READ MORE

answered Jan 29 in Python by Nymeria
• 3,520 points
100 views
0 votes
3 answers
0 votes
1 answer
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6 in Python by Neha
• 330 points

edited Jul 8 by Kalgi 405 views
+4 votes
6 answers
0 votes
1 answer

Is it possible to print all the modules imported in a python script?

Since I am using Python 3.6, I ...READ MORE

answered Jul 3 in Python by Neel
• 3,010 points
39 views
0 votes
1 answer

Is it possible to print a string and a variable in a single print statement in Python?

This can be done using simple string ...READ MORE

answered Jul 15 in Python by Neel
• 3,010 points
39 views