How do I connect to Reddit API?

How do you query API on Reddit?

I am currently replacing a website service which gets lots of API calls to Reddit thread and comments. I plan to query stickied posts (default, hot, new), top users and so on.

What are the alternatives? The very same way you'd fetch anything else, such as Reddit on Facebook or Twitter. You have 4 main options: Download things in bulk using the HNS, eg through support for the Pump protocol (see ) and output them into your desired format, as documented here. This is the most straightforward approach but Reddit has a strong preference for this (though not actually) encryption-only protocol approach.

The HNS should support throwing Exceptions for any errors if you specify it. I cannot, however, test this right now.

Regular HTTP requests and guaranteed stable-outputness methods like AJAX can still be used, depending on the API being used (if any) and their Traveling API Promises esque nature that let you throw a promise on each HTTP request while being convenient to use. However, expect this to be neither very fast and small resource consumption aware. Use volatile endpoint such as to speed things up.

A real-time data broker such as GraphQLHub can collect all the data online and cache it through presession, like Scut.js already does for other APIs, reducing user disk consumption and server oom.

You third option is likely.

Is Reddit API open source?

A few days ago I wrote an implementation of the Reddit API in JavaScript. Reddit is a user generated content website that allows users to submit text (called articles), comments and links (called comments). This means that every time you visit this website, you could create, read and modify the contents in thousands of articles in subreddits - and also submit comments on these articles. Very soon after releasing the code for my implementation of the API, users started reporting errors that I was unable to dig up. In order to investigate this, I created an issue and opened a ticket. Reddit didn't open-source its API, obviously, but they claimed it was strictly internal anyway. This seemed like a cop-out to me, because I had begonin digging into the code. Ever since the beginning I knew that it would be useless to do so if the API was open-source and/or publicly available. Although I found some interesting information along the way, I wasn't able to continue until I got my hands on a copy of the sourcecode!

Why does anyone need the source to the API? The main reason people need to see the source for the Reddit API is to find ways to cheat the system. The API actually allows one such oidn/ script to retrieve responses from many such URLs and somehow reassemble them into readable content. You could do the same by just brute forcing the endpoints, but it would be a gross waste of people's time, while an API would allow someone to create such script in a snap. To get the same valuable functionality from Reddit's API, the script would need to request the content from all these endpoints, parse it and asynchronously display it somehow. It would have to encode the data in JSON first so that the endpoints do not need to read large amounts of data, and then decode it in Javascript using JSON.parse (or another module from that library).

How do I connect to Reddit API?

2 Answers.
Use an access token from the Reddit Application (1) / API that you created. You can access the API with an URL like this: From there you simply use the authenticateclient() function, which returns a BasicAuthSubSession object. The important part of this code is the setauthurl() function which specifies the accessurl that you created for Reddit when you created the App. See definitions of BasicAuthSubSession at the end of the file. This should be all you need to get started. Note: To use this code in your Flask application, you'll probably want to wrap it around flaskrestful's flask.ext.restful decorator. The decorator adds some of the required logic and has a useful `generateauthurl` function.

In our example, we didn't need to set any of the Restful parameters config values. They were already set in the factory class method - it just defaults them to the defaults.

Using OAuth is a good idea so that you don't ever have a User ID exposed in your code. See this answer for more: I am implementing a solution that works with Reddit's new API. The new API works like this: Provision a new access token once for the entire app. Pre-save the access token, and save it locally within the app without any user input. When requesting a list of posts, include the access token in the Authorization header. Always catch Exception, and resolve if necessary. I haven't been able to create a screencast yet showing the API implementation in action, but this is the basic gist of what I'm doing right now. Let me know if anything needs to be clarified.

I'm looking at the same problem as well and I recently came up with a simple solution that you might find very useful. To setup reddit for your application you first have to add a client to your app. This can be done in two different ways depending on how many resources you are trying to access: You can add the Client object of the application using the Reddit API.

Does Reddit has an API?

Can I use it for my automation? Yes you can: You can get access to ALL posts on FORUMS for all types of messages (Threads, Messages, and Files). An Error may occurs when trying to view a message page that is being filtered by the mod. This means that the user can't see the message in question Can I get the threaded posts from r/programming? You can get access to ALL threads and pages sorted by Votes, time, DwellTime, Views, Favorites, Karma, Replies, and Messages. You can also get access to Filtered Threads and Threads with Unread Counts.

I currently don't have an account (How can I create one?), but I already got access to the database so I can query, for example, all the messages posted in the last 5 minutes. Can I POST to this website (or its databases)? That's impossible. External users have 0 direct access to the databases. However, you can use popular bruteforcing tools like OLAP (obscure lol) or simplesquareer to brute-force your way in.

Can I gain access to the usernames who have reached a specific reputation/karma/? Yes, using brute-force techniques. The username is repeated in every row. You can get the username using the serialized data in the /mixpanel/users//permissions.txt file. The IDs are used as a GUID in the database for enforcing uniqueness and authenticity, hence, you can filter the data using those IDs.

The username is 7 characters long. Can I get some idea about my clicks from it? Of course. You need to register and activate Javascript in your browser. Register now.

Everything you type will be sent to MixPanel, and logged. You can use this information to view and analyse the data in graph form. More information here.

Is Reddit a public application? Yes, it is. All the URLs are yours and you can send any number of requests per day.

Is there any sugar to this?

Related Answers

Whats the best VPN for privacy Reddit recommends?

I will not spend time or money on a VPN. I simply do not need a VPN....

Whats the best VPN for privacy Reddit recommends?

I'm looking for a good VPN. I use the default settings (PPTP), and I'm...

What is Github crawler?

An in-depth explanation Web crawlers are programs which index pages on the...