I have a recursive javascript (my brain-fried logic ) that I am using in angular 19 to pull data from Youtube. The script is working except that I am wondering that should be a better way to do it since this is my old schooljavascript. Thank you for any suggestion. public getSeriesList() { this.record.webTubeSeries = []; this._seqNum = 0; this.getUrlYouTube() .pipe(first()) .subscribe({ next: (res: any) => { this.parseVideoList(res["items"]); if (res['nextPageToken']) { let repeatGetNextVideoPage = (_token: string) => { this.getNextVideoPage(_token) .subscribe( (result: any) => { this.parseVideoList(result["items"]); if (result["nextPageToken"]) { repeatGetNextVideoPage(result["nextPageToken"]); } } ), (err: any) => { console.log("HTTP Error", err.message) } } repeatGetNextVideoPage(res["nextPageToken"]); } } } ); } private getNextVideoPage(_token: string) { let url = (this.urlYouTube + this.videoListId + '&pageToken=' + _token); return this.http.get(url); } private parseVideoList(result: any) { for (let v of result) { var item = new WebtubeSeries; item.videoTitle = v.snippet.title; item.videoId = v.snippet.resourceId.videoId; if (v.snippet.thumbnails) { item.urlThumbNailDefault = v.snippet.thumbnails.default.url; item.urlThumbNailMedium = v.snippet.thumbnails.medium.url; item.urlThumbNailHigh = v.snippet.thumbnails.high.url; item.widthDefault = v.snippet.thumbnails.default.width.toString(); item.heightDefault = v.snippet.thumbnails.default.height.toString(); item.widthMedium = v.snippet.thumbnails.medium.width.toString(); item.heightMedium = v.snippet.thumbnails.medium.height.toString() item.widthHigh = v.snippet.thumbnails.high.width.toString() item.heightHigh = v.snippet.thumbnails.high.height.toString(); item.seqNumber = this._seqNum++; //item.id = item.seqNumber; this.record.webTubeSeries.push(item); } } } Thanks. Continue reading...