-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathyoutube_download.py
58 lines (48 loc) · 2.35 KB
/
youtube_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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
from pytube import YouTube
from time import sleep
import os
# test link = https://www.youtube.com/watch?v=kyM_wPi99Ms
######################
print("---------------------------------------------------------------------")
print(f"author = Kamesh(Hack-505)")
print("GitHub link = https://github.com/hack505")
print("test link of youtube = https://www.youtube.com/watch?v=kyM_wPi99Ms ")
print("---------------------------------------------------------------------")
######################
print(" ")
link = input("Enter th Link:")
loc = f""
path = input("Do you want to change the download path (y/n):")
if path == "y":
location = input("Paste the path to download:")
sleep(1)
print(f"{loc}----------{location}----------")
else:
location = f"downloads_file"
print(f"{loc}---------{location}-----------")
yt = YouTube(link)
print("-----------------------------------------------------------------------------------------------------")
print('Title:', yt.title)
print("-----------------------------------------------------------------------------------------------------")
print('Number of View:', yt.views)
print("-----------------------------------------------------------------------------------------------------")
print('Length of Video:', yt.length)
print("-----------------------------------------------------------------------------------------------------")
print('Description:', yt.description)
print("-----------------------------------------------------------------------------------------------------")
print('Rating:', yt.rating)
print("-----------------------------------------------------------------------------------------------------")
print(yt.streams)
print("-----------------------------------------------------------------------------------------------------")
print(yt.streams.filter(only_audio=True))
print("-----------------------------------------------------------------------------------------------------")
print(yt.streams.filter(only_video=True))
print("-----------------------------------------------------------------------------------------------------")
print(yt.streams.filter(progressive=True))
ys = yt.streams.get_highest_resolution()
ys = yt.streams.get_by_itag('22')
ys.download(f"{location}")
print("..............Download Completed..............")
print(f"file = {location}\{yt.title}.mp4")
print("Thank you.............")
os.system("pause")