Skip to content

Instantly share code, notes, and snippets.

@NataliaItani
Created September 10, 2023 18:27
Show Gist options
  • Save NataliaItani/7e0d2b2372c63c91e9acbb8520045412 to your computer and use it in GitHub Desktop.
Save NataliaItani/7e0d2b2372c63c91e9acbb8520045412 to your computer and use it in GitHub Desktop.
Youtube Downloader
import pytube
def download_video(url, save_path):
try:
# Create a YouTube object
yt = pytube.YouTube(url)
# Get the highest resolution stream
stream = yt.streams.get_highest_resolution()
# Download the video
stream.download(output_path=save_path)
print("Download completed successfully.")
except Exception as e:
print(f"An error occurred: {e}")
if __name__ == "__main__":
video_url = input("Enter the YouTube video URL: ")
save_location = input("Enter the directory to save the video: ")
download_video(video_url, save_location)
@NataliaItani
Copy link
Author

Thanks for the amazing list out. I really need it now. I liked this. If you are interested in look at our reliable blog

Welcome

@geekeie
Copy link

geekeie commented Nov 29, 2024

Woow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment