Switched YouTube backend to Innertube API

This commit is contained in:
Luxferre
2024-09-18 18:57:23 +03:00
parent 70aceaa006
commit e40807f4d7
7 changed files with 282 additions and 158 deletions
+5 -10
View File
@@ -26,7 +26,6 @@ Nevertheless, the following features are already implemented:
## Planned features
- Moving to OAuth 2.0 for YouTube
- "Deleted message" support for YouTube
- Automated Twitch chat badges output (global and channel-specific)
- Internal chat ranking system by username
@@ -147,8 +146,7 @@ The following fields in the `config.json` are specific to the Twitch internal ba
The following fields in the `config.json` are specific to the YouTube internal backend:
- `yt_backend_enabled`: whether or not the YouTube internal backend is turned on.
- `yt_api_root_url`: the API proxy root URL. Recommended to leave at `https://yt.lemnoslife.com/noKey` for now. This is a temporary field, it is subject to removal once the backend switches to using OAuth 2.0.
- `yt_api_poll_timeout`: the interval (in seconds) to poll the YouTube chat with. For now, it's recommended to set to at least 3 seconds to not overload the API proxy.
- `yt_api_poll_timeout`: the interval (in seconds) to poll the YouTube chat with.
- `yt_channel`: the YouTube channel that you want to receive messages from (needs to start with `@`). If only this field is specified and the channel has several live broadcasts running, the backend will fetch the first broadcast from the list.
- `yt_video_id`: an optional field that allows you to pass a particular broadcast video ID to get the live chat messages from. Overrides the `yt_channel` field.
@@ -176,8 +174,7 @@ Example `config.json` file:
"tw_nickname": "Suborg",
"tw_channel": "#foxyshadow",
"yt_backend_enabled": true,
"yt_api_root_url": "https://yt.lemnoslife.com/noKey",
"yt_api_poll_timeout": 3,
"yt_api_poll_timeout": 1,
"yt_channel": "@foxyshadow",
"oc_backend_enabled": true,
"oc_server": "https://streams.luxferre.top",
@@ -200,7 +197,7 @@ The following procedure needs to be only done once:
### Connecting YouTube internal backend
As of now, nothing needs to be done except setting the `yt_backend_enabled` field to `true` in `config.json`, but this section will change soon once the backend moves to OAuth 2.0.
As of now, nothing needs to be done except setting the `yt_backend_enabled` field to `true` in `config.json`, as well as setting `yt_api_poll_timeout` and the target channel.
### Connecting Owncast internal backend
@@ -276,11 +273,9 @@ Most chat badges are still ignored when rendering the messages.
### YouTube (internal)
Currently, the YouTube backend doesn't have OAuth 2.0 flow implemented as of yet. A single API key would consume the quota too quickly, so, right now, the backend uses [an unofficial Youtube API proxy](https://yt.lemnoslife.com/) which can and sometimes does have downtimes.
After thorough investigation with various methods (official API via keys and OAuth, unofficial YouTube Data API proxy), a decision was made to switch to the Innertube chat API. It seems to be the most stable and unsrestricted for the time being.
Rewriting the backend to support OAuth is one of the highest priorities.
Additionally, YouTube does not have its own chat emote API as of now, so the emote set is hardcoded in the `/webroot/img` directory and can become outdated over time.
Additionally, YouTube does not have its own chat emote API as of now, so the emote set is hardcoded in the `/webroot/img` directory and can become outdated over time. There is a plan to implement dynamic emore loading from the data inside the message text runs retrieved via the Innertube API.
### Owncast (internal)