mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2022-08-14.git
synced 2024-08-15 00:53:20 +00:00
Check deleted channels
This commit is contained in:
parent
f85472c0ce
commit
1ceb827a82
1 changed files with 2 additions and 2 deletions
|
@ -55,7 +55,7 @@ def refresh_channels(db, logger, max_threads = 1, full_refresh = false)
|
||||||
active_channel = Channel(Bool).new
|
active_channel = Channel(Bool).new
|
||||||
|
|
||||||
loop do
|
loop do
|
||||||
db.query("SELECT id FROM channels WHERE deleted = false ORDER BY updated") do |rs|
|
db.query("SELECT id FROM channels ORDER BY updated") do |rs|
|
||||||
rs.each do
|
rs.each do
|
||||||
id = rs.read(String)
|
id = rs.read(String)
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ def refresh_channels(db, logger, max_threads = 1, full_refresh = false)
|
||||||
client = make_client(YT_URL)
|
client = make_client(YT_URL)
|
||||||
channel = fetch_channel(id, client, db, full_refresh)
|
channel = fetch_channel(id, client, db, full_refresh)
|
||||||
|
|
||||||
db.exec("UPDATE channels SET updated = $1, author = $2 WHERE id = $3", Time.now, channel.author, id)
|
db.exec("UPDATE channels SET updated = $1, author = $2, deleted = false WHERE id = $3", Time.now, channel.author, id)
|
||||||
rescue ex
|
rescue ex
|
||||||
if ex.message == "Deleted or invalid channel"
|
if ex.message == "Deleted or invalid channel"
|
||||||
db.exec("UPDATE channels SET deleted = true WHERE id = $1", id)
|
db.exec("UPDATE channels SET deleted = true WHERE id = $1", id)
|
||||||
|
|
Loading…
Reference in a new issue