![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
JavaScript wrapper library for Pushshift with Snoowrap support.
npm i -S snooshift
import { SnooShift } from "snooshift";
// create new object
const snoo = new SnooShift();
// search parameters
// https://github.com/pushshift/api#search-parameters-for-comments
// search comments by author
const searchParams = {
author: "eben0",
};
// send request
snoo.searchComments(searchParams).then((comments) => {
console.log(comments);
});
// get single comment by id
snoo.getComment("gof4uys").then((comment) => {
console.log(comment);
});
// search parameters
// https://github.com/pushshift/api#search-parameters-for-submissions
// search submissions by author
const searchParams = {
author: "eben0",
};
snoo.searchSubmissions(searchParams).then((comments) => {
console.log(comments);
});
// get single submission by id
snoo.searchSubmissions("lrufxe").then((submission) => {
console.log(submission);
});
You can reply, upvote and interact with reddit using Snoowrap
object.
You must set up your reddit api credentials to do so.
import { SnooShift } from "snooshift";
// list of supported credentials:
// https://github.com/not-an-aardvark/snoowrap#examples
const credentials = {
userAgent: "put your user-agent string here",
clientId: "put your client id here",
clientSecret: "put your client secret here",
refreshToken: "put your refresh token here",
};
const snoo = new SnooShift(credentials);
// get comment and reply/upvote/etc...
snoo.getComment("gof4uys").then((comment) => {
comment.reply("My awesome reply").then(value);
comment.upvote().then(value);
comment.delete().then(value);
});
You can directly query the elasticsearch server if you are familiar with syntax.
import { SnooShift } from "snooshift";
const snoo = new SnooShift();
// elasticsearch query
// this query searches for all author's data ordered by created_utc
const query = {
query: {
term: { author: "eben0" },
},
sort: {
created_utc: "desc",
}
};
// searches for author's comments
snoo.elasticComments(query).then((result) => {
console.log(result.hits.hits[0]._source);
});
// searches for author's submissions
snoo.elasticSubmissions(query).then((result) => {
console.log(result.hits.hits[0]._source);
});
FAQs
A JavaScript wrapper for Reddit Pushshift API based on Snoowrap
The npm package snooshift receives a total of 14 weekly downloads. As such, snooshift popularity was classified as not popular.
We found that snooshift demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.