reddit

Trouble extracting individual JSON values in Ruby

家住魔仙堡 提交于 2019-12-12 02:53:52
问题 I'm in the process of trying to scrape reddit (API-free) and I've run into a brick wall. On reddit, every page has a JSON representation that can be seen simply by appending .json to the end, e.g. https://www.reddit.com/r/AskReddit.json . I installed NeatJS, and wrote a small chunk of code to clean the JSON up and print it: require "rubygems" require "json" require "net/http" require "uri" require 'open-uri' require 'neatjson' url = ("https://www.reddit.com/r/AskReddit.json") result = JSON

Python Praw skipping sticky in subreddits

冷暖自知 提交于 2019-12-11 05:57:38
问题 I am trying to loop through subreddits, but want to ignore the sticky posts at the top. I am able to print the first 5 posts, unfortunately including the stickies. Various pythonic methods of trying to skip these have failed. Two different examples of my code below. subreddit = reddit.subreddit(sub) for submission in subreddit.hot(limit=5): # If we haven't replied to this post before if submission.id not in posts_replied_to: ##FOOD if subreddit == 'food': if 'pLEASE SEE' in submission.title:

403 error while calling Reddit API.

心已入冬 提交于 2019-12-10 11:18:32
问题 I'm trying to access data saved by the user. And it keeps returning a 403 error with this being its api end point. http://www.reddit.com/dev/api#GET_user_{username}_saved I'm thoroughly confused what to send in my headers to make this request work and the reddit documentation has no mention of it at all. Help? I'm using Python-requests library to do this. 回答1: Referring to line 686 in reddit's code in listingcontroller.py (here) : if (where in ('saved', 'hidden') and not ((c.user_is_loggedin

Reddit api sdk doing nothing, returns null

不打扰是莪最后的温柔 提交于 2019-12-08 21:03:31
I'm trying to use this reddit php api wrapper https://github.com/jcleblanc/reddit-php-sdk To submit a post to reddit. The code seems very simple, and I know I have it configured correct. When I load the page, it will go to reddit, verify my account, then send me back. But doesn't make the post. If I refresh, nothing happens. If I delete the session cookie, it does the verification confirmation again, but never submits a post. I set up the api, got the right app id and secret, the redirect uri is right, it comes back to my page. <?php echo '<h1>Test</h1>'; require_once("reddit.php"); $reddit =

Reddit api sdk doing nothing, returns null

橙三吉。 提交于 2019-12-08 06:36:13
问题 I'm trying to use this reddit php api wrapper https://github.com/jcleblanc/reddit-php-sdk To submit a post to reddit. The code seems very simple, and I know I have it configured correct. When I load the page, it will go to reddit, verify my account, then send me back. But doesn't make the post. If I refresh, nothing happens. If I delete the session cookie, it does the verification confirmation again, but never submits a post. I set up the api, got the right app id and secret, the redirect uri

Reddit integration to android app

Deadly 提交于 2019-12-08 05:18:27
I need to integrate Reddit to android app. I don't need much. Only log in and post a new link. (something like a share on Facebook). But I am struggling on the very beginning. Any help will b appreciated. EDIT: Here is what I made so far, I get the modhash and captcha but when I try to submit new link it gives me this: {"json": {"errors": [["USER_REQUIRED", "please login to do that", null]]}} private void getModhash(){ modhash = dbHandler.getUserModahash(); if(modhash.equals("")){ String jsonString = ""; DefaultHttpClient httpclient = new DefaultHttpClient(); final ArrayList<NameValuePair>

Digg-like search result ranking with Lucene / Solr?

ε祈祈猫儿з 提交于 2019-12-08 03:06:04
问题 I'm using Solr for search. I have documents that have an integer field " popularity ". I want to rank results by a combination of normal fulltext search relevance and popularity. It's kinda like search in digg - result ranking is based on the search relevance as well as how many digs a posting has. I don't have any specific ranking algorithm in mind. But is this something that can be done with solr? 回答1: Solr's FunctionQuery is exactly what you need: http://wiki.apache.org/solr/FunctionQuery

grabbing Reddit data via javascript

坚强是说给别人听的谎言 提交于 2019-12-07 19:49:58
问题 I came across this post, which is pretty much what I'm looking to do: How to extract url data from Reddit API using JSON I have modified the jsfiddle that was provided ( NSFW http://jsfiddle.net/DHKtW/170/) to read: $.getJSON("http://www.reddit.com/r/pics/.json?jsonp=?", function(data) { $.each(data.data.children, function(i,item){ console.log($('.score.likes').html(item)); }); }); My goal is to gather the total amount of upvotes on a given page. When you run this and look at the console,

HTTP Error 504: Gateway Time-out when trying to read a reddit comments post

一笑奈何 提交于 2019-12-07 16:57:52
问题 I am encountering an error when trying to get a comments' http from reddit. This has happened to various URLs (not all of them with special characters) and this is one of them. In one hour time frame, there may be 1000 or more requests to the reddit.com domain. hdr = {"User-Agent": "My Agent"} try: req = urllib2.Request("http://www.reddit.com/r/gaming/" "comments/1bjuee/when_pokΓ©mon_was_good", headers=hdr) htmlSource = urllib2.urlopen(req).read() except Exception as inst: print inst Output>

How does pagination on Reddit's home page work?

﹥>﹥吖頭↗ 提交于 2019-12-07 02:53:32
问题 Reddit uses a time decay algorithm. That would mean the sort order is subject to change. When a user goes to page 2, is there a mechanism to prevent them from seeing a post that was on page 1 but was bumped down to page 2 before they paged over? Is it just an acceptable flaw of the sort method? Or are the first couple of pages cached for the user so this doesn't happen? Side note: It's my understand that Digg cannot suffer from this issue but that HackerNews and Reddit can. 回答1: From the next