diff --git a/Tesses.YouTubeDownloader/src/YouTubeDownloader.tcross b/Tesses.YouTubeDownloader/src/YouTubeDownloader.tcross index ce790d6..d122de9 100644 --- a/Tesses.YouTubeDownloader/src/YouTubeDownloader.tcross +++ b/Tesses.YouTubeDownloader/src/YouTubeDownloader.tcross @@ -1093,8 +1093,26 @@ class TYTD.Downloader { return path; } else { + try { var url = $"https://s.ytimg.com/vi/{id}/{res}.jpg"; - Net.Http.DownloadToFile(url,this.Storage, path); + const resp = Net.Http.MakeRequest(url,{FollowRedirects=true}); + if(resp.StatusCode >= 200 && resp.StatusCode <= 299) + { + const strm=this.Storage.OpenFile(path,"wb"); + resp.CopyToStream(strm); + strm.Close(); + } + else { + + const bytes = FS.ReadAllBytes(this.Storage,"/Streams/nullthumb.jpg"); + FS.WriteAllBytes(this.Storage, path, bytes); + } + resp.Close(); //for other implementations + + }catch(ex) { + return /"Streams"/"nullthumb.jpg"; + } + return path; }