Add multi-user and cron support.

This commit is contained in:
2019-04-14 22:22:49 -07:00
parent 32facc0d87
commit 7834d345bf
2 changed files with 103 additions and 75 deletions

View File

@@ -45,16 +45,3 @@ class RedditResponse
.select { |it| yield it }
end
end
def filter_reddit_json(json, completed, extensions = ["png", "jpeg"])
json.data.posts_matching do |post|
extensions.any? { |it| post.url.ends_with? it } && !completed.includes? post.url
end
end
def get_reddit_post(subreddit, completed)
return nil unless json = RedditResponse.from_subreddit subreddit
return nil unless post = filter_reddit_json(json, completed).first?
completed.push(post.name)
return { post.url, post.title }
end