mirror of
https://github.com/yusufipk/YTChatHub.git
synced 2026-09-11 10:56:17 +00:00
initializing the files and the memory bank.
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"name": "backend",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"description": "YouTube chat poller and realtime bridge.",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"scripts": {
|
||||
"dev": "ts-node src/index.ts",
|
||||
"build": "tsc -p tsconfig.build.json",
|
||||
"start": "node dist/index.js",
|
||||
"lint": "eslint 'src/**/*.{ts,tsx}'"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { bootstrapInnertube, fetchChatBatch } from './ingestion/youtubei';
|
||||
|
||||
export async function startBackend() {
|
||||
console.log('Starting backend worker (youtubei ingestion pending).');
|
||||
const state = await bootstrapInnertube();
|
||||
console.log('Initial continuation state', state);
|
||||
await fetchChatBatch(state);
|
||||
}
|
||||
|
||||
if (require.main === module) {
|
||||
void startBackend();
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
export type ContinuationState = {
|
||||
token: string | null;
|
||||
apiKey?: string;
|
||||
};
|
||||
|
||||
export async function bootstrapInnertube(): Promise<ContinuationState> {
|
||||
// TODO: fetch initial visitor data and live chat continuation token via youtubei.js
|
||||
return { token: null };
|
||||
}
|
||||
|
||||
export async function fetchChatBatch(state: ContinuationState) {
|
||||
// TODO: use youtubei.js to fetch messages with the provided continuation token
|
||||
// return both normalized messages and the next continuation token
|
||||
return {
|
||||
messages: [],
|
||||
next: state.token
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"declaration": true,
|
||||
"emitDeclarationOnly": false
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "dist",
|
||||
"module": "CommonJS",
|
||||
"target": "ES2021",
|
||||
"noEmit": false
|
||||
},
|
||||
"include": ["src"]
|
||||
}
|
||||
Reference in New Issue
Block a user