diff --git a/Tesses.YouTubeDownloader.Server/cross.json b/Tesses.YouTubeDownloader.Server/cross.json index 266845e..166708b 100644 --- a/Tesses.YouTubeDownloader.Server/cross.json +++ b/Tesses.YouTubeDownloader.Server/cross.json @@ -14,6 +14,6 @@ "project_dependencies": [ "..\/Tesses.YouTubeDownloader" ], - "version": "1.0.0.3-prod", + "version": "1.0.0.4-prod", "compTime": "secure" } \ No newline at end of file diff --git a/Tesses.YouTubeDownloader/cross.json b/Tesses.YouTubeDownloader/cross.json index 9f56f08..69dc74a 100644 --- a/Tesses.YouTubeDownloader/cross.json +++ b/Tesses.YouTubeDownloader/cross.json @@ -14,6 +14,6 @@ } ], "name": "Tesses.YouTubeDownloader", - "version": "1.0.0.3-prod", + "version": "1.0.0.4-prod", "icon": "icon.png" } \ No newline at end of file diff --git a/Tesses.YouTubeDownloader/src/YouTubeDownloader.tcross b/Tesses.YouTubeDownloader/src/YouTubeDownloader.tcross index 873e5f3..ee12a4a 100644 --- a/Tesses.YouTubeDownloader/src/YouTubeDownloader.tcross +++ b/Tesses.YouTubeDownloader/src/YouTubeDownloader.tcross @@ -1349,7 +1349,7 @@ class TYTD.Downloader { } private DownloadCaptions(req) { - const tracks = req.playerResponse.playerCaptionsTracklistRenderer.captionTracks; + const tracks = req.playerResponse.captions.playerCaptionsTracklistRenderer.captionTracks; if(TypeIsList(tracks)) { each(var item : tracks) @@ -1358,26 +1358,36 @@ class TYTD.Downloader { if(!TypeIsString(item.baseUrl)) continue; try { var path = /"Streams"/id.Substring(0,4) / id.Substring(4) / item.languageCode; - var resp = Net.Http.MakeRequest(url,{FollowRedirects=true}); - if(resp.StatusCode >= 200 && resp.StatusCode <= 299) + if(!this.Storage.FileExists(path+".xml")) { - const strm=this.Storage.OpenFile(path+".xml","wb"); - resp.CopyToStream(strm); - strm.Close(); + var resp = Net.Http.MakeRequest(url,{FollowRedirects=true}); + if(resp.StatusCode >= 200 && resp.StatusCode <= 299) + { + const strm=this.Storage.OpenFile(path+".xml","wb"); + resp.CopyToStream(strm); + strm.Close(); + } } - resp = Net.Http.MakeRequest(url.Replace("fmt=srv3","fmt=vtt"),{FollowRedirects=true}); - if(resp.StatusCode >= 200 && resp.StatusCode <= 299) + if(!this.Storage.FileExists(path+".vtt")) { - const strm=this.Storage.OpenFile(path+".vtt","wb"); - resp.CopyToStream(strm); - strm.Close(); + var resp = Net.Http.MakeRequest(url.Replace("fmt=srv3","fmt=vtt"),{FollowRedirects=true}); + if(resp.StatusCode >= 200 && resp.StatusCode <= 299) + { + const strm=this.Storage.OpenFile(path+".vtt","wb"); + resp.CopyToStream(strm); + strm.Close(); + } } - resp = Net.Http.MakeRequest(url.Replace("fmt=srv3","fmt=srt"),{FollowRedirects=true}); - if(resp.StatusCode >= 200 && resp.StatusCode <= 299) + if(!this.Storage.FileExists(path+".srt")) { - const strm=this.Storage.OpenFile(path+".srt","wb"); - resp.CopyToStream(strm); - strm.Close(); + var resp = Net.Http.MakeRequest(url.Replace("fmt=srv3","fmt=srt"),{FollowRedirects=true}); + + if(resp.StatusCode >= 200 && resp.StatusCode <= 299) + { + const strm=this.Storage.OpenFile(path+".srt","wb"); + resp.CopyToStream(strm); + strm.Close(); + } } } catch(ex) { @@ -1692,7 +1702,6 @@ class TYTD.Downloader { }; this.RateLimit(); var response = Net.Http.MakeRequest(url,requestData); - Console.WriteLine(response.StatusCode); if(response.StatusCode < 200 || response.StatusCode > 299) continue; const respText = response.ReadAsString();