mirror of
https://onedev.site.tesses.net/tytd2025
synced 2026-02-08 17:45:45 +00:00
Make subscriptions quicker
This commit is contained in:
@@ -952,7 +952,6 @@ class TYTD.Downloader {
|
|||||||
if(!notify && downloadRes == Resolution.NoDownload) continue;
|
if(!notify && downloadRes == Resolution.NoDownload) continue;
|
||||||
var cid = sub.channelId;
|
var cid = sub.channelId;
|
||||||
|
|
||||||
var newVideos = [];
|
|
||||||
|
|
||||||
each(var batch : this.QueryPlaylistItems($"UU{cid.Substring(2)}",false))
|
each(var batch : this.QueryPlaylistItems($"UU{cid.Substring(2)}",false))
|
||||||
{
|
{
|
||||||
@@ -960,29 +959,27 @@ class TYTD.Downloader {
|
|||||||
{
|
{
|
||||||
|
|
||||||
if(this.GetVideo(videoId) == null)
|
if(this.GetVideo(videoId) == null)
|
||||||
|
{
|
||||||
newVideos.Add(videoId);
|
newVideos.Add(videoId);
|
||||||
|
if(notify)
|
||||||
|
{
|
||||||
|
this.PutVideoInfoIfNotExists(videoId);
|
||||||
|
var res = this.GetVideo(id);
|
||||||
|
if(res != null)
|
||||||
|
this.Bell.Invoke(this,{
|
||||||
|
Video = res
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if(downloadRes != Resolution.NoDownload)
|
||||||
|
{
|
||||||
|
this.DownloadVideo(id,downloadRes);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(notify)
|
|
||||||
{
|
|
||||||
each(var id : newVideos)
|
|
||||||
{
|
|
||||||
this.PutVideoInfoIfNotExists(id);
|
|
||||||
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);
|
var response = Net.Http.MakeRequest(url,requestData);
|
||||||
if(response.StatusCode != 200) throw "Not success";
|
if(response.StatusCode != 200) throw "Not success";
|
||||||
const text = response.ReadAsString();
|
const text = response.ReadAsString();
|
||||||
var data = {};
|
var data = Json.Decode(text);
|
||||||
try {
|
|
||||||
data = Json.Decode(text);
|
|
||||||
} catch(ex) {
|
|
||||||
this.Storage.CreateDirectory(/"CorruptedJson");
|
|
||||||
FS.WriteAllText(this.Storage,/"CorruptedJson"/$"{DateTime.NowEpoch}.json", text);
|
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
var cr = data.contents.twoColumnWatchNextResults.playlist.playlist;
|
var cr = data.contents.twoColumnWatchNextResults.playlist.playlist;
|
||||||
if(cr == null || cr == undefined)
|
if(cr == null || cr == undefined)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user