server code used for RabbitTube app (app for downloading and searching youtube videos as songs)
Server used for RabbitTube app (app for downloading and searching youtube videos as songs)
- Python3
- aiohttp
- youtube-dl
- aria2c
Method: POST
Path: '/search/songs'
Body:
{
"query": "SOME_QUERY_STRING"
}
Assuming the request is valid, the server response will be:
{
"prevPageToken":null,
"items":[
{
"thumbnails":{
"high":{
"url":"https://i.ytimg.com/vi/vhMlaCdlLbc/mqdefault.jpg",
"height":180,
"width":320
},
"default":{
"url":"https://i.ytimg.com/vi/vhMlaCdlLbc/mqdefault.jpg",
"height":180,
"width":320
}
},
"title":"Khesari Lal Yadav - Bandhan - Bhojpuri Songs 2015 new",
"videoID":"vhMlaCdlLbc",
"channelTitle":"Wave Music",
"description":"Subscribe Now:- http://goo.gl/ip2lbk..."
},
{...},
{...},
...
]
}
Request:
Method: POST
Path: '/download/song'
Body:
{
"url": "VALID_YOUTUBE_VIDEO_URL"
}
Response:
The server will respond with either the mp3 file or an error message.
In case of an error message the Content-Type header will be application/json
and for success it will be audio/mpeg
.