mirror of
https://onedev.site.tesses.net/tytd2025
synced 2026-02-08 17:45:45 +00:00
Compare commits
8 Commits
1eccb71437
...
c3ef57b8b6
| Author | SHA1 | Date | |
|---|---|---|---|
| c3ef57b8b6 | |||
| deea6b32a4 | |||
| 3cc23ff97d | |||
| 2626242fa1 | |||
| c8a59cd2e9 | |||
| 9c3d8ed2aa | |||
| c3144e7483 | |||
| 1502e599bd |
@@ -80,7 +80,7 @@ body.dark {
|
||||
.loading-indicator
|
||||
{
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
top: 50vh;
|
||||
left: 50vw;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
@@ -908,6 +908,7 @@ class TYTD.Downloader {
|
||||
this.Mutex.Lock();
|
||||
var db = this.OpenDB();
|
||||
var res = Sqlite.Exec(db, "SELECT * FROM subscriptions;");
|
||||
Sqlite.Close(db);
|
||||
//Sqlite.Exec(db,"CREATE TABLE IF NOT EXISTS subscriptions (id INTEGER PRIMARY KEY AUTOINCREMENT, channelId TEXT UNIQUE ON CONFLICT REPLACE, bell TEXT);");
|
||||
|
||||
this.Mutex.Unlock();
|
||||
@@ -944,7 +945,6 @@ class TYTD.Downloader {
|
||||
break;
|
||||
case SubscriptionBell.BellHigh:
|
||||
notify = true;
|
||||
break;
|
||||
case SubscriptionBell.DownloadHigh:
|
||||
downloadRes = Resolution.MKV;
|
||||
break;
|
||||
@@ -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,36 +959,34 @@ class TYTD.Downloader {
|
||||
{
|
||||
|
||||
if(this.GetVideo(videoId) == null)
|
||||
{
|
||||
newVideos.Add(videoId);
|
||||
}
|
||||
}
|
||||
|
||||
if(notify)
|
||||
{
|
||||
each(var id : newVideos)
|
||||
{
|
||||
this.PutVideoInfoIfNotExists(id);
|
||||
var res = this.GetVideo(id);
|
||||
this.PutVideoInfoIfNotExists(videoId);
|
||||
var res = this.GetVideo(videoId);
|
||||
if(res != null)
|
||||
this.Bell.Invoke(this,{
|
||||
Video = res
|
||||
});
|
||||
}
|
||||
}
|
||||
if(downloadRes != Resolution.NoDownload)
|
||||
{
|
||||
each(var id : newVideos)
|
||||
{
|
||||
this.DownloadVideo(id,downloadRes);
|
||||
this.DownloadVideo(videoId,downloadRes);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}catch(ex) {
|
||||
try{
|
||||
this.LOG($"Exception caught on playlist thread: {e}");
|
||||
this.LOG($"Exception caught on playlist thread: {ex}");
|
||||
}catch(ex2){}
|
||||
}
|
||||
}
|
||||
@@ -1093,8 +1090,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;
|
||||
}
|
||||
@@ -1551,7 +1566,10 @@ class TYTD.Downloader {
|
||||
this.RateLimit();
|
||||
var response = Net.Http.MakeRequest(url,requestData);
|
||||
if(response.StatusCode != 200) throw "Not success";
|
||||
var data = Json.Decode(response.ReadAsString());
|
||||
const text = response.ReadAsString();
|
||||
var data = Json.Decode(text);
|
||||
|
||||
|
||||
var cr = data.contents.twoColumnWatchNextResults.playlist.playlist;
|
||||
if(cr == null || cr == undefined)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user