mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2022-03-16.git
synced 2024-08-15 00:53:18 +00:00
Add option to pull all videos
This commit is contained in:
parent
4730497efe
commit
6d8caaee65
4 changed files with 9 additions and 7 deletions
|
@ -7,3 +7,4 @@ db:
|
||||||
host: localhost
|
host: localhost
|
||||||
port: 5432
|
port: 5432
|
||||||
dbname: invidious
|
dbname: invidious
|
||||||
|
full_refresh: false
|
|
@ -83,7 +83,7 @@ crawl_threads.times do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
refresh_channels(PG_DB, channel_threads)
|
refresh_channels(PG_DB, channel_threads, CONFIG.full_refresh)
|
||||||
|
|
||||||
video_threads.times do |i|
|
video_threads.times do |i|
|
||||||
spawn do
|
spawn do
|
||||||
|
|
|
@ -13,6 +13,7 @@ class Config
|
||||||
dl_api_key: String?,
|
dl_api_key: String?,
|
||||||
https_only: Bool?,
|
https_only: Bool?,
|
||||||
hmac_key: String?,
|
hmac_key: String?,
|
||||||
|
full_refresh: Bool,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ def crawl_videos(db)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def refresh_channels(db, max_threads = 1)
|
def refresh_channels(db, max_threads = 1, full_refresh = false)
|
||||||
max_channel = Channel(Int32).new
|
max_channel = Channel(Int32).new
|
||||||
|
|
||||||
spawn do
|
spawn do
|
||||||
|
@ -67,7 +67,7 @@ def refresh_channels(db, max_threads = 1)
|
||||||
spawn do
|
spawn do
|
||||||
begin
|
begin
|
||||||
client = make_client(YT_URL)
|
client = make_client(YT_URL)
|
||||||
channel = fetch_channel(id, client, db, false)
|
channel = fetch_channel(id, client, db, full_refresh)
|
||||||
|
|
||||||
db.exec("UPDATE channels SET updated = $1 WHERE id = $2", Time.now, id)
|
db.exec("UPDATE channels SET updated = $1 WHERE id = $2", Time.now, id)
|
||||||
rescue ex
|
rescue ex
|
||||||
|
|
Loading…
Reference in a new issue