feat: add support of cloudflare workers (#596)

This commit is contained in:
Ayoub
2024-03-31 14:37:06 +00:00
committed by GitHub
parent d589365ea2
commit 2029aec90d
8 changed files with 142 additions and 4 deletions

View File

@@ -0,0 +1,19 @@
import { Innertube } from "youtubei.js/cf-worker";
export interface Env {}
export default {
async fetch(
request: Request,
env: Env,
ctx: ExecutionContext
): Promise<Response> {
// cannot initialize Innertube in global scope as it makes fetch requests
const yt = await Innertube.create();
const video = await yt.getInfo("jNQXAC9IVRw");
console.log("Video title is", video.basic_info.title);
return new Response("Hello World!");
},
};