Created
November 11, 2016 03:45
-
-
Save cooperpellaton/bdc011ff084b9636f798ba235a8bd392 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pytube import YouTube | |
import sys | |
import os | |
def get_video(): | |
yt_url = sys.argv = raw_input("Enter the video you want to download: ") | |
to_download = YouTube(yt_url) | |
print(to_download.filename) | |
print(to_download.get_videos()) | |
# Here we are just trying to download the most basic video which each upload should have. | |
video = to_download.get('mp4','360p') | |
# Check if the target directory exists. If not, make it. | |
if not os.path.exists('videos/'): | |
os.makedirs('videos/') | |
video.download('videos/') | |
sys.exit() | |
if __name__ == '__main__': | |
get_video() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Be sure that you do a
pip install pytube
before you run this.