🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pushshift-api

A pushshift API for Reddit

1.0.0
latest
Version published
Maintainers
1
Created

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'
                }
            */
        }
    }
})();

FAQs

Package last updated on 28 Oct 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts