Roll back some changes. Looks like my Crystal install needs work
This commit is contained in:
parent
5150d965a3
commit
17d218c123
@ -38,7 +38,7 @@ end
|
||||
|
||||
spawn do
|
||||
loop do
|
||||
time = Time.local
|
||||
time = Time.now
|
||||
url_tuple = get_reddit_post(subreddit, completed) if (active_hours.includes? time.hour)
|
||||
if url_tuple
|
||||
url, title = url_tuple
|
||||
|
@ -21,7 +21,7 @@ class RedditResponse
|
||||
children: Array(RedditWrapper(RedditChild)))
|
||||
|
||||
def self.from_subreddits(subreddits : Array(String))
|
||||
request_url = URI.new scheme: "https", host: "www.reddit.com", path: "/r/hot.json", query: "limit=30"
|
||||
request_url = URI.new scheme: "https", host: "www.reddit.com", path: "/r/#{subreddits.join "+"}/hot.json", query: "limit=30"
|
||||
response = HTTP::Client.get(request_url, headers: HTTP::Headers {
|
||||
"User-agent" => "Joann-Pupper-Bot"
|
||||
})
|
||||
@ -30,7 +30,7 @@ class RedditResponse
|
||||
|
||||
begin
|
||||
RedditWrapper(RedditResponse).from_json body
|
||||
rescue
|
||||
rescue e
|
||||
nil
|
||||
end
|
||||
end
|
||||
@ -46,7 +46,7 @@ class RedditResponse
|
||||
end
|
||||
end
|
||||
|
||||
def filter_reddit_json(json, completed, extensions = ["png", "json"])
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user