Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
danbooru api wrapper
I couldn't find one on npmjs.com, so I thought I'd try making my own!
npm i danbooru -S
My api wrapper is super simple! First, you require it:
var Danbooru = require('danbooru');
Then you just refer to Danbooru's lovely api documentation and make requests!
Danbooru.get('posts', {limit: 5, tags: 'cat_ears'}, function(err, data) {
if(err) throw err;
console.log(data); // All of your cute kittehgirls!
});
You can also use Danbooru.post()
, Danbooru.put()
, and Danbooru.delete()
. They all have the same parameters and give you the same callback!
Perform a GET
request on Danbooru's api!
path
string. The API documentation mentions a base URL. You put that here! The slash and .json
are optional.params
object. Just provide your parameters as an object!callback
function(err, data). What do you wannya do after you get your api request?
err
Error. Node.js callbacks always give you an error for some reason. Here you go!data
object. Parsing JSON output is an extra step, so you don't hafta do it! Here's an already-parsed object for you!Perform a POST
request on Danbooru's api! As far as you needta be concerned, it works exactly like GET
!
Perform a PUT
request on Danbooru's api! Works exactly like POST
!
Perform a DELETE
request on Danbooru's api! Works exactly like POST
.
You know what's a pain? Having to type the same stuff over and over again. You know what you hafta do if you want to be authenticated on Danbooru? Send your login
and api_key
over and over again.
var authedBooru = new Danbooru({login: 'topsecret', api_key: 'evenmoresecret'});
authedBooru.post('favorites', {post_id: 2288637}, function(err, data) {
if(err) throw err;
console.log('Successfully favorited!'); // Wow, you do like kittehgirls!
});
If that's still too much typing for you, you can use a shortcut!
var shortBooru = Danbooru('topsecret', 'evenmoresecret');
Save parameters for later. Returns a new Danbooru object that you can use to make requests with those saved parameters.
object
object. string. If you provide an object, it'll be used as default parameters for all requests you make! If you provide a string, it'll set your default login
parameter to whatever you provide!api_key
string. If (and only if) you provided a string for object
, this will be used as your default api_key
parameter!FAQs
danbooru api wrapper
The npm package danbooru receives a total of 21 weekly downloads. As such, danbooru popularity was classified as not popular.
We found that danbooru 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.