Created
August 19, 2023 05:06
-
-
Save wise-bit/eb7e9f876ff35c8c6a098e241850768e to your computer and use it in GitHub Desktop.
yt_downloader
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
| # python3 -m pip install git+https://github.com/pytube/pytube | |
| import sys | |
| from pytube import YouTube, Playlist | |
| if __name__ == "__main__": | |
| path = "./files" | |
| if len(sys.argv) < 2: | |
| link = input("Enter link of video or playlist: ") | |
| else: | |
| link = sys.argv[1] | |
| if "playlist" in link: | |
| p = Playlist(link) | |
| try: | |
| print(f"Downloading: {p.title}") | |
| for video in p.videos: | |
| video.streams.get_audio_only().download(path) | |
| except: | |
| print("Playlist must be unlisted or public, not private!") | |
| else: | |
| YouTube(link).streams.get_audio_only().download(path) | |
| # yt.streams.filter(only_audio=True).get_highest_resolution() # , progressive=True) | |
| # yt.streams.filter(progressive=True, file_extension='mp4').order_by('resolution')[-1].download() | |
| # TEST: https://www.youtube.com/watch?v=Vj4Y1c-DSM0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment