|
1 | 1 | from pytube import YouTube |
2 | 2 | import os |
| 3 | +from tabulate import tabulate |
| 4 | + |
| 5 | +# Custom Modules |
3 | 6 | from modules import vidmerge |
4 | 7 |
|
5 | 8 |
|
6 | 9 | print(f"===============================\n Python YouTube Downloader v2.0\n===============================\n") |
7 | 10 |
|
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' |
10 | 14 |
|
11 | 15 | yt = YouTube(videoURL) |
12 | 16 |
|
13 | 17 | mediaPath = f"{os.getcwd()}/vids" |
14 | 18 |
|
| 19 | +streamsData = [] |
| 20 | + |
15 | 21 | # print("-------VIDEOS-------") |
16 | 22 | 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") |
18 | 24 | # 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) |
19 | 30 |
|
20 | | -userInput = input(str("Enter Res: ")) |
| 31 | +userInput = input(str("Enter the Res Number: ")) |
21 | 32 |
|
22 | 33 | for stream in yt.streams.filter(only_video=True, mime_type="video/mp4", res=userInput): |
23 | 34 | stream.download(filename=f"{yt.title}.mp4", output_path=mediaPath) |
|
0 commit comments