mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2022-03-16.git
synced 2024-08-15 00:53:18 +00:00
Add job for pulling popular videos
This commit is contained in:
parent
26eb59e00d
commit
3c98601f35
3 changed files with 24 additions and 1 deletions
|
@ -180,6 +180,21 @@ def pull_top_videos(config, db)
|
|||
end
|
||||
end
|
||||
|
||||
def pull_popular_videos(db)
|
||||
loop do
|
||||
subscriptions = PG_DB.query_all("SELECT channel FROM \
|
||||
(SELECT UNNEST(subscriptions) AS channel FROM users) AS d \
|
||||
GROUP BY channel ORDER BY COUNT(channel) DESC LIMIT 40", as: String)
|
||||
|
||||
videos = PG_DB.query_all("SELECT DISTINCT ON (ucid) * FROM \
|
||||
channel_videos WHERE ucid IN (#{arg_array(subscriptions)}) \
|
||||
ORDER BY ucid, published DESC", subscriptions, as: ChannelVideo).sort_by { |video| video.published }.reverse
|
||||
|
||||
yield videos
|
||||
Fiber.yield
|
||||
end
|
||||
end
|
||||
|
||||
def update_decrypt_function
|
||||
loop do
|
||||
begin
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
require "crypto/bcrypt/password"
|
||||
|
||||
class User
|
||||
module PreferencesConverter
|
||||
def self.from_rs(rs)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue