Skip to content
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
14 changes: 10 additions & 4 deletions pytube_YoutubeDownload.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,31 @@
# Import both the OS and YouTube Module
import os
from pytube import YouTube

# Print the current directory of the path
print(os.getcwd())

# Create a variable for raw string of the directory where to store the file/video
download_Dir = r"C:\Users\admin\Downloads"

# dirct = input("Please put the directory here: ")
# Check if the current directory is the directory to download the file

if os.getcwd() != download_Dir:

# Change the directory to where the file/video will be downloaded to
os.chdir(download_Dir)
print(os.getcwd())

# Create variable for the URL link
urlLink = input("Please paste your URL link here: ")

# Instantiate the YouTube class to get the URL link
y = YouTube(urlLink)

adapt = y.streams.filter(adaptive=True)

# Create a variable to for the highest resolution
dwn = y.streams.get_highest_resolution()

# Download the video/file
dwn.download()

# Print the message of the successful download
print(f"{dwn.title} download successfully and completed")