This technique makes use of yt-dlp.
git clone https://github.com/ongsici/YT-AV-Downloader.git
conda create -n ytdownloader python=3.8 -y
conda activate ytdownloader
pip install -r requirements.txt
Youtube URL, start and end times should be included in the TXT file in the following format:
(URL) (start time in hh:mm:ss) (end time in hh:mm:ss)
Example:
https://www.youtube.com/watch?v=I_HxaUlUMTQ&t=1931s 00:32:00 00:32:08
https://www.youtube.com/watch?v=I_HxaUlUMTQ&t=1931s 00:32:10 00:32:18
-
Video Download:
python youtube_download.py -i youtube_example.txt -o LawrenceWong -t video
-
Audio Download:
python youtube_download.py -i youtube_example.txt -o LawrenceWong -t audio