UNPKG

pokello

Version:

A simple wrapper for the Reddit API.

46 lines (38 loc) 1.24 kB
/* eslint-disable */ const Pokello = require('./Pokello.js'); const pokello = new Pokello( { username: 'whs_dev_account', password: 'password', appID: 'AIzfp6rfKjD-aw', apiSecret: 'foKnEhnVpPY0wogZl6tyBLoWlsQ', userAgent: 'pokello-collection-utility', retryOnWait: true, retryOnServerError: 5, retryDelay: 1, logs: true, }); const reddit_get = (api_access, endpoint, data) => { api_access.get(endpoint, data) .then(function (response) { let responseCode = response[0]; let responseData = response[1]; console.log('Received response (' + responseCode + '): ', responseData); console.log(responseData.data.children); console.log(responseData.data.children.length); }) .catch(function (err) { return console.error('api request failed: ' + err); }); }; //reddit_get(redditConn, "/r/funny/about/rules", {limit: 2}); reddit_get( pokello, '/r/2007scape/search.json?q=mod&sort=new&include_over_18=on&restrict_sr=on', { limit: 1 }); // max = 100 // TODO // questions: // - what is the data field do? // things to note: // - api request limit is 30 requests every 60 seconds // - i can get around the 100 post limit my title looping (ask joe)