sudo apt install youtube-dl ffmpeg
Then download a portion of your desired YouTube Video with the following command:
-ss 00:15 --> skip first 15 seconds of video
-t 00:45 --> record for 45 seconds
ffmpeg $(youtube-dl -g 'https://www.youtube.com/watch?v=oHg5SJYRHA0' | sed "s/.*/-ss 00:15 -i &/") -t 00:45 -c copy video.mkv