Code Monkey home page Code Monkey logo

psraw's Introduction

PSRAW

PyPI version Coverage Status Build Status Code Health

pushshift reddit API wrapper

Installation

psraw requires the installation of the praw package, so make sure you have that installed first.

pip install psraw

Both Python 2.7 and Python 3.X are supported

Usage

Each function in the library is a generator. This allows you to set an extremely high limit parameter without the need to call the functions multiple times. To get a normal Python list, just wrap the function with the list() constructor.

import psraw
import praw

r = praw.Reddit(...)

# Get a list from the API
results = list(psraw.comment_search(r, q='teaearlgraycold', limit=30))

# Or use the function as a generator
for comment in psraw.comment_search(r, q='teaearlgraycold', limit=3000):
    # Do something with the comment

Available functions

Official Documentation out of date

In the example function signatures below, r is a praw.Reddit session object. All other arguments must be passed as keyword arguments.

Each function will return either a list of praw.models.Comment objects or praw.models.Submission objects.

psraw.comment_search(r, q='', subreddit='', limit=0, sort='asc', after=0, before=0)
psraw.submission_search(r, q='', subreddit='', limit=0, sort='asc', after=0)

psraw's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

psraw's Issues

Search URL has changed

https://apiv2.pushshift.io/reddit/search/submission/ no longer works

The correct one is https://elastic.pushshift.io/rs/submissions/_search/, don't know what it is for comments, though.

The limit argument doesn't work anymore, and the API really doesn't like URL encoding.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.