-
Notifications
You must be signed in to change notification settings - Fork 226
/
Copy pathutube_vdo_download.py
33 lines (25 loc) · 1005 Bytes
/
utube_vdo_download.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# from pytube import YouTube
# SAVE_PATH = "F:/Courses/"
# link="https://www.youtube.com/watch?v=M576WGiDBdQ"
# try:
# yt = YouTube(link)
# except:
# print("Connection Error")
# mp4files = yt.streams.filter(progressive=True, file_extension='mp4')
# # yt.streams.set_filename('Blockchain_python')
# d_video = yt.(mp4files[-1].extension,mp4files[-1].resolution)
# try:
# d_video.download(SAVE_PATH)
# except:
# print("Some Error!")
# print('Task Completed!')
from pytube import YouTube
import os
def downloadYouTube(videourl, path):
yt = YouTube(videourl)
yt = yt.streams.filter(progressive=True, file_extension='mp4').order_by('resolution').desc().first()
if not os.path.exists(path):
os.makedirs(path)
yt.download(path)
downloadYouTube('https://www.youtube.com/watch?v=zQ3zgFypzX4&list=PLgUwDviBIf0oE3gA41TKO2H5bHpPd7fzn&index=12', 'E:/Graph')
#https://www.youtube.com/watch?v=g1ruWGga_AM&list=PLLz6Bi1mIXhG7SJHsZjI42aKOLkLysjeZ&index=2