File tree Expand file tree Collapse file tree 1 file changed +20
-6
lines changed
api/src/processing/services Expand file tree Collapse file tree 1 file changed +20
-6
lines changed Original file line number Diff line number Diff line change 11import HLS from "hls-parser" ;
22
3- import { fetch } from "undici" ;
4- import { Innertube , Session } from "youtubei.js" ;
3+ import { fetch , Request } from "undici" ;
4+ import { Innertube , Platform , Session } from "youtubei.js" ;
55
66import { env } from "../../config.js" ;
77import { getCookie } from "../cookie/manager.js" ;
@@ -206,10 +206,24 @@ export default async function (o) {
206206 let yt ;
207207 try {
208208 yt = await cloneInnertube (
209- ( input , init ) => fetch ( input , {
210- ...init ,
211- dispatcher : o . dispatcher
212- } ) ,
209+ ( input , init ) => {
210+ const url = typeof input === 'string'
211+ ? new URL ( input )
212+ : input instanceof URL
213+ ? input
214+ : new URL ( input . url ) ;
215+
216+ const request = new Request (
217+ url ,
218+ input instanceof Platform . shim . Request
219+ ? input : undefined
220+ ) ;
221+
222+ return fetch ( request , {
223+ ...init ,
224+ dispatcher : o . dispatcher
225+ } ) ;
226+ } ,
213227 useSession
214228 ) ;
215229 } catch ( e ) {
You can’t perform that action at this time.
0 commit comments