Skip to content

Commit 99bc1d2

Browse files
committed
Enhanced the Outputs using tabulate.
1 parent 9c43b3b commit 99bc1d2

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,5 +161,6 @@ cython_debug/
161161

162162
.mp4
163163
.mp3
164+
test.py
164165
/vids
165166
/outputs

downloader.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,34 @@
11
from pytube import YouTube
22
import os
3+
from tabulate import tabulate
4+
5+
# Custom Modules
36
from modules import vidmerge
47

58

69
print(f"===============================\n Python YouTube Downloader v2.0\n===============================\n")
710

8-
videoURL = str(input("Enter Video Link : "))
9-
# videoURL = 'https://www.youtube.com/watch?v=mDTMBdYAjHI'
11+
# videoURL = str(input("Enter Video Link : "))
12+
print("\nLooking for Available Qualities..")
13+
videoURL = 'https://www.youtube.com/watch?v=mDTMBdYAjHI'
1014

1115
yt = YouTube(videoURL)
1216

1317
mediaPath = f"{os.getcwd()}/vids"
1418

19+
streamsData = []
20+
1521
# print("-------VIDEOS-------")
1622
for count, stream in enumerate(yt.streams.filter(only_video=True, mime_type="video/mp4"), start=1):
17-
print(f"{count}) Res: {stream.resolution} | Size:{stream.filesize_mb} mb")
23+
# print(f"{count}. Res: {stream.resolution} | Size:{stream.filesize_mb} mb")
1824
# print(stream)
25+
streamsData.append([count, stream.resolution, stream.filesize_mb])
26+
27+
streamsDataTable = tabulate(streamsData, headers=["No", "Resolution", "Size (MB)"], tablefmt='rounded_outline')
28+
# Print the Table of Stream Data
29+
print(streamsDataTable)
1930

20-
userInput = input(str("Enter Res: "))
31+
userInput = input(str("Enter the Res Number: "))
2132

2233
for stream in yt.streams.filter(only_video=True, mime_type="video/mp4", res=userInput):
2334
stream.download(filename=f"{yt.title}.mp4", output_path=mediaPath)

0 commit comments

Comments
 (0)