File tree Expand file tree Collapse file tree 2 files changed +3
-3
lines changed Expand file tree Collapse file tree 2 files changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ export async function getVideo(request: IRequest) {
1212 }
1313
1414 const path = url . pathname . substring ( '/v' . length ) ;
15- const video = await get_packaged_video ( path ) ;
15+ const video = await get_packaged_video ( path , 5000 ) ;
1616 if ( video ) {
1717 const videoUrl = video . url ;
1818 const headers = { 'Location' : videoUrl , 'content-type' : 'text/html' } ;
Original file line number Diff line number Diff line change @@ -54,11 +54,11 @@ export function fallbackRedirect(req: IRequest) {
5454 } ) ;
5555}
5656
57- export async function get_packaged_video ( path : string ) {
57+ export async function get_packaged_video ( path : string , timeout = 1000 ) {
5858 try {
5959 const url = new URL ( `https://www.reddit.com${ path } ` ) ;
6060 const html = await fetch ( url , {
61- signal : AbortSignal . timeout ( 1000 ) ,
61+ signal : AbortSignal . timeout ( timeout ) ,
6262 headers : {
6363 'User-Agent' : USER_AGENT ,
6464 } ,
You can’t perform that action at this time.
0 commit comments