Created
June 28, 2023 07:15
-
-
Save asvechkar/2089d779336ce024addf63af6c870d73 to your computer and use it in GitHub Desktop.
Загружать видео с Youtube
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pip install pytube | |
from pytube import YouTube | |
# Specify the URL of the YouTube video | |
video_url = "https://www.youtube.com/watch?v=dQw4w9WgXcQ" | |
# Create a YouTube object | |
yt = YouTube(video_url) | |
# Select the highest resolution stream | |
stream = yt.streams.get_highest_resolution() | |
# Define the output path for the downloaded video | |
output_path = "path/to/output/directory/" | |
# Download the video | |
stream.download(output_path) | |
print("Video downloaded successfully!") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment