Skip to content

Update CliYoutubeDownloader.py #2286

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions CliYoutubeDownloader/CliYoutubeDownloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class YouTubeDownloder:
def __init__(self):
self.url = str(input("Enter the url of video : "))
self.url = str(input("Enter the URL of video : "))
self.youtube = pytube.YouTube(
self.url, on_progress_callback=YouTubeDownloder.onProgress
)
Expand All @@ -28,14 +28,14 @@ def showStreams(self):
self.chooseStream()

def chooseStream(self):
self.choose = int(input("please select one : "))
self.choose = int(input("Please select one : "))
self.validateChooseValue()

def validateChooseValue(self):
if self.choose in range(1, self.streamNo):
self.getStream()
else:
print("please enter a correct option on the list.")
print("Please enter a correct option on the list.")
self.chooseStream()

def getStream(self):
Expand All @@ -49,15 +49,15 @@ def getFileSize(self):

def getPermisionToContinue(self):
print(
"\n title : {0} \n author : {1} \n size : {2:.2f}MB \n resolution : {3} \n fps : {4} \n ".format(
"\n Title : {0} \n Author : {1} \n Size : {2:.2f}MB \n Resolution : {3} \n FPS : {4} \n ".format(
self.youtube.title,
self.youtube.author,
file_size,
self.stream.resolution,
self.stream.fps,
)
)
if input("do you want it ?(defualt = (y)es) or (n)o ") == "n":
if input("Do you want it ?(default = (y)es) or (n)o ") == "n":
self.showStreams()
else:
self.main()
Expand All @@ -69,7 +69,7 @@ def download(self):
def onProgress(stream=None, chunk=None, remaining=None):
file_downloaded = file_size - (remaining / 1000000)
print(
f"downloading ... {file_downloaded/file_size*100:0.2f} % [{file_downloaded:.1f}MB of {file_size:.1f}MB]",
f"Downloading ... {file_downloaded/file_size*100:0.2f} % [{file_downloaded:.1f}MB of {file_size:.1f}MB]",
end="\r",
)

Expand Down
Loading