File tree Expand file tree Collapse file tree 3 files changed +8
-1
lines changed Expand file tree Collapse file tree 3 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ DISCORD_DEV_TOKEN='YOUR_DISCORD_DEV_TOKEN'
88
99# YouTube API Key
1010YOUTUBE_API_KEY = ' YOUR_YOUTUBE_API_KEY'
11+ YOUTUBE_INNERTUBE_PROXY_URL = ' YOUR_OPTIONAL_YOUTUBE_INNERTUBE_PROXY_URL'
1112
1213# Twitch
1314TWITCH_CLIENT_ID = ' YOUR_TWITCH_CLIENT_ID'
Original file line number Diff line number Diff line change 11// FILL IN THIS INFORMATION IN .ENV
22export const runningInDevMode : boolean = process . argv . includes ( "--dev" ) ;
33export interface Config {
4+ youtubeInnertubeProxyUrl : string | null ;
45 updateIntervalYouTube : number ;
56 updateIntervalTwitch : number ;
67 databaseUrl : string | undefined ;
@@ -10,6 +11,7 @@ export interface Config {
1011}
1112
1213export const config : Config = {
14+ youtubeInnertubeProxyUrl : process . env ?. YOUTUBE_INNERTUBE_PROXY_URL ?? null ,
1315 updateIntervalYouTube : process . env ?. CONFIG_UPDATE_INTERVAL_YOUTUBE
1416 ? parseInt ( process . env ?. CONFIG_UPDATE_INTERVAL_YOUTUBE ) * 1000
1517 : 60_000 ,
Original file line number Diff line number Diff line change 1+ import { config } from "../../config" ;
12import type { InnertubeSearchRequest } from "../../types/youtube" ;
23
34import formatLargeNumber from "../formatLargeNumber" ;
45
56export default async function ( query : string ) {
67 try {
8+ // This will NOT work without Bun due to proxy not being in NodeJS
9+ // Unfortunately theres no type for this that will make Typescript happy so this is a TODO: thing
710 const response = await fetch (
811 "https://www.youtube.com/youtubei/v1/search?prettyPrint=false" ,
912 {
13+ proxy : config . youtubeInnertubeProxyUrl ,
1014 headers : {
1115 "X-Goog-Fieldmask" :
1216 "contents.twoColumnSearchResultsRenderer.primaryContents.sectionListRenderer.contents.itemSectionRenderer.contents" ,
@@ -22,7 +26,7 @@ export default async function (query: string) {
2226 query : query ,
2327 } ) ,
2428 method : "POST" ,
25- } ,
29+ } as any ,
2630 ) ;
2731
2832 const data = (
You can’t perform that action at this time.
0 commit comments