-
Prerequisites
- Have
node
installed. - Have MongoDB and Memcached installed locally.
- Optional: Download MongoDB Compass to access your database with a GUI.
- Have a Google Cloud Project API Key with Youtube API enabled.
- Setup some channels first before starting.
- Have
-
Installation
# Install dependencies and create your .env copy
$ npm i
$ cp .env.sample .env
# Make sure to adjust your .env file before continuing!
# Check the template.json file inside the channels folder first! Then run:
$ npm run init
# If all things went well, you can then start the api.
$ npm start
any[]
are queries split with,
.- Example:
status=live,upcoming
- Example:
- Add queries by adding parameters to GET requests.
- Example using
node-js
withaxios
:
- Example using
const axios = require('axios');
const parameters = { status: 'live,upcoming', title: 'apex' };
axios.get('http://localhost:2434/live', { params: parameters })
.then(res => console.log(res.data));
- Access nested
fields
query with.
or()
.- Example:
const singleFields = { id: 1, fields: 'id,channel_stats.views,channel_stats.subscribers' };
const multipleFields = { id: 1, fields: 'id,channel_stats(views,subscribers)' };
const eitherFields = { id: 1, fields: 'id,channel_stats(views),channel_stats.subscribers' }
/**
* Any of these queries will return:
* [
* {
* id: 1,
* channel_stats: {
* views: number,
* subscribers: number
* }
* }
* ]
*/
Displays live, upcoming, and ended videos.
{
"status": "string[]",
"title": "string",
"group": "string"
}
{
"live": "object[]",
"upcoming": "object[]",
"ended": "object[]"
}
{
"id": "string",
"title": "string",
"channel": "string",
"group": "string",
"published_at": "number",
"scheduled_time": "number",
"start_time": "number",
"end_time": "number",
"length": "number",
"viewers": "number",
"status": "string"
}
Shows a list of all channels (Max 150).
{
"id": "number[]",
"name": "string",
"group": "string",
"youtube": "string[]",
"channel": "string",
"fields": "string[]",
"limit": "number"
}
You can use number ranges for id
query, example:
// Any of these queries will return channels with ids from 1 to 5
const idArray = { id: '1,2,3,4,5' };
const idRange = { id: '1-5' };
const idBoth = { id: '1,2,3-5' };
[
{
"id": "number",
"name_jp": "string",
"name_en": "string",
"youtube": "string",
"twitter": "string",
"channel": "string",
"channel_stats": {
"published_at": "number",
"views": "number",
"subscribers": "number",
"videos": "number",
},
"description": "string",
"thumbnail": "string"
}
]
Shows a list of all videos (Max 100).
{
"group": "string[]",
"status": "string[]",
"channel": "string[]",
"title": "string",
"fields": "string[]",
"limit": "number"
}
[
{
"id": "string",
"title": "string",
"channel": "string",
"group": "string",
"published_at": "number",
"scheduled_time": "number",
"start_time": "number",
"end_time": "number",
"length": "number",
"status": "string"
}
]
- Add support for Bilibili channels(?)
- Sort queries
- API documentation
- Cooler name, maybe?