2023-12-10 22:33:56 -05:00
2023-12-07 01:00:01 -08:00
2023-12-07 01:00:01 -08:00
bug
2023-12-10 22:33:56 -05:00
2023-12-10 02:01:30 -05:00
2023-12-07 01:00:01 -08:00
2023-12-08 23:30:43 -08:00
2023-12-08 23:30:43 -08:00
2023-12-09 00:53:13 -08:00
2023-12-08 23:30:43 -08:00
v2
2023-12-08 03:11:40 -08:00
2023-12-10 02:01:30 -05:00

Endpoints

Required query parameters

  • pool: id of the VRCUrl pool, only letters numbers hyphens or underscores, optionally followed by an integer for pool size.
  • input: youtube search query. All chars up to and including this exact unicode char are ignored, and then whitespace is trimmed.

Optional query parameters

  • thumbnails: set to 1, true, yes, on or whatever to load thumbnails
  • icons: set to 1, true, yes, on or whatever to load channel icons

Example URL

https://api.u2b.cx/search?pool=example10000&input=   Type YouTube search query here →                       penile apparatus

Response format

JSON object:

  • results: Array of Object
    • vrcurl: (integer) index of VRCUrl that will redirect to the youtube url
    • title: (string)
    • id: (string) YouTube video id
    • duration: (string) video length i.e. "3:03"
    • durationString: (string) DEPRECATED, same as duration
    • uploaded: (string) when the video was uploaded i.e. "12 years ago"
    • views: (integer)
    • channel: (object)
      • name: (string)
      • id: (string)
      • icon_index?: (string) The index of the channel icon in the image sheet. because it is deduplicated, it is not one-to-one
  • imagesheet_vrcurl?: (integer) index of the vrcurl for the collage of thumbnails and/or icons
  • nextpage_vrcurl: (integer) index of the vrcurl that will serve the JSON for the next page of results

GET /vrcurl/{pool}/{index}

  • {pool}: must be same as pool param in search endpoint.
  • {index}: vrcurl index number

Response may be 302 redirect to youtube url, image/jpeg for imagesheet or application/json for next page

VRCUrls

Since VRCUrls are immutable you must create a pool of them which the server will correspond with to receive user selections. Create an array of 10,000 VRCUrls like so:

VRCUrl[] vrcurl_pool = [
	new VRCUrl("https://api.u2b.cx/vrcurl/{pool}/0"),
	new VRCUrl("https://api.u2b.cx/vrcurl/{pool}/1"),
	new VRCUrl("https://api.u2b.cx/vrcurl/{pool}/2"),
	// etc...
]
//todo: provide tool to auto generate

{pool} must be a unique string in the format ^[a-z-_]+\d*$. You can specify the pool size by suffixing with an integer, or else the default is 10,000.

All resources (youtube urls etc) referenced in the search results will be substituted by an integer that is the index of the VRCUrl in this array that will serve the resource.

Imagesheet

Video thumbnails and channel icons are collated together into one image and served at a VRCUrl to be loaded by VRCImageDownloader.

Thumbnails are 360x202, arranged vertically in the same order as the JSON results.

Channel icons are 68x68 arranged vertically on the right of thumbnails.

Description
API server for building YouTube search UIs in VRChat
https://api.u2b.cx/ Readme 476 KiB
Languages
JavaScript 91.2%
HTML 8.8%