Make subscriptions quicker

This commit is contained in:
2025-12-28 23:22:42 -06:00
parent 3cc23ff97d
commit deea6b32a4

View File

@@ -952,7 +952,6 @@ class TYTD.Downloader {
if(!notify && downloadRes == Resolution.NoDownload) continue;
var cid = sub.channelId;
var newVideos = [];
each(var batch : this.QueryPlaylistItems($"UU{cid.Substring(2)}",false))
{
@@ -960,29 +959,27 @@ class TYTD.Downloader {
{
if(this.GetVideo(videoId) == null)
{
newVideos.Add(videoId);
}
}
if(notify)
{
each(var id : newVideos)
{
this.PutVideoInfoIfNotExists(id);
this.PutVideoInfoIfNotExists(videoId);
var res = this.GetVideo(id);
if(res != null)
this.Bell.Invoke(this,{
Video = res
});
}
}
if(downloadRes != Resolution.NoDownload)
{
each(var id : newVideos)
{
this.DownloadVideo(id,downloadRes);
}
}
}
}
}
}
@@ -1570,14 +1567,9 @@ class TYTD.Downloader {
var response = Net.Http.MakeRequest(url,requestData);
if(response.StatusCode != 200) throw "Not success";
const text = response.ReadAsString();
var data = {};
try {
data = Json.Decode(text);
} catch(ex) {
this.Storage.CreateDirectory(/"CorruptedJson");
FS.WriteAllText(this.Storage,/"CorruptedJson"/$"{DateTime.NowEpoch}.json", text);
throw ex;
}
var data = Json.Decode(text);
var cr = data.contents.twoColumnWatchNextResults.playlist.playlist;
if(cr == null || cr == undefined)
{