booru 2.4.2 → 2.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Utils.js +1 -1
- package/dist/Utils.js.map +1 -1
- package/dist/boorus/Booru.d.ts +6 -0
- package/dist/boorus/Booru.js +1 -1
- package/dist/boorus/Booru.js.map +1 -1
- package/dist/boorus/Derpibooru.js +1 -1
- package/dist/boorus/Derpibooru.js.map +1 -1
- package/dist/sites.json +1 -1
- package/package.json +2 -2
package/dist/Utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.compareArrays=exports.validateSearchParams=exports.randInt=exports.shuffle=exports.jsonfy=exports.resolveSite=void 0;const Constants_1=require("./Constants"),fast_xml_parser_1=require("fast-xml-parser");function resolveSite(t){if("string"!=typeof t)return null;t=t.toLowerCase();for(const r in Constants_1.sites)if(r===t||Constants_1.sites[r].aliases.includes(t))return r;return null}function jsonfy(t){if("object"==typeof t)return t;const r=(0,fast_xml_parser_1.parse)(t,{ignoreAttributes:!1,attributeNamePrefix:""});if(r.html||r["!doctype"]){const t=r.html||r["!doctype"]?.html,e=[];throw t.body.h1&&e.push(t.body.h1),t.body.p&&e.push(t.body.p["#text"]),new Constants_1.BooruError(`The Booru sent back an error: '${e.join(": ")}'`)}return r.posts.post?r.posts.post:r.posts.tag?Array.isArray(r.posts.tag)?r.posts.tag:[r.posts.tag]:[]}function shuffle(t){let r,e,o=t.length;for(;0!==o;)e=Math.floor(Math.random()*o),o-=1,r=t[o],t[o]=t[e],t[e]=r;return t}function randInt(t,r){return t=Math.ceil(t),r=Math.floor(r),Math.floor(Math.random()*(r-t+1))+t}function validateSearchParams(t,r){const e=resolveSite(t);if("number"!=typeof r&&(r=parseInt(r,10)),null===e)throw new Constants_1.BooruError("Site not supported");if("number"!=typeof r||Number.isNaN(r))throw new Constants_1.BooruError("`limit` should be an int");return{site:e,limit:r}}function compareArrays(t,r){return t.filter((t=>r.some((r=>t.toLowerCase()===r.toLowerCase()))))}exports.resolveSite=resolveSite,exports.jsonfy=jsonfy,exports.shuffle=shuffle,exports.randInt=randInt,exports.validateSearchParams=validateSearchParams,exports.compareArrays=compareArrays;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.compareArrays=exports.validateSearchParams=exports.randInt=exports.shuffle=exports.jsonfy=exports.resolveSite=void 0;const Constants_1=require("./Constants"),fast_xml_parser_1=require("fast-xml-parser");function resolveSite(t){if("string"!=typeof t)return null;t=t.toLowerCase();for(const r in Constants_1.sites)if(r===t||Constants_1.sites[r].domain===t||Constants_1.sites[r].aliases.includes(t))return r;return null}function jsonfy(t){if("object"==typeof t)return t;const r=(0,fast_xml_parser_1.parse)(t,{ignoreAttributes:!1,attributeNamePrefix:""});if(r.html||r["!doctype"]){const t=r.html||r["!doctype"]?.html,e=[];throw t.body.h1&&e.push(t.body.h1),t.body.p&&e.push(t.body.p["#text"]),new Constants_1.BooruError(`The Booru sent back an error: '${e.join(": ")}'`)}return r.posts.post?r.posts.post:r.posts.tag?Array.isArray(r.posts.tag)?r.posts.tag:[r.posts.tag]:[]}function shuffle(t){let r,e,o=t.length;for(;0!==o;)e=Math.floor(Math.random()*o),o-=1,r=t[o],t[o]=t[e],t[e]=r;return t}function randInt(t,r){return t=Math.ceil(t),r=Math.floor(r),Math.floor(Math.random()*(r-t+1))+t}function validateSearchParams(t,r){const e=resolveSite(t);if("number"!=typeof r&&(r=parseInt(r,10)),null===e)throw new Constants_1.BooruError("Site not supported");if("number"!=typeof r||Number.isNaN(r))throw new Constants_1.BooruError("`limit` should be an int");return{site:e,limit:r}}function compareArrays(t,r){return t.filter((t=>r.some((r=>t.toLowerCase()===r.toLowerCase()))))}exports.resolveSite=resolveSite,exports.jsonfy=jsonfy,exports.shuffle=shuffle,exports.randInt=randInt,exports.validateSearchParams=validateSearchParams,exports.compareArrays=compareArrays;
|
package/dist/Utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Utils.js","sourceRoot":"","sources":["../src/Utils.ts"],"names":[],"mappings":";;;AAKA,2CAA+C;AAE/C,qDAAmD;AAQnD,SAAgB,WAAW,CAAC,MAAc;IACxC,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;QAC9B,OAAO,IAAI,CAAA;KACZ;IAED,MAAM,GAAG,MAAM,CAAC,WAAW,EAAE,CAAA;IAE7B,KAAK,MAAM,IAAI,IAAI,iBAAK,EAAE;QACxB,
|
|
1
|
+
{"version":3,"file":"Utils.js","sourceRoot":"","sources":["../src/Utils.ts"],"names":[],"mappings":";;;AAKA,2CAA+C;AAE/C,qDAAmD;AAQnD,SAAgB,WAAW,CAAC,MAAc;IACxC,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;QAC9B,OAAO,IAAI,CAAA;KACZ;IAED,MAAM,GAAG,MAAM,CAAC,WAAW,EAAE,CAAA;IAE7B,KAAK,MAAM,IAAI,IAAI,iBAAK,EAAE;QACxB,IACE,IAAI,KAAK,MAAM;YACf,iBAAK,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,MAAM;YAC7B,iBAAK,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,EACpC;YACA,OAAO,IAAI,CAAA;SACZ;KACF;IAED,OAAO,IAAI,CAAA;AACb,CAAC;AAlBD,kCAkBC;AAwBD,SAAgB,MAAM,CAAC,GAAW;IAChC,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,OAAO,GAAG,CAAA;IAEvC,MAAM,IAAI,GAAG,IAAA,uBAAQ,EAAC,GAAG,EAAE;QACzB,gBAAgB,EAAE,KAAK;QACvB,mBAAmB,EAAE,EAAE;KACxB,CAAa,CAAA;IAEd,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,UAAU,CAAC,EAAE;QAGjC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CA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ts
CHANGED
|
@@ -5,6 +5,11 @@ import Site from '../structures/Site';
|
|
|
5
5
|
export interface BooruCredentials {
|
|
6
6
|
token: string;
|
|
7
7
|
}
|
|
8
|
+
interface SearchUrlParams {
|
|
9
|
+
tags: string[];
|
|
10
|
+
limit: number;
|
|
11
|
+
page: number;
|
|
12
|
+
}
|
|
8
13
|
export declare class Booru {
|
|
9
14
|
domain: string;
|
|
10
15
|
site: Site;
|
|
@@ -13,6 +18,7 @@ export declare class Booru {
|
|
|
13
18
|
search(tags: string | string[], { limit, random, page, showUnavailable, }?: SearchParameters): Promise<SearchResults>;
|
|
14
19
|
postView(id: string | number): string;
|
|
15
20
|
protected doSearchRequest(tags: string[] | string, { uri, limit, random, page, }?: InternalSearchParameters): Promise<any>;
|
|
21
|
+
getSearchUrl({ tags, limit, page, }: Partial<SearchUrlParams>): string;
|
|
16
22
|
protected parseSearchResult(result: any, { fakeLimit, tags, limit, random, page, showUnavailable, }: InternalSearchParameters): SearchResults;
|
|
17
23
|
}
|
|
18
24
|
export default Booru;
|
package/dist/boorus/Booru.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var __importDefault=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.Booru=void 0;const node_fetch_1=__importDefault(require("node-fetch")),Constants_1=require("../Constants"),Utils_1=require("../Utils"),Post_1=__importDefault(require("../structures/Post")),SearchResults_1=__importDefault(require("../structures/SearchResults")),resolvedFetch="undefined"!=typeof window?window.fetch.bind(window):node_fetch_1.default;class Booru{domain;site;credentials;constructor(t,e){const s=(0,Utils_1.resolveSite)(t.domain);if(null===s)throw new Error(`Invalid site passed: ${t}`);this.domain=s,this.site=t,this.credentials=e}async search(t,{limit:e=1,random:s=!1,page:r=0,showUnavailable:
|
|
1
|
+
"use strict";var __importDefault=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.Booru=void 0;const node_fetch_1=__importDefault(require("node-fetch")),Constants_1=require("../Constants"),Utils_1=require("../Utils"),Post_1=__importDefault(require("../structures/Post")),SearchResults_1=__importDefault(require("../structures/SearchResults")),resolvedFetch="undefined"!=typeof window?window.fetch.bind(window):node_fetch_1.default;class Booru{domain;site;credentials;constructor(t,e){const s=(0,Utils_1.resolveSite)(t.domain);if(null===s)throw new Error(`Invalid site passed: ${t}`);this.domain=s,this.site=t,this.credentials=e}async search(t,{limit:e=1,random:s=!1,page:r=0,showUnavailable:i=!1}={}){const o=s&&!this.site.random?100:0;try{const a=await this.doSearchRequest(t,{limit:e,random:s,page:r,showUnavailable:i});return this.parseSearchResult(a,{fakeLimit:o,tags:t,limit:e,random:s,page:r,showUnavailable:i})}catch(t){throw t instanceof Error?new Constants_1.BooruError(t):t}}postView(t){if("string"==typeof t&&Number.isNaN(parseInt(t,10)))throw new Constants_1.BooruError(`Not a valid id for postView: ${t}`);return`http${this.site.insecure?"":"s"}://${this.domain}${this.site.api.postView}${t}`}async doSearchRequest(t,{uri:e=null,limit:s=1,random:r=!1,page:i=0}={}){let o;Array.isArray(t)||(t=[t]),r&&(this.site.random?t.push("order:random"):o=100),this.site.defaultTags&&(t=t.concat(this.site.defaultTags.filter((e=>!t.includes(e)))));const a=e||this.getSearchUrl({tags:t,limit:o||s,page:i}),n=Constants_1.defaultOptions,l="xml"===this.site.type;try{const t=await resolvedFetch(a,n);if(503===t.status){if((await t.clone().text()).includes("cf-browser-verification"))throw new Constants_1.BooruError("Received a CloudFlare browser verification request. Can't proceed.")}const e=l?await t.text():await t.json(),s=l?(0,Utils_1.jsonfy)(e):e;if(t.ok)return s;throw new Constants_1.BooruError(`Received HTTP ${t.status} from booru: '${s.error||s.message||JSON.stringify(s)}'`)}catch(t){if("invalid-json"===t.type)return"";throw t}}getSearchUrl({tags:t=[],limit:e=100,page:s=1}){return(0,Constants_1.searchURI)(this.site,t,e,s)}parseSearchResult(t,{fakeLimit:e,tags:s,limit:r,random:i,page:o,showUnavailable:a}){if(!1===t.success)throw new Constants_1.BooruError(t.message||t.reason);let n;t.posts&&(t=t.posts),t.images&&(t=t.images),""===t?n=[]:e?n=(0,Utils_1.shuffle)(t):t.constructor===Object&&(n=[t]);let l=(n||t).slice(0,r).map((t=>new Post_1.default(t,this)));const u={limit:r,random:i,page:o,showUnavailable:a};return void 0===s&&(s=[]),Array.isArray(s)||(s=[s]),a||(l=l.filter((t=>t.available))),new SearchResults_1.default(l,s,u,this)}}exports.Booru=Booru,exports.default=Booru;
|
package/dist/boorus/Booru.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Booru.js","sourceRoot":"","sources":["../../src/boorus/Booru.ts"],"names":[],"mappings":";;;;;;AAKA,4DAA8C;AAC9C,4CAAoE;AACpE,oCAAuD;AAGvD,8DAAqC;AAErC,gFAAuD;AAOvD,MAAM,aAAa,GACjB,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,oBAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"Booru.js","sourceRoot":"","sources":["../../src/boorus/Booru.ts"],"names":[],"mappings":";;;;;;AAKA,4DAA8C;AAC9C,4CAAoE;AACpE,oCAAuD;AAGvD,8DAAqC;AAErC,gFAAuD;AAOvD,MAAM,aAAa,GACjB,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,oBAAK,CAAA;AAuCnE,MAAa,KAAK;IAET,MAAM,CAAQ;IAEd,IAAI,CAAM;IAEV,WAAW,CAAmB;IASrC,YAAY,IAAU,EAAE,WAA8B;QACpD,MAAM,MAAM,GAAG,IAAA,mBAAW,EAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAEvC,IAAI,MAAM,KAAK,IAAI,EAAE;YACnB,MAAM,IAAI,KAAK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
1
|
-
"use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0});const Constants_1=require("../Constants"),Booru_1=__importDefault(require("./Booru"));class Derpibooru extends Booru_1.default{constructor(e,t){super(e,t)}search(e,{limit:t=1,random:r=!1,page:s=0}={}){Array.isArray(e)||(e=[e]),void 0===e[0]&&(e[0]="*"),s+=1;const o=
|
|
1
|
+
"use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0});const Constants_1=require("../Constants"),Booru_1=__importDefault(require("./Booru"));class Derpibooru extends Booru_1.default{constructor(e,t){super(e,t)}search(e,{limit:t=1,random:r=!1,page:s=0}={}){Array.isArray(e)||(e=[e]),void 0===e[0]&&(e[0]="*"),s+=1;const o=this.getSearchUrl({tags:e,limit:t,page:s})+(r&&"string"===this.site.random?`&${this.site.random}`:"")+(this.credentials?`&key=${this.credentials.token}`:"");return super.doSearchRequest(e,{limit:t,random:r,page:s,uri:o}).then((o=>super.parseSearchResult(o,{fakeLimit:0,tags:e,limit:t,random:r,page:s}))).catch((e=>Promise.reject(new Constants_1.BooruError(e))))}}exports.default=Derpibooru;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Derpibooru.js","sourceRoot":"","sources":["../../src/boorus/Derpibooru.ts"],"names":[],"mappings":";;;;;AAKA,
|
|
1
|
+
{"version":3,"file":"Derpibooru.js","sourceRoot":"","sources":["../../src/boorus/Derpibooru.ts"],"names":[],"mappings":";;;;;AAKA,4CAAyC;AAIzC,oDAAiD;AASjD,MAAqB,UAAW,SAAQ,eAAK;IAM3C,YAAY,IAAU,EAAE,WAA8B;QACpD,KAAK,CAAC,IAAI,EAAE,WAAW,CAAC,CAAA;IAC1B,CAAC;IAGM,MAAM,CACX,IAAuB,EACvB,EAAE,KAAK,GAAG,CAAC,EAAE,MAAM,GAAG,KAAK,EAAE,IAAI,GAAG,CAAC,KAAuB,EAAE;QAE9D,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YACxB,IAAI,GAAG,CAAC,IAAI,CAAC,CAAA;SACd;QAGD,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,SAAS,EAAE;YACzB,IAAI,CAAC,CAAC,CAAC,GAAG,GAAG,CAAA;SACd;QAGD,IAAI,IAAI,CAAC,CAAA;QAET,MAAM,GAAG,GACP,IAAI,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;YACxC,CAAC,MAAM,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACvE,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;QAE5D,OAAO,KAAK;aACT,eAAe,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;aACnD,IAAI,CAAC,CAAC,CAAC,EAAE,CACR,KAAK,CAAC,iBAAiB,CAAC,CAAC,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CACxE;aACA,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,sBAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IAClD,CAAC;CACF;AAvCD,6BAuCC"}
|
package/dist/sites.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"e621.net":{"domain":"e621.net","aliases":["e6","e621"],"nsfw":true,"api":{"search":"/posts.json?","postView":"/post/show/"},"random":true},"e926.net":{"domain":"e926.net","aliases":["e9","e926"],"nsfw":false,"api":{"search":"/posts.json?","postView":"/post/show/"},"random":true,"defaultTags":["rating:safe"]},"hypnohub.net":{"domain":"hypnohub.net","aliases":["hh","hypno","hypnohub"],"nsfw":true,"api":{"search":"/post/index.json?","postView":"/post/show/"},"random":true},"danbooru.donmai.us":{"domain":"danbooru.donmai.us","aliases":["db","dan","danbooru"],"nsfw":true,"api":{"search":"/posts.json?","postView":"/posts/"},"random":true},"konachan.com":{"domain":"konachan.com","aliases":["kc","konac","kcom"],"nsfw":true,"api":{"search":"/post.json?","postView":"/post/show/"},"random":true},"konachan.net":{"domain":"konachan.net","aliases":["kn","konan","knet"],"nsfw":false,"api":{"search":"/post.json?","postView":"/post/show/"},"random":true},"yande.re":{"domain":"yande.re","aliases":["yd","yand","yandere"],"nsfw":true,"api":{"search":"/post.json?","postView":"/post/show/"},"random":true},"gelbooru.com":{"domain":"gelbooru.com","aliases":["gb","gel","gelbooru"],"nsfw":true,"api":{"search":"/index.php?page=dapi&s=post&q=index&json=1&","postView":"/index.php?page=post&s=view&json=1&id="},"paginate":"pid","random":false},"rule34.xxx":{"domain":"rule34.xxx","aliases":["r34","rule34"],"nsfw":true,"api":{"search":"/index.php?page=dapi&s=post&q=index&json=1&","postView":"/index.php?page=post&s=view&json=1&id="},"paginate":"pid","random":false},"safebooru.org":{"domain":"safebooru.org","aliases":["sb","safe","safebooru"],"nsfw":false,"api":{"search":"/index.php?page=dapi&s=post&q=index&json=1&","postView":"/index.php?page=post&s=view&json=1&id="},"paginate":"pid","random":false},"tbib.org":{"domain":"tbib.org","aliases":["tb","tbib","big"],"nsfw":false,"api":{"search":"/index.php?page=dapi&s=post&q=index&json=1&","postView":"/index.php?page=post&s=view&json=1&id="},"paginate":"pid","random":false},"xbooru.com":{"domain":"xbooru.com","aliases":["xb","xbooru"],"nsfw":true,"api":{"search":"/index.php?page=dapi&s=post&q=index&json=1&","postView":"/index.php?page=post&s=view&json=1&id="},"paginate":"pid","random":false},"rule34.paheal.net":{"domain":"rule34.paheal.net","type":"xml","aliases":["pa","paheal"],"nsfw":true,"api":{"search":"/api/danbooru/find_posts/index.xml?","postView":"/post/view/"},"random":false},"derpibooru.org":{"domain":"derpibooru.org","type":"derpi","aliases":["dp","derp","derpi","derpibooru"],"nsfw":true,"api":{"search":"/api/v1/json/search/images?","postView":"/images/"},"tagQuery":"q","random":"sf=random"},"realbooru.com":{"domain":"realbooru.com","aliases":["rb","realbooru"],"nsfw":true,"api":{"search":"/index.php?page=dapi&s=post&q=index&json=1&","postView":"/index.php?page=post&s=view&id="},"paginate":"pid","random":false}}
|
|
1
|
+
{"e621.net":{"domain":"e621.net","aliases":["e6","e621"],"nsfw":true,"api":{"search":"/posts.json?","postView":"/post/show/"},"random":true},"e926.net":{"domain":"e926.net","aliases":["e9","e926"],"nsfw":false,"api":{"search":"/posts.json?","postView":"/post/show/"},"random":true,"defaultTags":["rating:safe"]},"hypnohub.net":{"domain":"hypnohub.net","aliases":["hh","hypno","hypnohub"],"nsfw":true,"api":{"search":"/post/index.json?","postView":"/post/show/"},"random":true},"danbooru.donmai.us":{"domain":"danbooru.donmai.us","aliases":["db","dan","danbooru"],"nsfw":true,"api":{"search":"/posts.json?","postView":"/posts/"},"random":true},"konachan.com":{"domain":"konachan.com","aliases":["kc","konac","kcom"],"nsfw":true,"api":{"search":"/post.json?","postView":"/post/show/"},"random":true},"konachan.net":{"domain":"konachan.net","aliases":["kn","konan","knet"],"nsfw":false,"api":{"search":"/post.json?","postView":"/post/show/"},"random":true},"yande.re":{"domain":"yande.re","aliases":["yd","yand","yandere"],"nsfw":true,"api":{"search":"/post.json?","postView":"/post/show/"},"random":true},"gelbooru.com":{"domain":"gelbooru.com","aliases":["gb","gel","gelbooru"],"nsfw":true,"api":{"search":"/index.php?page=dapi&s=post&q=index&json=1&","postView":"/index.php?page=post&s=view&json=1&id="},"paginate":"pid","random":false},"rule34.xxx":{"domain":"api.rule34.xxx","aliases":["r34","rule34"],"nsfw":true,"api":{"search":"/index.php?page=dapi&s=post&q=index&json=1&","postView":"/index.php?page=post&s=view&json=1&id="},"paginate":"pid","random":false},"safebooru.org":{"domain":"safebooru.org","aliases":["sb","safe","safebooru"],"nsfw":false,"api":{"search":"/index.php?page=dapi&s=post&q=index&json=1&","postView":"/index.php?page=post&s=view&json=1&id="},"paginate":"pid","random":false},"tbib.org":{"domain":"tbib.org","aliases":["tb","tbib","big"],"nsfw":false,"api":{"search":"/index.php?page=dapi&s=post&q=index&json=1&","postView":"/index.php?page=post&s=view&json=1&id="},"paginate":"pid","random":false},"xbooru.com":{"domain":"xbooru.com","aliases":["xb","xbooru"],"nsfw":true,"api":{"search":"/index.php?page=dapi&s=post&q=index&json=1&","postView":"/index.php?page=post&s=view&json=1&id="},"paginate":"pid","random":false},"rule34.paheal.net":{"domain":"rule34.paheal.net","type":"xml","aliases":["pa","paheal"],"nsfw":true,"api":{"search":"/api/danbooru/find_posts/index.xml?","postView":"/post/view/"},"random":false},"derpibooru.org":{"domain":"derpibooru.org","type":"derpi","aliases":["dp","derp","derpi","derpibooru"],"nsfw":true,"api":{"search":"/api/v1/json/search/images?","postView":"/images/"},"tagQuery":"q","random":"sf=random"},"realbooru.com":{"domain":"realbooru.com","aliases":["rb","realbooru"],"nsfw":true,"api":{"search":"/index.php?page=dapi&s=post&q=index&json=1&","postView":"/index.php?page=post&s=view&id="},"paginate":"pid","random":false}}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "booru",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.3",
|
|
4
4
|
"description": "Search (and do other things) on a bunch of different boorus!",
|
|
5
5
|
"author": "AtoraSuunva (https://github.com/AtoraSuunva/)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"scripts": {
|
|
19
19
|
"test": "jest",
|
|
20
20
|
"lint": "eslint -c .eslintrc.js --ext .ts ./src",
|
|
21
|
-
"clean": "rimraf ./dist",
|
|
21
|
+
"clean": "rimraf ./dist && rm tsconfig.tsbuildinfo",
|
|
22
22
|
"prebuild": "npm run clean && npm run lint",
|
|
23
23
|
"build": "tsc --sourceMap",
|
|
24
24
|
"build-dev": "tsc --sourceMap",
|