Fix thumbnail error

This commit is contained in:
2025-12-28 17:58:49 -06:00
parent 1502e599bd
commit c3144e7483

View File

@@ -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;
}