API v1.
All responses will include these common fields -
| Term | Explanation |
|---|---|
status | HTTP status code. |
requestLocation | Location where request was made. |
developerMessage | Verbose for debugging. Set only if there is an error. |
userMessage | Error message for user. |
errorCode | Platform specific error code. |
Example -
{ "status": 200, "requestLocation": "/api/v1/g" }{ "status": 500, "requestLocation": "/api/v1/g", "developerMessage": "URLOpen: Timeout", "userMessage": "Server problem, please try again later.", "errorCode": "500-004" }-
* **Type**: `GET` * **Location**: `/api/v1/search` * **Parameters**: | Term | Explanation | |-----------|--------------| |`type`| Search query.| Example - ```json { "type": "Bass%20Rani" } ``` * **Response**: | Term | Explanation | |-----------|--------------| |`metadata`| Data about fetched data. <br/> `q`: Searched query.<br/> `count`: Numner of results returned.| |`results`| Actual result set contains a list of items with following attributes : <br/> `get_url`: URL to get song from.<br/> `title`: Title of video.<br/> `id`: Youtube ID of video.<br/> `length`: Length of video.<br/> `thumb`: Link to video thumbnail.<br/> `time`: Time since upload. e.g. `3 years ago`.<br/> `uploader`: Youtube uploader ID.<br/> `views`: View count for the video in comma separated number format.<br/> `description`: Video description as on Youtube.<br/> `suggest_url`: URL to get suggested songs from.| Example - ```json { "metadata": { "type": "Bass%20Rani", "count": 3 }, "results" : [ { "get_url": "/api/v1/g?url=fSRrZiQ8IiR1blBnZFE5W2tydSQuIiR2a3ZuZyQ8IiRQd2VuZ3tjIi8iRENVVSJUY3BrIi8iQ2NsYyJoZ2N2IkN4cGdndiJNand0b2siKGNvcj0iSXd0ayJJY3BpdXZjJH8=", "id": "slNebO7Yips", "length": "4:34", "thumb": "https://img.youtube.com/vi/slNebO7Yips/0.jpg", "time": "10 months ago", "title": "Nucleya - BASS Rani - Aaja feat Avneet Khurmi & Guri Gangsta", "uploader": "NUCLEYA", "views": "1,078,918", "description": "Some Description <strong>MAY</strong> contain HTML stuff", "suggest_url": "/api/v1/suggest?url=fSRrZiQ8IiR1blBnZFE5W2tydSQuIiR2a3ZuZyQ8IiRQd2VuZ3tjIi8iRENVVSJUY3BrIi8iQ2NsYyJoZ2N2IkN4cGdndiJNand0b2siKGNvcj0iSXd0ayJJY3BpdXZjJH8=" }, { "get_url": "/api/v1/g?url=fSRrZiQ8IiRmc1RJOFJbTXl6eSQuIiR2a3ZuZyQ8IiROY3dwaSJJY3ljZWpjIkh2IkN4cGdndiJNand0b2sifiJQV0VOR1tDIn4iRENVVSJUQ1BLIn4iSHdubiJDbmR3byR/", "id": "dqRG6PYKwxw", "length": "3:35", "thumb": "https://img.youtube.com/vi/dqRG6PYKwxw/0.jpg", "time": "10 months ago", "title": "Laung Gawacha Ft Avneet Khurmi | NUCLEYA | BASS RANI | Full Album", "uploader": "Lyrics Arena", "views": "575,811", "description": "Some Description <strong>MAY</strong> contain HTML stuff", "suggest_url": "/api/v1/suggest?url=fSRrZiQ8IiR1blBnZFE5W2tydSQuIiR2a3ZuZyQ8IiRQd2VuZ3tjIi8iRENVVSJUY3BrIi8iQ2NsYyJoZ2N2IkN4cGdndiJNand0b2siKGNvcj0iSXd0ayJJY3BpdXZjJH8=" }, { "get_url": "/api/v1/g?url=fSRrZiQ8IiR5bll1S0phZFdNVyQuIiR2a3ZuZyQ8IiRQV0VOR1tDIi8iQ0NMQyJ+IkRDVVUiVENQSyJ+IlFISEtFS0NOIkpTIkNXRktRIn4kfw==", "id": "wlWsIH_bUKU", "length": "4:35", "thumb": "https://img.youtube.com/vi/wlWsIH_bUKU/0.jpg", "time": "10 months ago", "title": "NUCLEYA - AAJA | BASS RANI | OFFICIAL HQ AUDIO |", "uploader": "Prasad Kedar", "views": "1,862,495", "description": "Some Description <strong>MAY</strong> contain HTML stuff", "suggest_url": "/api/v1/suggest?url=fSRrZiQ8IiR1blBnZFE5W2tydSQuIiR2a3ZuZyQ8IiRQd2VuZ3tjIi8iRENVVSJUY3BrIi8iQ2NsYyJoZ2N2IkN4cGdndiJNand0b2siKGNvcj0iSXd0ayJJY3BpdXZjJH8=" } ] } ``` -
* **Type**: `GET` * **Location**: `/api/v1/trending` * **Parameters**: | Term | Explanation | |------|--------------| |`number`| Max number of results to get in each playlist. Defaults to 25.| |`type`| Playlist type names separated by comma(s). Defaults to `popular`.| |`offset`| Number of items to skip before returning the results in each playlist. Defaults to 0. | * **Response** | Term | Explanation | |-----------|--------------| |`metadata`| Data about fetched data.<br/> `count`: Number of results returned.| |`results`| Actual result set contains a list of items with following attributes : <br/> `get_url`: URL to get song from.<br/> `id`: Youtube ID of video.<br/> `title`: Title of video.<br/> `length`: Length of video.<br/> `thumb`: Link to video thumbnail.<br/> `uploader`: Youtube uploader ID.<br/> `views`: View count for the video.<br/> `description`: Video description as on Youtube.<br/> `suggest_url`: URL to get suggested songs from.| Example - ```json { "metadata": { "count": "2", "type": "popular,indian", "offset": "1" }, "results" : { "popular": [ { "get_url": "/api/v1/g?url=fSRrZiQ8IiR1blBnZFE5W2tydSQuIiR2a3ZuZyQ8IiRQd2VuZ3tjIi8iRENVVSJUY3BrIi8iQ2NsYyJoZ2N2IkN4cGdndiJNand0b2siKGNvcj0iSXd0ayJJY3BpdXZjJH8=", "id": "slNebO7Yips", "length": "4:34", "thumb": "https://img.youtube.com/vi/slNebO7Yips/0.jpg", "title": "Nucleya - BASS Rani - Aaja feat Avneet Khurmi & Guri Gangsta", "uploader": "NUCLEYA", "views": "1,078,918", "description": "Some Description <strong>MAY</strong> contain HTML stuff", "suggest_url": "/api/v1/suggest?url=fSRrZiQ8IiR1blBnZFE5W2tydSQuIiR2a3ZuZyQ8IiRQd2VuZ3tjIi8iRENVVSJUY3BrIi8iQ2NsYyJoZ2N2IkN4cGdndiJNand0b2siKGNvcj0iSXd0ayJJY3BpdXZjJH8=" }, { "get_url": "/api/v1/g?url=fSRrZiQ8IiR1blBnZFE5W2tydSQuIiR2a3ZuZyQ8IiRQd2VuZ3tjIi8iRENVVSJUY3BrIi8iQ2NsYyJoZ2N2IkN4cGdndiJNand0b2siKGNvcj0iSXd0ayJJY3BpdXZjJH8=", "id": "slNebO7Yips", "length": "4:34", "thumb": "https://img.youtube.com/vi/slNebO7Yips/0.jpg", "title": "Nucleya - BASS Rani - Aaja feat Avneet Khurmi & Guri Gangsta", "uploader": "NUCLEYA", "views": "1,078,918", "description": "Some Description <strong>MAY</strong> contain HTML stuff", "suggest_url": "/api/v1/suggest?url=fSRrZiQ8IiR1blBnZFE5W2tydSQuIiR2a3ZuZyQ8IiRQd2VuZ3tjIi8iRENVVSJUY3BrIi8iQ2NsYyJoZ2N2IkN4cGdndiJNand0b2siKGNvcj0iSXd0ayJJY3BpdXZjJH8=" } ], "indian": [ { "get_url": "/api/v1/g?url=fSRrZiQ8IiRmc1RJOFJbTXl6eSQuIiR2a3ZuZyQ8IiROY3dwaSJJY3ljZWpjIkh2IkN4cGdndiJNand0b2sifiJQV0VOR1tDIn4iRENVVSJUQ1BLIn4iSHdubiJDbmR3byR/", "id": "dqRG6PYKwxw", "length": "3:35", "thumb": "https://img.youtube.com/vi/dqRG6PYKwxw/0.jpg", "title": "Laung Gawacha Ft Avneet Khurmi | NUCLEYA | BASS RANI | Full Album", "uploader": "Lyrics Arena", "views": "575,811", "description": "Some Description <strong>MAY</strong> contain HTML stuff", "suggest_url": "/api/v1/suggest?url=fSRrZiQ8IiR1blBnZFE5W2tydSQuIiR2a3ZuZyQ8IiRQd2VuZ3tjIi8iRENVVSJUY3BrIi8iQ2NsYyJoZ2N2IkN4cGdndiJNand0b2siKGNvcj0iSXd0ayJJY3BpdXZjJH8=" }, { "get_url": "/api/v1/g?url=fSRrZiQ8IiRmc1RJOFJbTXl6eSQuIiR2a3ZuZyQ8IiROY3dwaSJJY3ljZWpjIkh2IkN4cGdndiJNand0b2sifiJQV0VOR1tDIn4iRENVVSJUQ1BLIn4iSHdubiJDbmR3byR/", "id": "dqRG6PYKwxw", "length": "3:35", "thumb": "https://img.youtube.com/vi/dqRG6PYKwxw/0.jpg", "title": "Laung Gawacha Ft Avneet Khurmi | NUCLEYA | BASS RANI | Full Album", "uploader": "Lyrics Arena", "views": "575,811", "description": "Some Description <strong>MAY</strong> contain HTML stuff", "suggest_url": "/api/v1/suggest?url=fSRrZiQ8IiR1blBnZFE5W2tydSQuIiR2a3ZuZyQ8IiRQd2VuZ3tjIi8iRENVVSJUY3BrIi8iQ2NsYyJoZ2N2IkN4cGdndiJNand0b2siKGNvcj0iSXd0ayJJY3BpdXZjJH8=" } ] } } ``` -
* **Type**: `GET` * **Location**: `/api/v1/playlists` * **Response**: | Term | Explanation | |------|--------------| |`metadata`| Contains following term:<br/> `count`: Number of playlists.| |`results`| List containing following dictionary:<br/> `playlist`: Name of playlist<br/> `url`: Playlist URL on Youtube| Example - ```json { "metadata": { "count": "2" }, "results": [ { "playlist": "popular", "url": "https://www.youtube.com/playlist?list=PLFgquLnL59alCl_2TQvOiD5Vgm1hCaGSI" }, { "playlist": "latest", "url": "https://www.youtube.com/playlist?list=PLFgquLnL59akA2PflFpeQG9L01VFg90wS'" } ] } ```
- node.js
- Sequelize
- Mysql
> npm install > mysql -u root -p > create database your database name > sequelize db:migrate > node server.jssequelize db:seed --seed 20180606133445-youtube-playlist When deploy production initialize the APP_ENV prod
> APP_ENV = local >DB_HOST=127.0.0.1 >DB_DATABASE="" >DB_USERNAME="" >DB_PASSWORD="" >DB_PORT=3306 >DB_DRIVER=mysql >YOUTUBE_API_KEY="" >PRODUCTION_URL="" >DEVELOPMENT_URL=http://localhost::8080/