Closed sergiotapia closed 10 years ago
There's something like this exactly in the examples! So, we have your back!
You can achieve exactly what you're looking for by:
comments = RedditKit.user_content 'PresidentObama', :category => :comments
comments.each do |comment|
puts "The comment '#{comment.text}' was posted at #{comment.posted_at}."
end
That is what you were looking for?
I don't know how I missed that, let's chalk it up to 3am coding. :)
I had already written a Nokogiri based parsing solution but I assume this will be much quicker. Is this library only parsing JSON comments? That would be significantly quicker than my HTML scraping solution.
Yeah, RedditKit uses reddit's JSON API for comments and parses them using multi_json, so it's pretty speedy.
Thank you, I'll change my ruby code to use this lib and submit a pull request to show this example on the README.md
file.
My use case is quite simple, I just need to fetch the latest comments given a user.
For example:
Is this possible at the moment, I couldn't seem to find anything related to Comments in the source code.