Skip to content
forked from Chooks22/vt-api

A Mongoose / GraphQL based API to serve VTuber information from multiple platforms.

License

Notifications You must be signed in to change notification settings

Suuringo/vt-api

 
 

Repository files navigation

VTuber API

A Mongoose / GraphQL based API to serve VTuber information from multiple platforms.

Development

  • Prerequisites:

Installation

# Install dependencies and create your .env copy
$ npm i
$ cp .env.sample .env
# Make sure to adjust your .env file before continuing!

# Create a directory called organizations inside channels, then move the files from
# channels/default to channels/organizations, or check the template.json file to see how to create your own list.

# After populating channels/organizations, run:
$ npm run channel-manager
# OR
$ npm run init

# If all things went well, you can then start the api.
$ npm start

GraphQL Schema

Types

{
  VideoId: string
  ChannelId: string
  PlatformId: "yt"|"bb"|"tt"
  VideoStatus: "live"|"upcoming"|"ended"|"uploaded"|"missing"
}

VideoObject Schema

{
  _id: VideoId!
  platform_id: PlatformId!
  channel_id: ChannelId!
  organization: string!
  title: string!
  time: {
    published: number
    scheduled: number
    start: number
    end: number
    duration: number
  }
  status: VideoStatus!
  viewers: number
}

ChannelObject Schema

{
  _id: number!
  name: {
    en: string!
    jp: string
    kr: string
    cn: string
  }!
  organization: string!
  platform_id: PlatformId!
  channel_name: string
  channel_id: ChannelId!
  details: {
    [key: string]: any
  }
  channel_stats: {
    published_at: number
    views: number
    subscribers: number
    videos: number
  }
  description: string
  thumbnail: string
}

Videos Resource

{
  items: [VideoObject]!
  next_page_token: String
}

Channels Resource

{
  items: [ChannelObject]!
  next_page_token: String
}

Live Query

{
  live(
    organizations: [String]
    platforms: [PlatformId]
    exclude_organizations: [String]
  ): [VideoObject]
}

Videos Query

{
  videos(
    channel_id: [ChannelId]
    status: [VideoStatus]
    organization: [String]
    platforms: [PlatformId]
    max_upcoming_mins: Int
    order_by: {
      published: asc|desc
      scheduled: asc|desc
      start: asc|desc
    }
    next_page_token: String
    limit: Int // 1-50
  ): VideosResource!
}

Channels Query

{
  channels(
    _id: [Int]
    name: String
    organizations: [String]
    platforms: [PlatformId]
    channel_id: [ChannelId]
    order_by: {
      _id: asc|desc
      published_at: asc|desc
      subscribers: asc|desc
    }
    next_page_token: String
    limit: Int // 1-50
  ): ChannelsResource!
}

TO-DOs

  • Implement twitch and bilibili apis
  • Better documentation

About

A Mongoose / GraphQL based API to serve VTuber information from multiple platforms.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 98.9%
  • Other 1.1%