booru 2.5.7 → 2.6.0
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/Constants.d.ts +5 -5
- package/dist/Constants.js +1 -1
- package/dist/Constants.js.map +1 -1
- package/dist/Utils.d.ts +32 -1
- package/dist/Utils.js +1 -1
- package/dist/Utils.js.map +1 -1
- package/dist/boorus/Booru.d.ts +2 -4
- package/dist/boorus/Booru.js +1 -1
- package/dist/boorus/Booru.js.map +1 -1
- package/dist/index.d.ts +7 -4
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/structures/Post.js +1 -1
- package/dist/structures/Post.js.map +1 -1
- package/dist/structures/SearchParameters.d.ts +0 -3
- package/package.json +1 -1
package/dist/Constants.d.ts
CHANGED
|
@@ -3,15 +3,14 @@
|
|
|
3
3
|
* @module Constants
|
|
4
4
|
*/
|
|
5
5
|
import { RequestInit } from 'undici';
|
|
6
|
+
import { BooruCredentials } from './boorus/Booru';
|
|
6
7
|
import Site from './structures/Site';
|
|
7
8
|
import SiteInfo from './structures/SiteInfo';
|
|
8
|
-
export
|
|
9
|
-
[key: string]: V;
|
|
10
|
-
}
|
|
9
|
+
export declare type AnySite = 'e621.net' | 'e926.net' | 'hypnohub.net' | 'danbooru.donmai.us' | 'konachan.com' | 'konachan.net' | 'yande.re' | 'gelbooru.com' | 'rule34.xxx' | 'safebooru.org' | 'tbib.org' | 'xbooru.com' | 'rule34.paheal.net' | 'derpibooru.org' | 'realbooru.com';
|
|
11
10
|
/**
|
|
12
11
|
* A map of site url/{@link SiteInfo}
|
|
13
12
|
*/
|
|
14
|
-
export declare const sites:
|
|
13
|
+
export declare const sites: Record<AnySite, SiteInfo>;
|
|
15
14
|
/**
|
|
16
15
|
* Custom error type for when the boorus error or for user-side error, not my code (probably)
|
|
17
16
|
* <p>The name of the error is 'BooruError'
|
|
@@ -34,8 +33,9 @@ export declare const USER_AGENT = "booru (https://github.com/AtoraSuunva/booru)"
|
|
|
34
33
|
* @param {string[]} [tags=[]] The tags to search for
|
|
35
34
|
* @param {number} [limit=100] The limit for images to return
|
|
36
35
|
* @param {number} [page=0] The page to get
|
|
36
|
+
* @param {BooryCredentials} [credentials] The credentials to use for the search, appended to the querystring
|
|
37
37
|
*/
|
|
38
|
-
export declare function searchURI(site: Site, tags
|
|
38
|
+
export declare function searchURI(site: Site, tags?: string[], limit?: number, page?: number, credentials?: BooruCredentials): string;
|
|
39
39
|
/**
|
|
40
40
|
* The default options to use for requests
|
|
41
41
|
* <p>I could document this better but meh
|
package/dist/Constants.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var __importDefault=this&&this.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.defaultOptions=exports.searchURI=exports.USER_AGENT=exports.BooruError=exports.sites=void 0;const sites_json_1=__importDefault(require("./sites.json")),expandedTags={"rating:e":"rating:explicit","rating:q":"rating:questionable","rating:s":"rating:safe"};exports.sites=sites_json_1.default;class BooruError extends Error{constructor(r){super(r instanceof Error?r.message:r),r instanceof Error?this.stack=r.stack:Error.captureStackTrace(this,BooruError),this.name="BooruError"}}function expandTags(r){return r.map((r=>{const
|
|
1
|
+
"use strict";var __importDefault=this&&this.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.defaultOptions=exports.searchURI=exports.USER_AGENT=exports.BooruError=exports.sites=void 0;const sites_json_1=__importDefault(require("./sites.json")),Utils_1=require("./Utils"),expandedTags={"rating:e":"rating:explicit","rating:q":"rating:questionable","rating:s":"rating:safe"};exports.sites=sites_json_1.default;class BooruError extends Error{constructor(r){super(r instanceof Error?r.message:r),r instanceof Error?this.stack=r.stack:Error.captureStackTrace(this,BooruError),this.name="BooruError"}}function expandTags(r){return r.map((r=>{const t=expandedTags[r.toLowerCase()];return encodeURIComponent(t||r)}))}function searchURI(r,t=[],e=100,o=0,s={}){const a=(0,Utils_1.querystring)({[r.tagQuery]:expandTags(t).join(r.tagJoin),limit:e,[r.paginate]:o,...s});return`http${r.insecure?"":"s"}://${r.domain}${r.api.search}`+a}exports.BooruError=BooruError,exports.USER_AGENT="booru (https://github.com/AtoraSuunva/booru)",exports.searchURI=searchURI,exports.defaultOptions={headers:{Accept:"application/json, application/xml;q=0.9, */*;q=0.8","User-Agent":exports.USER_AGENT}};
|
package/dist/Constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Constants.js","sourceRoot":"","sources":["../src/Constants.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;
|
|
1
|
+
{"version":3,"file":"Constants.js","sourceRoot":"","sources":["../src/Constants.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAIH,8DAAmC;AAGnC,mCAAqC;AA2BrC,MAAM,YAAY,GAAY;IAC5B,UAAU,EAAE,iBAAiB;IAC7B,UAAU,EAAE,qBAAqB;IACjC,UAAU,EAAE,aAAa;CAC1B,CAAA;AAED;;GAEG;AACU,QAAA,KAAK,GAAG,oBAAqC,CAAA;AAE1D;;;;GAIG;AACH,MAAa,UAAW,SAAQ,KAAK;IACnC,YAAY,OAAuB;QACjC,KAAK,CAAC,OAAO,YAAY,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;QAE3D,IAAI,OAAO,YAAY,KAAK,EAAE;YAC5B,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAA;SAC3B;aAAM;YACL,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAA;SAC1C;QAED,IAAI,CAAC,IAAI,GAAG,YAAY,CAAA;IAC1B,CAAC;CACF;AAZD,gCAYC;AAED;;;GAGG;AACU,QAAA,UAAU,GAAG,8CAA8C,CAAA;AAExE;;;;;GAKG;AACH,SAAS,UAAU,CAAC,IAAc;IAChC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;QACpB,MAAM,EAAE,GAAG,YAAY,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAA;QACxC,OAAO,kBAAkB,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IACxC,CAAC,CAAC,CAAA;AACJ,CAAC;AAED;;;;;;;;;;GAUG;AACH,SAAgB,SAAS,CACvB,IAAU,EACV,OAAiB,EAAE,EACnB,KAAK,GAAG,GAAG,EACX,IAAI,GAAG,CAAC,EACR,cAAgC,EAAE;IAElC,MAAM,KAAK,GAAG,IAAA,mBAAW,EAAC;QACxB,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC;QACpD,KAAK;QACL,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,IAAI;QACrB,GAAG,WAAW;KACf,CAAC,CAAA;IAEF,OAAO,CACL,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK;QACpC,GAAG,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE;QAClC,KAAK,CACN,CAAA;AACH,CAAC;AAnBD,8BAmBC;AAED;;;;;GAKG;AACU,QAAA,cAAc,GAAgB;IACzC,OAAO,EAAE;QACP,MAAM,EAAE,oDAAoD;QAC5D,YAAY,EAAE,kBAAU;KACzB;CACF,CAAA"}
|
package/dist/Utils.d.ts
CHANGED
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
* @packageDocumentation
|
|
3
3
|
* @module Utils
|
|
4
4
|
*/
|
|
5
|
+
import { AnySite } from './Constants';
|
|
5
6
|
/**
|
|
6
7
|
* Check if `site` is a supported site (and check if it's an alias and return the sites's true name)
|
|
7
8
|
*
|
|
8
9
|
* @param {String} domain The site to resolveSite
|
|
9
10
|
* @return {String?} null if site is not supported, the site otherwise
|
|
10
11
|
*/
|
|
11
|
-
export declare function resolveSite(domain: string):
|
|
12
|
+
export declare function resolveSite(domain: string): AnySite | null;
|
|
12
13
|
/**
|
|
13
14
|
* Parses xml to json, which can be used with js
|
|
14
15
|
*
|
|
@@ -17,6 +18,14 @@ export declare function resolveSite(domain: string): string | null;
|
|
|
17
18
|
* @return {Object[]} A Promise with an array of objects created from the xml
|
|
18
19
|
*/
|
|
19
20
|
export declare function jsonfy(xml: string): object[];
|
|
21
|
+
/**
|
|
22
|
+
* Try to parse JSON, and then return an empty array if data is an empty string, or the parsed JSON
|
|
23
|
+
*
|
|
24
|
+
* Blame rule34.xxx for returning literally an empty response with HTTP 200 for this
|
|
25
|
+
* @param data The data to try and parse
|
|
26
|
+
* @returns Either the parsed data, or an empty array
|
|
27
|
+
*/
|
|
28
|
+
export declare function tryParseJSON(data: string): Record<string, unknown>[];
|
|
20
29
|
/**
|
|
21
30
|
* Yay fisher-bates
|
|
22
31
|
* Taken from http://stackoverflow.com/a/2450976
|
|
@@ -54,3 +63,25 @@ export declare function validateSearchParams(site: string, limit: number | strin
|
|
|
54
63
|
* @return {String[]} The shared strings between the arrays
|
|
55
64
|
*/
|
|
56
65
|
export declare function compareArrays(arr1: string[], arr2: string[]): string[];
|
|
66
|
+
declare type URIEncodable = string | number | boolean;
|
|
67
|
+
declare type QueryValue = URIEncodable | URIEncodable[];
|
|
68
|
+
/**
|
|
69
|
+
* Turns an object into a query string, correctly encoding uri components
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* const options = { page: 10, limit: 100 }
|
|
73
|
+
* const query = querystring(options) // 'page=10&limit=100'
|
|
74
|
+
* console.log(`https://example.com?${query}`)
|
|
75
|
+
*
|
|
76
|
+
* @param query An object with key/value pairs that will be turned into a string
|
|
77
|
+
* @returns A string that can be appended to a url (after `?`)
|
|
78
|
+
*/
|
|
79
|
+
export declare function querystring(query: Record<string, QueryValue>): string;
|
|
80
|
+
/**
|
|
81
|
+
* Encodes a single value or an array of values to be usable in as a URI component,
|
|
82
|
+
* joining array elements with '+'
|
|
83
|
+
* @param value The value to encode
|
|
84
|
+
* @returns An encoded value that can be passed to a querystring
|
|
85
|
+
*/
|
|
86
|
+
export declare function encodeURIQueryValue(value: QueryValue): string;
|
|
87
|
+
export {};
|
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(
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.encodeURIQueryValue=exports.querystring=exports.compareArrays=exports.validateSearchParams=exports.randInt=exports.shuffle=exports.tryParseJSON=exports.jsonfy=exports.resolveSite=void 0;const Constants_1=require("./Constants"),fast_xml_parser_1=require("fast-xml-parser");function resolveSite(e){if("string"!=typeof e)return null;e=e.toLowerCase();for(const[r,t]of Object.entries(Constants_1.sites))if(r===e||t.domain===e||t.aliases.includes(e))return r;return null}exports.resolveSite=resolveSite;const xmlParser=new fast_xml_parser_1.XMLParser({ignoreAttributes:!1,attributeNamePrefix:""});function jsonfy(e){if("object"==typeof e)return e;const r=xmlParser.parse(e);if(r.html||r["!doctype"]){const e=r.html||r["!doctype"]?.html,t=[];throw e.body.h1&&t.push(e.body.h1),e.body.p&&t.push(e.body.p["#text"]),new Constants_1.BooruError(`The Booru sent back an error: '${t.join(": ")}'`)}return r.posts.post?r.posts.post:r.posts.tag?Array.isArray(r.posts.tag)?r.posts.tag:[r.posts.tag]:[]}function tryParseJSON(e){return""===e?[]:JSON.parse(e)}function shuffle(e){let r,t,o=e.length;for(;0!==o;)t=Math.floor(Math.random()*o),o-=1,r=e[o],e[o]=e[t],e[t]=r;return e}function randInt(e,r){return e=Math.ceil(e),r=Math.floor(r),Math.floor(Math.random()*(r-e+1))+e}function validateSearchParams(e,r){const t=resolveSite(e);if("number"!=typeof r&&(r=parseInt(r,10)),null===t)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:t,limit:r}}function compareArrays(e,r){return e.filter((e=>r.some((r=>e.toLowerCase()===r.toLowerCase()))))}function querystring(e){return Object.entries(e).map((([e,r])=>`${encodeURIComponent(e)}=${encodeURIQueryValue(r)}`)).join("&")}function encodeURIQueryValue(e){return Array.isArray(e)?e.map(encodeURIComponent).join("+"):encodeURIComponent(e)}exports.jsonfy=jsonfy,exports.tryParseJSON=tryParseJSON,exports.shuffle=shuffle,exports.randInt=randInt,exports.validateSearchParams=validateSearchParams,exports.compareArrays=compareArrays,exports.querystring=querystring,exports.encodeURIQueryValue=encodeURIQueryValue;
|
package/dist/Utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Utils.js","sourceRoot":"","sources":["../src/Utils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,
|
|
1
|
+
{"version":3,"file":"Utils.js","sourceRoot":"","sources":["../src/Utils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2CAAwD;AAExD,qDAA2C;AAE3C;;;;;GAKG;AACH,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,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,iBAAK,CAAC,EAAE;QAChD,IACE,IAAI,KAAK,MAAM;YACf,IAAI,CAAC,MAAM,KAAK,MAAM;YACtB,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,EAC7B;YACA,OAAO,IAAe,CAAA;SACvB;KACF;IAED,OAAO,IAAI,CAAA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A;KAC/C;SAAM;QACL,OAAO,kBAAkB,CAAC,KAAK,CAAC,CAAA;KACjC;AACH,CAAC;AAND,kDAMC"}
|
package/dist/boorus/Booru.d.ts
CHANGED
|
@@ -6,9 +6,7 @@ import InternalSearchParameters from '../structures/InternalSearchParameters';
|
|
|
6
6
|
import SearchParameters from '../structures/SearchParameters';
|
|
7
7
|
import SearchResults from '../structures/SearchResults';
|
|
8
8
|
import Site from '../structures/Site';
|
|
9
|
-
export
|
|
10
|
-
token: string;
|
|
11
|
-
}
|
|
9
|
+
export declare type BooruCredentials = Record<string, string>;
|
|
12
10
|
interface SearchUrlParams {
|
|
13
11
|
tags: string[];
|
|
14
12
|
limit: number;
|
|
@@ -78,7 +76,7 @@ export declare class Booru {
|
|
|
78
76
|
* @param {number} [opt.page] The page of results to return
|
|
79
77
|
* @returns A URL to search the booru
|
|
80
78
|
*/
|
|
81
|
-
getSearchUrl({ tags, limit, page, }
|
|
79
|
+
getSearchUrl({ tags, limit, page, }?: Partial<SearchUrlParams>): string;
|
|
82
80
|
/**
|
|
83
81
|
* Parse the response from the booru
|
|
84
82
|
*
|
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 undici_1=require("undici"),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):undici_1.fetch;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,
|
|
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 undici_1=require("undici"),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):undici_1.fetch;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&&(await t.clone().text()).includes("cf-browser-verification"))throw new Constants_1.BooruError("Received a CloudFlare browser verification request. Can't proceed.");const e=await t.text(),s=l?(0,Utils_1.jsonfy)(e):(0,Utils_1.tryParseJSON)(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,this.credentials)}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["@attributes"]&&(t="0"!==t["@attributes"].count&&t.post?Array.isArray(t.post)?t.post:[t.post]:[]),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":";AAAA;;;GAGG;;;;;;AAEH,mCAA8B;AAC9B,4CAAoE;AACpE,
|
|
1
|
+
{"version":3,"file":"Booru.js","sourceRoot":"","sources":["../../src/boorus/Booru.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;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
5
|
+
import Booru, { BooruCredentials } from './boorus/Booru';
|
|
6
6
|
import Post from './structures/Post';
|
|
7
7
|
import SearchParameters from './structures/SearchParameters';
|
|
8
8
|
import SearchResults from './structures/SearchResults';
|
|
@@ -11,12 +11,15 @@ import SearchResults from './structures/SearchResults';
|
|
|
11
11
|
*
|
|
12
12
|
* @constructor
|
|
13
13
|
* @param {String} site The {@link Site} domain (or alias of it) to create a booru from
|
|
14
|
-
* @param {
|
|
14
|
+
* @param {BooruCredentials} credentials The credentials to use on this booru
|
|
15
15
|
* @return {Booru} A booru to use
|
|
16
16
|
*/
|
|
17
|
-
declare function booruForSite(site: string, credentials?:
|
|
17
|
+
declare function booruForSite(site: string, credentials?: BooruCredentials): Booru;
|
|
18
18
|
export { booruForSite as forSite };
|
|
19
19
|
export default booruForSite;
|
|
20
|
+
export interface BooruSearch extends SearchParameters {
|
|
21
|
+
credentials?: BooruCredentials;
|
|
22
|
+
}
|
|
20
23
|
/**
|
|
21
24
|
* Searches a site for images with tags and returns the results
|
|
22
25
|
* @param {String} site The site to search
|
|
@@ -32,7 +35,7 @@ export default booruForSite;
|
|
|
32
35
|
* Booru.search('e926', ['glaceon', 'cute'])
|
|
33
36
|
* ```
|
|
34
37
|
*/
|
|
35
|
-
export declare function search(site: string, tags?: string[] | string, { limit, random, page, credentials }?:
|
|
38
|
+
export declare function search(site: string, tags?: string[] | string, { limit, random, page, credentials }?: BooruSearch): Promise<SearchResults>;
|
|
36
39
|
/**
|
|
37
40
|
* Deprecated, now a noop
|
|
38
41
|
* <p>This will be removed *soon* please stop using it</p>
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var __importDefault=this&&this.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.BooruError=exports.resolveSite=exports.sites=exports.BooruClass=exports.commonfy=exports.search=exports.forSite=void 0;const Constants_1=require("./Constants"),util_1=require("util"),Booru_1=__importDefault(require("./boorus/Booru")),Derpibooru_1=__importDefault(require("./boorus/Derpibooru")),XmlBooru_1=__importDefault(require("./boorus/XmlBooru")),Site_1=__importDefault(require("./structures/Site")),Utils_1=require("./Utils"),BooruTypes={derpi:Derpibooru_1.default,xml:XmlBooru_1.default},booruCache={};function booruFrom(r,e){return new(void 0!==r.type&&BooruTypes[r.type]?BooruTypes[r.type]:Booru_1.default)(r,e)}function booruForSite(r,e
|
|
1
|
+
"use strict";var __importDefault=this&&this.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.BooruError=exports.resolveSite=exports.sites=exports.BooruClass=exports.commonfy=exports.search=exports.forSite=void 0;const Constants_1=require("./Constants"),util_1=require("util"),Booru_1=__importDefault(require("./boorus/Booru")),Derpibooru_1=__importDefault(require("./boorus/Derpibooru")),XmlBooru_1=__importDefault(require("./boorus/XmlBooru")),Site_1=__importDefault(require("./structures/Site")),Utils_1=require("./Utils"),BooruTypes={derpi:Derpibooru_1.default,xml:XmlBooru_1.default},booruCache={};function booruFrom(r,e){return new(void 0!==r.type&&BooruTypes[r.type]?BooruTypes[r.type]:Booru_1.default)(r,e)}function booruForSite(r,e){const o=(0,Utils_1.resolveSite)(r);if(!o)throw new Constants_1.BooruError("Site not supported");return booruFrom(new Site_1.default(Constants_1.sites[o]),e)}function search(r,e=[],{limit:o=1,random:t=!1,page:s=0,credentials:u={}}={}){const n=(0,Utils_1.resolveSite)(r);if("string"==typeof o&&(o=parseInt(o,10)),null===n)throw new Constants_1.BooruError("Site not supported");if(!Array.isArray(e)&&"string"!=typeof e)throw new Constants_1.BooruError("`tags` should be an array or string");if("number"!=typeof o||Number.isNaN(o))throw new Constants_1.BooruError("`limit` should be an int");const i=new Site_1.default(Constants_1.sites[n]);return booruCache[n]||(booruCache[n]=booruFrom(i,u)),booruCache[n].credentials=u,booruCache[n].search(e,{limit:o,random:t,page:s})}exports.forSite=booruForSite,exports.default=booruForSite,exports.search=search;const deprecatedCommonfy=(0,util_1.deprecate)((()=>{}),"Common is now deprecated, just access the properties directly");function commonfy(r){return deprecatedCommonfy(),Promise.resolve(r)}exports.commonfy=commonfy;var Booru_2=require("./boorus/Booru");Object.defineProperty(exports,"BooruClass",{enumerable:!0,get:function(){return Booru_2.Booru}});var Constants_2=require("./Constants");Object.defineProperty(exports,"sites",{enumerable:!0,get:function(){return Constants_2.sites}});var Utils_2=require("./Utils");Object.defineProperty(exports,"resolveSite",{enumerable:!0,get:function(){return Utils_2.resolveSite}});var Constants_3=require("./Constants");Object.defineProperty(exports,"BooruError",{enumerable:!0,get:function(){return Constants_3.BooruError}});
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,2CAAwD;AAExD,+BAAgC;AAChC,2DAAwD;AACxD,qEAA4C;AAC5C,iEAAwC;AAIxC,6DAAoC;AACpC,mCAAqC;AAErC,MAAM,UAAU,GAAiC;IAC/C,KAAK,EAAE,oBAAU;IACjB,GAAG,EAAE,kBAAQ;CACd,CAAA;AAED,MAAM,UAAU,GAAoC,EAAE,CAAA;AAEtD;;;;;;GAMG;AACH,SAAS,SAAS,CAAC,SAAe,EAAE,WAA8B;IAChE,OAAO,IAAI,CACT,SAAS,CAAC,IAAI,KAAK,SAAS,IAAI,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC;QACxD,CAAC,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC;QAC5B,CAAC,CAAC,eAAK,CACV,CAAC,SAAS,EAAE,WAAW,CAAC,CAAA;AAC3B,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,YAAY,CAAC,IAAY,EAAE,WAA8B;IAChE,MAAM,KAAK,GAAG,IAAA,mBAAW,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AC,SAAS,EAAE,WAAW,CAAC,CAAA;KACtD;IAED,uCAAuC;IACvC,UAAU,CAAC,KAAK,CAAE,CAAC,WAAW,GAAG,WAAW,CAAA;IAC5C,OAAO,UAAU,CAAC,KAAK,CAAE,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAA;AACjE,CAAC;AAhCD,wBAgCC;AAED,yEAAyE;AACzE,MAAM,kBAAkB,GAAG,IAAA,gBAAS,EAAC,GAAG,EAAE,GAAE,CAAC,EAC7C,+DAA+D,CAAC,CAAA;AAEhE;;;;;;;;GAQG;AACH,SAAgB,QAAQ,CAAC,MAAc;IACrC,kBAAkB,EAAE,CAAA;IACpB,OAAO,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;AAChC,CAAC;AAHD,4BAGC;AAED,wCAAoD;AAA3C,mGAAA,KAAK,OAAc;AAC5B,yCAAmC;AAA1B,kGAAA,KAAK,OAAA;AACd,iCAAqC;AAA5B,oGAAA,WAAW,OAAA;AACpB,yCAAwC;AAA/B,uGAAA,UAAU,OAAA"}
|
package/dist/structures/Post.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const util_1=require("util"),common=(0,util_1.deprecate)((()=>{}),"Common is now deprecated, just access the properties directly");function parseImageUrl(e,t,r){if(!e||""===e.trim()||t.is_deleted)return null;if(e.startsWith("/data")&&(e=`https://danbooru.donmai.us${e}`),e.startsWith("/cached")&&(e=`https://danbooru.donmai.us${e}`),e.startsWith("/_images")&&(e=`https://dollbooru.org${e}`),e.startsWith("//derpicdn.net")&&(e=`https:${t.image}`),!t.file_url&&void 0!==t.directory){const i=t.directory??`${t.hash.substr(0,2)}/${t.hash.substr(2,2)}`;e=`//${r.domain}/images/${i}/${t.image}`}return e.startsWith("http")||(e=`https:${e}`),encodeURI(e)}function getTags(e){let t=[];return Array.isArray(e.tags)?t=e.tags:e.tags&&e.tags.general?t=Object.values(e.tags).reduce(((e,t)=>e.concat(t)),[]):"string"==typeof e.tags?t=fromTagString(e.tags):"string"==typeof e.tag_string&&(t=fromTagString(e.tag_string)),t.filter((e=>""!==e))}function fromTagString(e){return e.split(" ").map((e=>e.replace(/,/g,"")))}class Post{booru;fileUrl;height;width;sampleUrl;sampleHeight;sampleWidth;previewUrl;previewHeight;previewWidth;id;available;tags;score;source;rating;createdAt;data;constructor(e,t){this.data=e,this.booru=t;const r=e.is_deleted||e.is_banned;this.fileUrl=parseImageUrl(e.file_url||e.image||(r?e.source:void 0)||e.file&&e.file.url||e.representations&&e.representations.full,e,t),this.available=!r&&null!==this.fileUrl,this.height=parseInt(e.height||e.image_height||e.file&&e.file.height,10),this.width=parseInt(e.width||e.image_width||e.file&&e.file.width,10),this.sampleUrl=parseImageUrl(e.sample_url||e.large_file_url||e.representations&&e.representations.large||e.sample&&e.sample.url,e,t),this.sampleHeight=parseInt(e.sample_height||e.sample&&e.sample.height,10),this.sampleWidth=parseInt(e.sample_width||e.sample&&e.sample.width,10),this.previewUrl=parseImageUrl(e.preview_url||e.preview_file_url||e.representations&&e.representations.small||e.preview&&e.preview.url,e,t),this.previewHeight=parseInt(e.preview_height||e.preview&&e.preview.height,10),this.previewWidth=parseInt(e.preview_width||e.preview&&e.preview.width,10),this.id=e.id?e.id.toString():"No ID available",this.tags=getTags(e),e.score&&e.score.total?this.score=e.score.total:this.score=e.score?parseInt(e.score,10):e.score,this.source=e.source||e.sources||e.source_url,this.rating=e.rating||/(safe|suggestive|questionable|explicit)/i.exec(e.tags)||"u",Array.isArray(this.rating)&&(this.rating=this.rating[0]),"suggestive"===this.rating&&(this.rating="q"),this.rating=this.rating.charAt(0),this.createdAt=null,"object"==typeof e.created_at?this.createdAt=new Date(1e3*e.created_at.s+e.created_at.n/1e9):"number"==typeof e.created_at?this.createdAt=new Date(1e3*e.created_at):"number"==typeof e.change?this.createdAt=new Date(1e3*e.change):this.createdAt=new Date(e.created_at||e.date)}get file_url(){return this.fileUrl}get sample_url(){return this.sampleUrl}get sample_height(){return this.sampleHeight}get sample_width(){return this.sampleWidth}get preview_url(){return this.previewUrl}get preview_height(){return this.previewHeight}get preview_width(){return this.previewWidth}get postView(){return this.booru.postView(this.id)}get common(){return common(),this}}exports.default=Post;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const util_1=require("util"),common=(0,util_1.deprecate)((()=>{}),"Common is now deprecated, just access the properties directly");function parseImageUrl(e,t,r){if(!e||""===e.trim()||t.is_deleted)return null;if(e.startsWith("/data")&&(e=`https://danbooru.donmai.us${e}`),e.startsWith("/cached")&&(e=`https://danbooru.donmai.us${e}`),e.startsWith("/_images")&&(e=`https://dollbooru.org${e}`),e.startsWith("//derpicdn.net")&&(e=`https:${t.image}`),!t.file_url&&void 0!==t.directory){const i=t.directory??`${t.hash.substr(0,2)}/${t.hash.substr(2,2)}`;e=`//${r.domain}/images/${i}/${t.image}`}return e.startsWith("http")||(e=`https:${e}`),encodeURI(e)}function getTags(e){let t=[];return Array.isArray(e.tags)?t=e.tags:e.tags&&e.tags.general?t=Object.values(e.tags).reduce(((e,t)=>e.concat(t)),[]):"string"==typeof e.tags?t=fromTagString(e.tags):"string"==typeof e.tag_string&&(t=fromTagString(e.tag_string)),t.filter((e=>""!==e))}function fromTagString(e){return e.split(" ").map((e=>e.replace(/,/g,"")))}class Post{booru;fileUrl;height;width;sampleUrl;sampleHeight;sampleWidth;previewUrl;previewHeight;previewWidth;id;available;tags;score;source;rating;createdAt;data;constructor(e,t){this.data=e,this.booru=t;const r=e.is_deleted||e.is_banned;this.fileUrl=parseImageUrl(e.file_url||e.image||(r?e.source:void 0)||e.file&&e.file.url||e.representations&&e.representations.full,e,t),this.available=!r&&null!==this.fileUrl,this.height=parseInt(e.height||e.image_height||e.file&&e.file.height,10),this.width=parseInt(e.width||e.image_width||e.file&&e.file.width,10),this.sampleUrl=parseImageUrl(e.sample_url||e.large_file_url||e.representations&&e.representations.large||e.sample&&e.sample.url,e,t),this.sampleHeight=parseInt(e.sample_height||e.sample&&e.sample.height,10),this.sampleWidth=parseInt(e.sample_width||e.sample&&e.sample.width,10),this.previewUrl=parseImageUrl(e.preview_url||e.preview_file_url||e.representations&&e.representations.small||e.preview&&e.preview.url,e,t),this.previewHeight=parseInt(e.preview_height||e.preview&&e.preview.height,10),this.previewWidth=parseInt(e.preview_width||e.preview&&e.preview.width,10),this.id=e.id?e.id.toString():"No ID available",this.tags=getTags(e),e.score&&e.score.total?this.score=e.score.total:this.score=e.score?parseInt(e.score,10):e.score,this.source=e.source||e.sources||e.source_url,this.rating=e.rating||/(safe|suggestive|questionable|explicit)/i.exec(e.tags)||"u",Array.isArray(this.rating)&&(this.rating=this.rating[0]),"suggestive"===this.rating&&(this.rating="q"),this.rating=this.rating.charAt(0),this.createdAt=null,"object"==typeof e.created_at?this.createdAt=new Date(1e3*e.created_at.s+e.created_at.n/1e9):"number"==typeof e.created_at?this.createdAt=new Date(1e3*e.created_at):"string"==typeof e.created_at?this.createdAt=new Date(e.created_at):"number"==typeof e.change?this.createdAt=new Date(1e3*e.change):this.createdAt=new Date(e.created_at||e.date)}get file_url(){return this.fileUrl}get sample_url(){return this.sampleUrl}get sample_height(){return this.sampleHeight}get sample_width(){return this.sampleWidth}get preview_url(){return this.previewUrl}get preview_height(){return this.previewHeight}get preview_width(){return this.previewWidth}get postView(){return this.booru.postView(this.id)}get common(){return common(),this}}exports.default=Post;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Post.js","sourceRoot":"","sources":["../../src/structures/Post.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAEH,+BAAgC;AAGhC,yEAAyE;AACzE,MAAM,MAAM,GAAG,IAAA,gBAAS,EAAC,GAAG,EAAE,GAAE,CAAC,EACjC,+DAA+D,CAAC,CAAA;AAEhE;;;;;;GAMG;AACH,SAAS,aAAa,CAAC,GAAW,EAAE,IAAS,EAAE,KAAY;IACzD,sFAAsF;IACt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AC,MAAM,KAAK,QAAQ,EAAE;YAC1C,IAAI,CAAC,SAAS,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,CAAA;SAC9C;aAAM;YACL,IAAI,CAAC,SAAS,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,IAAI,CAAC,CAAA;SACxD;IACH,CAAC;IAED;;;OAGG;IACH,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,OAAO,CAAA;IACrB,CAAC;IAED;;;OAGG;IACH,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,SAAS,CAAA;IACvB,CAAC;IAED;;;OAGG;IACH,IAAI,aAAa;QACf,OAAO,IAAI,CAAC,YAAY,CAAA;IAC1B,CAAC;IAED;;;OAGG;IACH,IAAI,YAAY;QACd,OAAO,IAAI,CAAC,WAAW,CAAA;IACzB,CAAC;IAED;;;OAGG;IACH,IAAI,WAAW;QACb,OAAO,IAAI,CAAC,UAAU,CAAA;IACxB,CAAC;IAED;;;OAGG;IACH,IAAI,cAAc;QAChB,OAAO,IAAI,CAAC,aAAa,CAAA;IAC3B,CAAC;IAED;;;OAGG;IACH,IAAI,aAAa;QACf,OAAO,IAAI,CAAC,YAAY,CAAA;IAC1B,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACrC,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACH,IAAI,MAAM;QACR,MAAM,EAAE,CAAA;QACR,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AA3PD,uBA2PC"}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* @packageDocumentation
|
|
3
3
|
* @module Structures
|
|
4
4
|
*/
|
|
5
|
-
import { BooruCredentials } from '../boorus/Booru';
|
|
6
5
|
/**
|
|
7
6
|
* Just an interface for {@link Booru}'s search params :)
|
|
8
7
|
*/
|
|
@@ -13,8 +12,6 @@ export default interface SearchParameters {
|
|
|
13
12
|
random?: boolean;
|
|
14
13
|
/** Which page of results to fetch */
|
|
15
14
|
page?: number;
|
|
16
|
-
/** The credentials to use to auth with the booru */
|
|
17
|
-
credentials?: BooruCredentials;
|
|
18
15
|
/** Return unavailable posts (ie. banned/deleted posts) */
|
|
19
16
|
showUnavailable?: boolean;
|
|
20
17
|
}
|