Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

danbooru

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

danbooru - npm Package Compare versions

Comparing version 1.2.0 to 1.3.0

54

lib/index.js
// Generated by LiveScript 1.4.0
(function(){
var https, request, deepExtend, argsJs, search, util, exports, slice$ = [].slice;
var https, request, deepExtend, argsJs, search, util, baseUrl, exports, slice$ = [].slice;
https = require('https');

@@ -10,2 +10,3 @@ request = require('request');

util = require('./util');
baseUrl = 'https://danbooru.donmai.us/';
module.exports = function(it){

@@ -46,3 +47,3 @@ return importAll$(it, it());

parsePath = function(it){
return "https://danbooru.donmai.us/" + (/^\/?(.*?)(?:\.(?:json|xml)|)$/.exec(it))[1] + ".json";
return baseUrl + "" + (/^\/?(.*?)(?:\.(?:json|xml)|)$/.exec(it))[1] + ".json";
};

@@ -71,3 +72,5 @@ doRequest = function(self, method, body, path, params, callback){

e = e$;
e.stack = stacktrace;
if (e.stack != null) {
e.stack = stacktrace;
}
return callback(e, body);

@@ -97,3 +100,5 @@ }

e = e$;
e.stack = stacktrace;
if (e.stack != null) {
e.stack = stacktrace;
}
throw e;

@@ -114,2 +119,43 @@ }

};
prototype.request = function(options, callback){
var stacktrace;
callback == null && (callback = function(){});
options = (function(){
switch (typeof options) {
case 'object':
return deepExtend({}, options);
case 'string':
return {
uri: options
};
case 'function':
callback = options;
// fallthrough
default:
return {
uri: ''
};
}
}());
options.baseUrl = baseUrl;
if (options.url != null && options.uri == null) {
options.uri = options.url;
}
stacktrace = util.stacktrace;
return request(options, function(){
var ref$, e;
try {
if (((ref$ = arguments[0]) != null ? ref$.stack : void 8) != null) {
arguments[0].stack = stacktrace;
}
return callback.apply(null, arguments);
} catch (e$) {
e = e$;
if (e.stack != null) {
e.stack = stacktrace;
}
throw e;
}
});
};
return exports;

@@ -116,0 +162,0 @@ }()));

18

lib/search.js

@@ -50,3 +50,5 @@ // Generated by LiveScript 1.4.0

e = e$;
e.stack = stacktrace;
if (e.stack != null) {
e.stack = stacktrace;
}
throw e;

@@ -72,3 +74,3 @@ }

return self.search(this.tags, myParams, function(e, data){
if (e != null) {
if ((e != null ? e.stack : void 8) != null) {
e.stack = stacktrace;

@@ -92,3 +94,3 @@ }

return this.load(this.page + modifier, function(e, data){
if (e != null) {
if ((e != null ? e.stack : void 8) != null) {
e.stack = stacktrace;

@@ -112,3 +114,3 @@ }

return this.load(this.page - modifier, function(e, data){
if (e != null) {
if ((e != null ? e.stack : void 8) != null) {
e.stack = stacktrace;

@@ -135,3 +137,3 @@ }

return self.search(this.tags + (" " + tagMod), myParams, function(e, data){
if (e != null) {
if ((e != null ? e.stack : void 8) != null) {
e.stack = stacktrace;

@@ -168,3 +170,3 @@ }

return self.search(newTags, myParams, function(e, data){
if (e != null) {
if ((e != null ? e.stack : void 8) != null) {
e.stack = stacktrace;

@@ -195,3 +197,5 @@ }

if (e != null) {
e.stack = stacktrace;
if (e.stack != null) {
e.stack = stacktrace;
}
return callback(e, data);

@@ -198,0 +202,0 @@ }

{
"name": "danbooru",
"version": "1.2.0",
"version": "1.3.0",
"description": "danbooru api wrapper",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -34,2 +34,14 @@ # danbooru-node

### Danbooru.request([options], [callback])
A simple wrapper function for [request](https://www.npmjs.com/package/request), with `baseUrl` always set to Danbooru. Please refer to [their documentation](https://www.npmjs.com/package/request#requestoptions-callback) for details.
* `options` _string_. _object_.
* `callback` _function(err, response, body)_
I'm providing this to give you an easy way to download images and make custom requests without having to type Danbooru's url:
```javascript
Danbooru.request('/data/9b5d16968321eff393fea8d735d69de3.jpg')
.pipe(fs.create-write-stream('cutiefox.jpg'));
```
## Authentication

@@ -36,0 +48,0 @@ 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.

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc