Add multi-user and cron support.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user