Fetcher::Reddit
Constants
HTTP_STATUS_WIDTH = 80
Diagnostics and response formatting constants
MAX_BODY_SNIPPET = 512
OLD_REDDIT_API_BASE = "https://old.reddit.com"
OLD_REDDIT_TTLS = {"new" => 5.minutes, "rising" => 5.minutes, "hot" => 15.minutes, "top" => 30.minutes, "controversial" => 30.minutes, "default" => 15.minutes}
REDDIT_API_BASE = "https://www.reddit.com"
REDDIT_TTLS = {"new" => 30.seconds, "rising" => 30.seconds, "hot" => 2.minutes, "top" => 10.minutes, "controversial" => 10.minutes}
Data-driven TTLs for caching by sort and backend
USER_AGENT = "fetcher.cr/0.9.7 (https://github.com/kritoke/fetcher.cr; 3081486+kritoke@users.noreply.github.com)"
VALID_SORTS = {"hot", "new", "rising", "top", "controversial"}
VALID_SUBREDDIT = /^[A-Za-z0-9_+%]+$/
Class methods
pull(url : String, headers : HTTP::Headers, limit : Int32 = 100, config : RequestConfig = RequestConfig.new) : Result
Source