File tree Expand file tree Collapse file tree 3 files changed +2
-11
lines changed
Expand file tree Collapse file tree 3 files changed +2
-11
lines changed Original file line number Diff line number Diff line change 77 name : Tests
88 strategy :
99 matrix :
10- node-version : [18 .x, 20 .x]
10+ node-version : [20 .x, 22.x, 24 .x]
1111 runs-on : ubuntu-latest
1212 steps :
1313 - name : Checkout sources
Original file line number Diff line number Diff line change 1212 "get-youtube-chapters" : " ^2.0.0" ,
1313 "get-youtube-id" : " ^1.0.0" ,
1414 "http-errors" : " ^2.0.0" ,
15- "node-fetch" : " ^2.6.0" ,
1615 "parse-iso-duration" : " ^1.1.0"
1716 },
1817 "devDependencies" : {
1918 "@types/http-errors" : " ^2.0.0" ,
20- "@types/node-fetch" : " ^2.5.4" ,
2119 "@types/qs" : " ^6.9.4" ,
2220 "dprint" : " ^0.50.0" ,
2321 "nock" : " ^14.0.0" ,
Original file line number Diff line number Diff line change 11import createError from 'http-errors' ;
2- import https from 'https' ;
3- import fetch from 'node-fetch' ;
42
53/**
64 * General interface for query parameters to the YouTube API.
@@ -507,16 +505,13 @@ export type ListChannelsOptions = RequestOptions & ({ forUsername: string } | {
507505export default class YouTubeClient {
508506 private params : Params ;
509507
510- private agent : https . Agent ;
511-
512508 private baseUrl = 'https://www.googleapis.com/youtube/v3' ;
513509
514510 /**
515511 * @param params Default query parameters for YouTube API requests—typically for API keys.
516512 */
517513 constructor ( params : Params ) {
518514 this . params = params ;
519- this . agent = new https . Agent ( { keepAlive : true } ) ;
520515 }
521516
522517 private async get < TResponse > ( resource : string , options : Params ) : Promise < TResponse > {
@@ -526,9 +521,7 @@ export default class YouTubeClient {
526521 . map ( ( [ key , value ] ) => [ key , String ( value ) ] ) ,
527522 ) ;
528523 const query = new URLSearchParams ( params ) ;
529- const response = await fetch ( `${ this . baseUrl } /${ resource } ?${ query } ` , {
530- agent : this . agent ,
531- } ) ;
524+ const response = await fetch ( `${ this . baseUrl } /${ resource } ?${ query } ` ) ;
532525 const data = await response . json ( ) ;
533526 if ( ! response . ok ) {
534527 throw createError ( response . status , data . error . message ) ;
You can’t perform that action at this time.
0 commit comments