Last active
September 20, 2024 03:43
-
-
Save kellenmace/8e232d186cdea6eac04635dfba3d2660 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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