Search code examples
web-scrapingreddit

Obtaining reddit data


I am interested in obtaining data from different reddit subreddits. Does anyone know if there is a reddit/other api similar like twitter does to crawl all the pages?


Solution

  • Yes, reddit has an API that can be used for a variety of purposes such as data collection, automatic commenting bots, or even to assist in subreddit moderation.

    There are a few places to discover information on reddit's API:

    • github reddit wiki -- provides the overview and rules for using reddit's API (follow the rules)
    • automatically generated API docs -- provides information on the requests needed to access most of the API endpoints
    • /r/redditdev -- the reddit community dedicated to answering questions both about reddit's source code and about reddit's API

    If there is a particular programming language you are already familiar with, you should check out the existing set of API wrappers for various languages. Despite my bias (I am the package maintainer) I am quite certain PRAW, for python, has support for the largest number of reddit API features.