Skip to content

Instantly share code, notes, and snippets.

@kellenmace
Last active September 20, 2024 03:43
Show Gist options
  • Save kellenmace/8e232d186cdea6eac04635dfba3d2660 to your computer and use it in GitHub Desktop.
Save kellenmace/8e232d186cdea6eac04635dfba3d2660 to your computer and use it in GitHub Desktop.
import { Innertube, Platform } from "youtubei.js";
import axios from 'axios';
import { HttpsProxyAgent } from 'https-proxy-agent';
const proxyAgent = new HttpsProxyAgent(
`http://${SMARTPROXY_USERNAME}:${SMARTPROXY_PASSWORD}@gate.smartproxy.com:10001`
);
const youtube = await Innertube.create({
lang: "en",
location: "US",
fetch: async (input: RequestInfo | URL, init?: RequestInit) => {
return axios.get(input, {
// Make use of `init` here
httpsAgent: proxyAgent
});
},
});
const info = await youtube.getInfo("NhHi0OjHUMQ");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment