booru 2.7.0 → 2.8.1

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.
Files changed (37) hide show
  1. package/LICENSE.md +1 -1
  2. package/dist/Constants.d.ts +1 -0
  3. package/dist/Constants.d.ts.map +1 -1
  4. package/dist/Constants.js +11 -5
  5. package/dist/Constants.js.map +1 -1
  6. package/dist/Utils.d.ts +10 -2
  7. package/dist/Utils.d.ts.map +1 -1
  8. package/dist/Utils.js +38 -4
  9. package/dist/Utils.js.map +1 -1
  10. package/dist/boorus/Booru.d.ts +29 -0
  11. package/dist/boorus/Booru.d.ts.map +1 -1
  12. package/dist/boorus/Booru.js +84 -3
  13. package/dist/boorus/Booru.js.map +1 -1
  14. package/dist/index.d.ts +19 -0
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +28 -2
  17. package/dist/index.js.map +1 -1
  18. package/dist/sites.json +24 -12
  19. package/dist/structures/SearchResults.d.ts.map +1 -1
  20. package/dist/structures/SearchResults.js.map +1 -1
  21. package/dist/structures/SiteApi.d.ts +2 -0
  22. package/dist/structures/SiteApi.d.ts.map +1 -1
  23. package/dist/structures/SiteApi.js.map +1 -1
  24. package/dist/structures/Tag.d.ts +42 -0
  25. package/dist/structures/Tag.d.ts.map +1 -0
  26. package/dist/structures/Tag.js +52 -0
  27. package/dist/structures/Tag.js.map +1 -0
  28. package/dist/structures/TagListParameters.d.ts +14 -0
  29. package/dist/structures/TagListParameters.d.ts.map +1 -0
  30. package/dist/structures/TagListParameters.js +7 -0
  31. package/dist/structures/TagListParameters.js.map +1 -0
  32. package/dist/structures/TagListResults.d.ts +53 -0
  33. package/dist/structures/TagListResults.d.ts.map +1 -0
  34. package/dist/structures/TagListResults.js +73 -0
  35. package/dist/structures/TagListResults.js.map +1 -0
  36. package/package.json +14 -15
  37. package/readme.md +36 -9
package/readme.md CHANGED
@@ -2,13 +2,14 @@
2
2
 
3
3
  > _A node package to search boorus_
4
4
 
5
- [![CircleCI](https://img.shields.io/circleci/project/github/AtoraSuunva/booru.svg)](https://circleci.com/gh/AtoraSuunva/booru) ![npm](https://img.shields.io/npm/v/booru.svg) ![GitHub](https://img.shields.io/github/license/AtoraSuunva/booru.svg) ![Typescript typings](https://img.shields.io/badge/Typings-Typescript-informational.svg)
5
+ [![Lint and Test](https://github.com/AtoraSuunva/booru/actions/workflows/lint-and-test.yml/badge.svg)](https://github.com/AtoraSuunva/booru/actions/workflows/lint-and-test.yml) ![npm](https://img.shields.io/npm/v/booru.svg) ![GitHub](https://img.shields.io/github/license/AtoraSuunva/booru.svg) ![Typescript typings](https://img.shields.io/badge/Typings-Typescript-informational.svg)
6
6
 
7
- *Minimum supported Node.js version: >=18.17*
7
+ Only [non-EoL](https://nodejs.org/en/about/previous-releases) versions of Node.js are tested and officially supported. EoL versions are unsupported. Other runtimes (like web, Deno, and Bun) aren't _officially_ supported but issues and PRs are accepted for them.
8
8
 
9
9
  ## Features
10
10
 
11
- - Search 15 different boorus (check [sites.json](./src/sites.json))
11
+ - Search posts on 15 different boorus (check [sites.json](./src/sites.json))
12
+ - Search tags on 12 different boorus
12
13
  - Normalizes all received data into `Post` objects that are consistent no matter which booru you use
13
14
  - Access to the raw data received from the booru as well (transformed from XML to JSON, if applicable)
14
15
  - Alias support for boorus (`sb` for `safebooru.org`)
@@ -16,23 +17,46 @@
16
17
  - Types (using Typescript)
17
18
  - Choose the amount of images to get
18
19
  - Random support for all sites, using `order:random` on sites that support it and using custom code on those that don't
19
- - Coming soon(-ish): Support for more than just searching
20
20
 
21
21
  ---
22
22
 
23
23
  ## Installation
24
24
 
25
+ Booru is available on [npm](https://www.npmjs.com/package/booru):
26
+
25
27
  ```sh
28
+ # Pick your favorite package manager
26
29
  npm add booru
27
- # or
30
+ pnpm add booru
28
31
  yarn add booru
29
32
  ```
30
33
 
34
+ And available on [jsr](https://jsr.io/@atorasuunva/booru):
35
+
36
+ ```sh
37
+ # Pick your favorite runtime
38
+ pnpm i jsr:@atorasuunva/booru
39
+ deno add jsr:@atorasuunva/booru
40
+ bunx jsr add @atorasuunva/booru
41
+ ```
42
+
31
43
  ---
32
44
 
33
45
  ## Usage
34
46
 
35
47
  ```js
48
+ import { search, forSite } from 'booru'
49
+
50
+ const posts = await search('safebooru', ['glaceon'], {
51
+ limit: 3,
52
+ })
53
+
54
+ for (const post of posts) {
55
+ console.log(post.fileUrl, post.postView)
56
+ }
57
+
58
+ // Or, using alias support and creating
59
+
36
60
  const Booru = require('booru')
37
61
 
38
62
  Booru.search('safebooru', ['glaceon'], { limit: 3, random: true }).then(
@@ -42,9 +66,9 @@ Booru.search('safebooru', ['glaceon'], { limit: 3, random: true }).then(
42
66
  )
43
67
 
44
68
  // or (using alias support and creating boorus)
45
- const sb = Booru.forSite('sb')
69
+ const sb = forSite('sb')
46
70
 
47
- sb.search(['cat', 'dog'], { limit: 2 })
71
+ const petPosts = await sb.search(['cat', 'dog'], { limit: 2 })
48
72
  ```
49
73
 
50
74
  See [example.js](./example.js) for more examples
@@ -53,7 +77,7 @@ See [example.js](./example.js) for more examples
53
77
 
54
78
  ## Docs
55
79
 
56
- Available here: [https://booru.js.org](https://booru.js.org)
80
+ Available here: [https://jsr.io/@atorasuunva/booru/doc](https://jsr.io/@atorasuunva/booru/doc)
57
81
 
58
82
  ## Web support
59
83
 
@@ -92,7 +116,7 @@ Derpibooru has `Safe, Suggestive, Questionable, Explicit`, although `Suggestive`
92
116
 
93
117
  Sure! Just fork this repo, push your changes, and then make a PR.
94
118
 
95
- I'll accept PR based on what they do and code style (Not super strict about it, but it's best if it roughly follows the rest of the code)
119
+ I'll accept PR based on what they do. Make sure your changes pass the lint (`pnpm run lint:fix`) and tests (`pnpm run test`).
96
120
 
97
121
  ### Why?
98
122
 
@@ -129,4 +153,7 @@ Why not?
129
153
 
130
154
  > [Copy tags argument so it's not modified](https://github.com/AtoraSuunva/booru/pull/103)
131
155
 
156
+ [ColonelBologna](https://github.com/ColonelBologna)
157
+
158
+ > [Tag list](https://github.com/AtoraSuunva/booru/pull/114)
132
159
  ---