From 9d352b58eb1f10d70ee703e667fbeb09a2ed4adc Mon Sep 17 00:00:00 2001 From: Daniel Wykerd <45672955+Wykerd@users.noreply.github.com> Date: Fri, 17 Feb 2023 19:53:06 +0200 Subject: [PATCH] docs: update imports for platforms (#315) * docs: fix browser import * docs: add deno.land instructions As mentioned in issue #314 --- README.md | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index cd6db460..6b08ce16 100644 --- a/README.md +++ b/README.md @@ -112,7 +112,10 @@ yarn add youtubei.js@latest npm install github:LuanRT/YouTube.js ``` -**TODO:** Deno install instructions (deno.land) +When using Deno, you can import YouTube.js directly from deno.land: +```ts +import { Innertube } from 'https://deno.land/x/youtubei/deno.ts'; +``` ## Usage Create an InnerTube instance: @@ -128,8 +131,13 @@ To use YouTube.js in the browser you must proxy requests through your own server You may provide your own fetch implementation to be used by YouTube.js. Which we will use here to modify and send the requests through our proxy. See [`examples/browser/web`](https://github.com/LuanRT/YouTube.js/tree/main/examples/browser/web) for a simple example using [Vite](https://vitejs.dev/). ```ts -// Pre-bundled version for the web -import { Innertube } from 'youtubei.js/bundle/browser'; +// We provide multiple exports for the web. +// Unbundled ESM version +import { Innertube } from 'youtubei.js/web'; +// Bundled ESM version +// import { Innertube } from 'youtubei.js/web.bundle'; +// Production Bundled ESM version +// import { Innertube } from 'youtubei.js/web.bundle.min'; await Innertube.create({ fetch: async (input: RequestInfo | URL, init?: RequestInit) => { // Modify the request