From e4630565fd22049d78c317b3bd58bede0d99daeb Mon Sep 17 00:00:00 2001 From: Sebastiaan de Schaetzen Date: Fri, 7 Feb 2025 12:09:21 +0100 Subject: [PATCH] Download videos from oldest to newest --- downloader.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/downloader.go b/downloader.go index 6974b8c..d42f887 100644 --- a/downloader.go +++ b/downloader.go @@ -43,7 +43,7 @@ func DownloadAllVideos(db *sql.DB) error { log.Printf("Starting downloads...") for { // Fetch the next record from the database - row := db.QueryRow("select id, url, `cast`, title, description, upload_date, thumbnail from videos where state = 'pending' limit 1") + row := db.QueryRow("select id, url, `cast`, title, description, upload_date, thumbnail from videos where state = 'pending' order by id desc limit 1") var id int var href, cast, title, description, uploadDateStr, thumbnailUrl string err = row.Scan(&id, &href, &cast, &title, &description, &uploadDateStr, &thumbnailUrl)