YouDown REST
is a small python's REST service for downloading a youtube videos. The service required python 3.7 or above. The service uses pytube and Flask python libraries.
pip install -r requirments.txt
python3 main.py
The /streams
endpoint receives as an argument JSON with an url
parameter referring to a YouTube video, for example:
{
'url': 'https://www.youtube.com/watch?v=_3EuiU1qdpE'
}
The response will be an array of JSON objects, each represent available video stream, and has the following fields:
itag
- iTag number (stream identification number)res
- Video resolutionmime_type
- MIME typefps
- FPS (or empty string)bitrate
- Bitrate, bpsacodec
- Audio codec namevcodec
- Video codecsprogressive
-True
if progressive coding was used, otherwiseFalse
file_size
- File size in bytestitle
- Video titletype
- Stream type (?)
The /download/XXX
endpoint is a link for downloading a video stream, for which was previously the request /streams
made. The XXX
in the link is a iTag
value of selected stream. This link can be used in the <a>
element, for example:
<a src="/download/1">Download stream #1</a>
<a src="/download/2">Download stream #2</a>
...