mirror of
https://onedev.site.tesses.net/tytd2025
synced 2026-02-09 01:55:46 +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
|
.loading-indicator
|
||||||
{
|
{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 50%;
|
top: 50vh;
|
||||||
left: 50%;
|
left: 50vw;
|
||||||
transform: translate(-50%, -50%);
|
transform: translate(-50%, -50%);
|
||||||
}
|
}
|
||||||
@@ -908,6 +908,7 @@ class TYTD.Downloader {
|
|||||||
this.Mutex.Lock();
|
this.Mutex.Lock();
|
||||||
var db = this.OpenDB();
|
var db = this.OpenDB();
|
||||||
var res = Sqlite.Exec(db, "SELECT * FROM subscriptions;");
|
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);");
|
//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();
|
this.Mutex.Unlock();
|
||||||
@@ -944,7 +945,6 @@ class TYTD.Downloader {
|
|||||||
break;
|
break;
|
||||||
case SubscriptionBell.BellHigh:
|
case SubscriptionBell.BellHigh:
|
||||||
notify = true;
|
notify = true;
|
||||||
break;
|
|
||||||
case SubscriptionBell.DownloadHigh:
|
case SubscriptionBell.DownloadHigh:
|
||||||
downloadRes = Resolution.MKV;
|
downloadRes = Resolution.MKV;
|
||||||
break;
|
break;
|
||||||
@@ -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,36 +959,34 @@ class TYTD.Downloader {
|
|||||||
{
|
{
|
||||||
|
|
||||||
if(this.GetVideo(videoId) == null)
|
if(this.GetVideo(videoId) == null)
|
||||||
|
{
|
||||||
newVideos.Add(videoId);
|
newVideos.Add(videoId);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(notify)
|
if(notify)
|
||||||
{
|
{
|
||||||
each(var id : newVideos)
|
this.PutVideoInfoIfNotExists(videoId);
|
||||||
{
|
var res = this.GetVideo(videoId);
|
||||||
this.PutVideoInfoIfNotExists(id);
|
|
||||||
var res = this.GetVideo(id);
|
|
||||||
if(res != null)
|
if(res != null)
|
||||||
this.Bell.Invoke(this,{
|
this.Bell.Invoke(this,{
|
||||||
Video = res
|
Video = res
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if(downloadRes != Resolution.NoDownload)
|
if(downloadRes != Resolution.NoDownload)
|
||||||
{
|
{
|
||||||
each(var id : newVideos)
|
this.DownloadVideo(videoId,downloadRes);
|
||||||
{
|
|
||||||
this.DownloadVideo(id,downloadRes);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}catch(ex) {
|
}catch(ex) {
|
||||||
try{
|
try{
|
||||||
this.LOG($"Exception caught on playlist thread: {e}");
|
this.LOG($"Exception caught on playlist thread: {ex}");
|
||||||
}catch(ex2){}
|
}catch(ex2){}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1093,8 +1090,26 @@ class TYTD.Downloader {
|
|||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
try {
|
||||||
var url = $"https://s.ytimg.com/vi/{id}/{res}.jpg";
|
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;
|
return path;
|
||||||
}
|
}
|
||||||
@@ -1551,7 +1566,10 @@ class TYTD.Downloader {
|
|||||||
this.RateLimit();
|
this.RateLimit();
|
||||||
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";
|
||||||
var data = Json.Decode(response.ReadAsString());
|
const text = response.ReadAsString();
|
||||||
|
var data = Json.Decode(text);
|
||||||
|
|
||||||
|
|
||||||
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