Work in progress, PRs are welcome!
🔑 Supports OAuth2 and Basic Auth.
🔍 Auth-free methods for scraping
⏰ Automatic rate limitting
📃 Pagination handling
The aim of this library is not to be 1:1 mapping of the Reddit API but rather provide 99% of the functionality while keeping it simple and easy to use.
import { Reddit } from "https://deno.land/x/reddit/mod.ts";
Note: You need to obtain an acccess and refresh token from Reddit using Oauth2.
const reddit = new Reddit.create({
clientId: "CLIENT_ID",
clientSecret: "CLIENT_SECRET",
accessToken: "ACCESS_TOKEN",
refreshToken: "REFRESH_TOKEN",
});
const reddit = Reddit.create({
clientId: "CLIENT_ID",
clientSecret: "SECRET",
username: "USERNAME",
password: "PASSWORD",
});
const user = await reddit.me;
console.log(user.name); // USERNAME
const subreddit = await Reddit.subreddit("deno").about;
console.log(subreddit.title); // Deno - A secure TypeScript runtime on V8
- Add more tests
- Complete documentation
- (Almost) 100% coverage
- Add more examples