Download the maximum quality resolution videos on Youtube and all the captions available.
This code use pytube library to download youtube videos and their captions. However, there is a youtube limitation to download high quality video and audio codec's together in same file, then it's only possible to download audio and video (above 720p) separately. In this sense, this code can download both maximum quality video and audio files, merge them with ffmpeg and get all captions available. The output files are: merged file (in .mkv), audio file, video file and the captions (in .srt).
First, it's necessary to install pytube. If you are using Jupyter Notebook, just paste this code in cell:
pip install pytube3
You may need to install K-Lite Mega Codec Pack too.
In youtubeHQ.py, get the youtube video link and paste on:
VIDEO = 'https://www.youtube.com/watch?v=0xY06PT5JDE'
or, on command-prompt:
> python youtubeHQ.py YOUTUBE_LINK_HERE
After that, create the directory C:\videos\, because that's where the files will be saved. This can be changed in the code. If subtitles are available, they will be downloaded and saved in the same folder. Don't forget to put youtubeHQ.py and ffmpeg.exe in the same folder.