mirror of
https://onedev.site.tesses.net/tytd2025
synced 2026-02-08 09:45:44 +00:00
Fix thumbnail error
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user