You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 27, 2020. It is now read-only.
So, if you put a link into the reddit's search box, then it will show you where has that link already been submitted. It will redirect to /submit?url=your_url. Now, RedditKit doesn't do redirects.
With this code, it does:
module RedditKit
class Client
def middleware
@middleware ||= Faraday::Builder.new do |builder|
builder.use Faraday::Request::UrlEncoded
builder.use RedditKit::Response::RaiseError
builder.use RedditKit::Response::ParseJSON
# *These two lines below allow the redirects to happen.*
builder.use FaradayMiddleware::FollowRedirects
builder.adapter :net_http
end
end
end
end
And without the redirects, client.search('http://www.youtube.com/watch?v=XAAgXaMCdfI') just returned nil. Now, it returns nil only when it hasn't been submitted, a listing otherwise.