#!/usr/bin/python3
# ===================================================================
# from: www.youtube.com/watch?v=vEQ8CXFWLZU
# 3 Python Automation Projects
# -------------------------------------------------------------------
# pip install pytube
# -------------------------------------------------------------------
# https://pytube.io/en/latest/
# ===================================================================
from pytube import YouTube
from sys import argv
pathOut = './videos'
## ---- video URL on command line
##link = argv[1]
##yt = YouTube(link)
## ---- Video URL builtin
link = 'www.youtube.com/watch?v=I5cFBi02O34'
yt = YouTube(link)
print(f'title: {yt.title}')
print(f'views: {yt.views}')
yd = yt.streams.get_highest_resolution()
yd.download(pathOut)