pushshift-api
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Reddit PushShift API

An API to query the PushShift Reddit API, supporting both submissions and comments.

PushShift allows you to view delete submissions and comments.

Usage

Example to fetch the latest 5 submissions from the r/pics subreddit:

import { getSubmission, SortMethod, SortType, SubmissionFields } from 'pushshift-api';

(async () => {
    const response = await getSubmission({
        subreddit: "pics",
        size: 5,
        fields: [
            SubmissionFields.Author,
            SubmissionFields.Title,
            SubmissionFields.Url
        ],
        sort_type: SortType.Created,
        sort: SortMethod.Descending
    });
    if (response) {
        for (let submission of response) {
            console.log(submission);
            /*
                {
                    author: 'An author',
                    title: 'A title',
                    url: 'URL to image'
                }
            */
        }
    }
})();

Package Sidebar

Install

npm i pushshift-api

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

48.7 kB

Total Files

9

Last publish

Collaborators

  • deftware