mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2022-08-14.git
synced 2024-08-15 00:53:20 +00:00
Add rescue for video ranking
This commit is contained in:
parent
2be57276a2
commit
39df8ab200
2 changed files with 6 additions and 2 deletions
|
@ -234,7 +234,7 @@ end
|
||||||
def rank_videos(db, n, pool, filter)
|
def rank_videos(db, n, pool, filter)
|
||||||
top = [] of {Float64, String}
|
top = [] of {Float64, String}
|
||||||
|
|
||||||
db.query("SELECT id, wilson_score, published FROM videos WHERE views > 5000 ORDER BY published DESC LIMIT 10000") do |rs|
|
db.query("SELECT id, wilson_score, published FROM videos WHERE views > 5000 ORDER BY published DESC LIMIT 1000") do |rs|
|
||||||
rs.each do
|
rs.each do
|
||||||
id = rs.read(String)
|
id = rs.read(String)
|
||||||
wilson_score = rs.read(Float64)
|
wilson_score = rs.read(Float64)
|
||||||
|
|
|
@ -147,7 +147,11 @@ spawn do
|
||||||
|
|
||||||
top.each do |id|
|
top.each do |id|
|
||||||
client = get_client(youtube_pool)
|
client = get_client(youtube_pool)
|
||||||
videos << get_video(id, client, PG_DB)
|
begin
|
||||||
|
videos << get_video(id, client, PG_DB)
|
||||||
|
rescue ex
|
||||||
|
STDOUT << Time.now << " : " << ex.message << "\n"
|
||||||
|
end
|
||||||
youtube_pool << client
|
youtube_pool << client
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue