Conversation
….e. your Reddit front page, which is different than /r/all, the default if subreddit was omitted before
|
I will take a look at this as soon as possible. I apologize for any delay On Tue, Aug 4, 2015 at 12:10 PM, earth-tone notifications@github.com
Old programmers don't die; they just parse on... |
|
I've been avoiding unit tests because I've never done them and don't know exactly what should be in them. I added a file called unit_tests, which has 7 tests of the new functions using Test::Simple. It basically just checks that each one works, it doesn't test all scenarios. I'm not expecting all of this code to get accepted soon (or ever); I kind of submitted it for completeness and so it wouldn't look like I was developing my own separate version of Reddit::Client or something. I'm not; I'm just adding the functions that I need. With the Oauth change, I had to decide whether to update my Python PRAW bots to work with it, or to move everything to perl and update Reddit::Client to do everything that PRAW does. I opted for the latter. Most of my scripts are in Perl anyway and it's a lot easier for me to write in Perl; the only reason I was using PRAW at all was because it had functions that Reddit::Client didn't. I'm still very actively working on it. I just now removed the login requirement from send_message() because Oauth no longer needs a traditional login and it was breaking things; your token is what your cookie would have been before. |
|
And literally two days after I wrote the get_subreddit_comments function, Reddit does this: https://www.reddit.com/r/redditdev/comments/3fx3gt/quarantined_content_will_be_unavailable_through/ The API won't return results from "quarantined" subs. The only way to opt in is to visit the sub through Reddit.com and click "yes". So the only way for a function that gets comments (or fetch_links that gets links) to be content agnostic is to get it right from the json at Reddit.com without hitting the API. That won't be hard, but it will affect a few functions. |
So, this will likely look like a huge mess. The readme has a detailed explanation and is nicely formatted, so I won't retype it all here, I'll just summarize. When I have more time I may do a more detailed writeup. At the moment I just wanted to get this out there because of Reddit's new Oauth requirement that went into effect August 3rd.
-I've updated Reddit::Client with Oauth support. There is now a get_token(client_id, secret, username, password) function. Tokens last for an hour and refresh automatically if your script runs continually for more than an hour. Instructions on registering a script are included.
-Added get_subreddit_comments function, which get all the comments from a subreddit or multi. Reddit's new API maxes out at 100 results, so another function that only does a basic json request (no API) is planned, to hopefully be able to grab 500 at a time.
-send_message function is still there from the last time
-me() function updated to work with new API