-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #53 from AtlasTheBot/2.3.0-release
2.3.1 release
- Loading branch information
Showing
9 changed files
with
1,419 additions
and
1,511 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,39 @@ | ||
# booru Changelog | ||
|
||
## 2.1.0 [Latest] | ||
- Update dependencies | ||
- Fix typo in "hypo" for hypnohub's aliases #42 | ||
- Workaround for JS projects trying to use `new booru(site)` #40 | ||
- Will still "work" for certain projects, but now `booru.forSite(site)` is preferred | ||
|
||
## 2.0.5 | ||
- Last release before changelog started | ||
# booru Changelog | ||
|
||
## 2.3.0 [Latest] | ||
|
||
- Fix for illegal invocation errors when using booru on the web | ||
- Some of the APIs don't have the required CORS headers however | ||
- Add `encodeURI` to tags when searching, to avoid encoding errors from the API | ||
- Better example.js file, now supports command line input | ||
- Remove lolibooru | ||
|
||
## 2.2.3 | ||
|
||
- Various fixes for Derpibooru support | ||
|
||
## 2.2.2 | ||
|
||
- Fix default tags missing from post results | ||
- Fix scores/sources/createdAt post props for some sites | ||
|
||
## 2.2.1 | ||
|
||
- Added missing check for `results.posts` in API response | ||
|
||
## 2.2.0 | ||
|
||
- Support for e621/e926's new api | ||
- Fix BooruError wiping out stack trace of caught error | ||
- Dependency updates | ||
|
||
## 2.1.0 | ||
|
||
- Update dependencies | ||
- Fix typo in "hypo" for hypnohub's aliases #42 | ||
- Workaround for JS projects trying to use `new booru(site)` #40 | ||
- Will still "work" for certain projects, but now `booru.forSite(site)` is preferred | ||
|
||
## 2.0.5 | ||
|
||
- Last release before changelog started |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
(async () => { | ||
const fs = require('fs').promises | ||
const [,,from,to] = process.argv | ||
if (!from || !to) throw new Error('No file to minify, or no output') | ||
const content = await fs.readFile(from, 'utf8') | ||
await fs.writeFile(to, JSON.stringify(JSON.parse(content)), 'utf8') | ||
console.log(`Minified ${from} to ${to}!`) | ||
})() | ||
(async () => { | ||
const fs = require('fs').promises | ||
const [,,from,to] = process.argv | ||
if (!from || !to) throw new Error('No file to minify, or no output') | ||
const content = await fs.readFile(from, 'utf8') | ||
await fs.writeFile(to, JSON.stringify(JSON.parse(content)), 'utf8') | ||
console.log(`Minified ${from} to ${to}!`) | ||
})() |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,116 +1,122 @@ | ||
# `booru` | ||
|
||
> *A node package to search boorus* | ||
[![CircleCI](https://img.shields.io/circleci/project/github/AtlasTheBot/booru.svg)](https://circleci.com/gh/AtlasTheBot/booru) ![npm](https://img.shields.io/npm/v/booru.svg) ![GitHub](https://img.shields.io/github/license/AtlasTheBot/booru.svg) ![Typescript typings](https://img.shields.io/badge/Typings-Typescript-informational.svg) | ||
|
||
## Features | ||
|
||
- Search 17 different boorus (check [sites.json](./src/sites.json)) | ||
- Normalizes all received data into `Post` objects that are consistent no matter which booru you use | ||
- Access to the raw data received from the booru as well (transformed from XML to JSON, if applicable) | ||
- Alias support for boorus (`sb` for `safebooru.org`) | ||
- Promises | ||
- Types (using Typescript) | ||
- Choose the amount of images to get | ||
- Random support for all sites, using `order:random` on sites that support it and using custom code on those that don't | ||
- Coming soon(-ish): Support for more than just searching | ||
|
||
--- | ||
|
||
## Installation | ||
|
||
```sh | ||
npm add booru | ||
# or | ||
yarn add booru | ||
``` | ||
|
||
--- | ||
|
||
## Usage | ||
|
||
```js | ||
const Booru = require('booru') | ||
|
||
Booru.search('safebooru', ['glaceon'], { limit: 3, random: true }) | ||
.then(posts => { | ||
for (let post of posts) | ||
console.log(post.fileUrl, post.postView) | ||
}) | ||
|
||
// or (using alias support and creating boorus) | ||
const sb = Booru.forSite('sb') | ||
|
||
sb.search(['cat', 'dog'], { limit: 2 }) | ||
``` | ||
|
||
See [example.js](./example.js) for more examples | ||
|
||
--- | ||
|
||
## Docs | ||
|
||
Available here: [https://booru.js.org](https://booru.js.org) | ||
|
||
## FAQ | ||
|
||
### What are the properties of a `Post`? | ||
|
||
The basic structure of a `Post` object looks like: | ||
|
||
```js | ||
Post { | ||
_data: {/*...*/}, // The raw data from the booru | ||
fileUrl: 'https://aaaa.com/img.jpg', // The direct link to the image, ready to post | ||
id: '124125', // The image ID, as a string | ||
tags: ['cat', 'cute'], // The tags, split into an Array | ||
score: 5, // The score as a Number | ||
source: 'https://ex.com/aaa.png', // Source of the image, if supplied | ||
rating: 's', // Rating of the image | ||
createdAt: Date, // The `Date` this image was created at | ||
postView: 'https://booru.ex/show/12345' // A URL to the post | ||
} | ||
``` | ||
|
||
`s`: 'Safe' | ||
`q`: 'Questionable' | ||
`e`: 'Explicit' | ||
`u`: 'Unrated' | ||
|
||
Derpibooru has `Safe, Suggestive, Questionable, Explicit`, although `Suggestive` will be shown as `q` in `<Post>.rating` | ||
|
||
### Can I contribute? | ||
|
||
Sure! Just fork this repo, push your changes, and then make a PR. | ||
|
||
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) | ||
|
||
### Why? | ||
|
||
Why not? | ||
|
||
### License? | ||
|
||
[It's MIT](https://choosealicense.com/licenses/mit/) | ||
|
||
--- | ||
|
||
## Contributors | ||
|
||
[BobbyWibowo](https://github.com/BobbyWibowo/booru) | ||
> [Change from request-promise-native to snek-fetch](https://github.com/AtlasTheBot/booru/pull/9) | ||
[rubikscraft](https://github.com/rubikscraft/booru) | ||
> [Add 2 new boorus (furry.booru.org/realbooru.com)](https://github.com/AtlasTheBot/booru/pull/17) | ||
> [Various Derpibooru fixes](https://github.com/AtlasTheBot/booru/pull/19) | ||
[Favna](https://github.com/favna/) | ||
> [Add TypeScript declarations](https://github.com/AtlasTheBot/booru/pull/21) | ||
> Improve TypeScript port | ||
> Various other small fixes | ||
[negezor](https://github.com/negezor) | ||
> [Add missing type information](https://github.com/AtlasTheBot/booru/pull/31) | ||
--- | ||
# `booru` | ||
|
||
> *A node package to search boorus* | ||
[![CircleCI](https://img.shields.io/circleci/project/github/AtlasTheBot/booru.svg)](https://circleci.com/gh/AtlasTheBot/booru) ![npm](https://img.shields.io/npm/v/booru.svg) ![GitHub](https://img.shields.io/github/license/AtlasTheBot/booru.svg) ![Typescript typings](https://img.shields.io/badge/Typings-Typescript-informational.svg) | ||
|
||
## Features | ||
|
||
- Search 16 different boorus (check [sites.json](./src/sites.json)) | ||
- Normalizes all received data into `Post` objects that are consistent no matter which booru you use | ||
- Access to the raw data received from the booru as well (transformed from XML to JSON, if applicable) | ||
- Alias support for boorus (`sb` for `safebooru.org`) | ||
- Promises | ||
- Types (using Typescript) | ||
- Choose the amount of images to get | ||
- Random support for all sites, using `order:random` on sites that support it and using custom code on those that don't | ||
- Coming soon(-ish): Support for more than just searching | ||
|
||
--- | ||
|
||
## Installation | ||
|
||
```sh | ||
npm add booru | ||
# or | ||
yarn add booru | ||
``` | ||
|
||
--- | ||
|
||
## Usage | ||
|
||
```js | ||
const Booru = require('booru') | ||
|
||
Booru.search('safebooru', ['glaceon'], { limit: 3, random: true }) | ||
.then(posts => { | ||
for (let post of posts) | ||
console.log(post.fileUrl, post.postView) | ||
}) | ||
|
||
// or (using alias support and creating boorus) | ||
const sb = Booru.forSite('sb') | ||
|
||
sb.search(['cat', 'dog'], { limit: 2 }) | ||
``` | ||
|
||
See [example.js](./example.js) for more examples | ||
|
||
--- | ||
|
||
## Docs | ||
|
||
Available here: [https://booru.js.org](https://booru.js.org) | ||
|
||
## Web support | ||
|
||
booru was built for Node.js, and is only officially supported for Node.js. Issues relating to web are fine, although support might be limited. | ||
|
||
It's possible to use booru on the web using webpack (or similar), although your experience may vary. Some websites don't have the proper CORS headers, meaning that API requests to those sites from a browser will fail! This is not an issue I can fix in the package, and requires either that booru to add proper support themselves or for you to find a workaround for CORS. | ||
|
||
## FAQ | ||
|
||
### What are the properties of a `Post`? | ||
|
||
The basic structure of a `Post` object looks like: | ||
|
||
```js | ||
Post { | ||
_data: {/*...*/}, // The raw data from the booru | ||
fileUrl: 'https://aaaa.com/img.jpg', // The direct link to the image, ready to post | ||
id: '124125', // The image ID, as a string | ||
tags: ['cat', 'cute'], // The tags, split into an Array | ||
score: 5, // The score as a Number | ||
source: 'https://ex.com/aaa.png', // Source of the image, if supplied | ||
rating: 's', // Rating of the image | ||
createdAt: Date, // The `Date` this image was created at | ||
postView: 'https://booru.ex/show/12345' // A URL to the post | ||
} | ||
``` | ||
|
||
`s`: 'Safe' | ||
`q`: 'Questionable' | ||
`e`: 'Explicit' | ||
`u`: 'Unrated' | ||
|
||
Derpibooru has `Safe, Suggestive, Questionable, Explicit`, although `Suggestive` will be shown as `q` in `<Post>.rating` | ||
|
||
### Can I contribute? | ||
|
||
Sure! Just fork this repo, push your changes, and then make a PR. | ||
|
||
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) | ||
|
||
### Why? | ||
|
||
Why not? | ||
|
||
### License? | ||
|
||
[It's MIT](https://choosealicense.com/licenses/mit/) | ||
|
||
--- | ||
|
||
## Contributors | ||
|
||
[BobbyWibowo](https://github.com/BobbyWibowo/booru) | ||
> [Change from request-promise-native to snek-fetch](https://github.com/AtlasTheBot/booru/pull/9) | ||
[rubikscraft](https://github.com/rubikscraft/booru) | ||
> [Add 2 new boorus (furry.booru.org/realbooru.com)](https://github.com/AtlasTheBot/booru/pull/17) | ||
> [Various Derpibooru fixes](https://github.com/AtlasTheBot/booru/pull/19) | ||
[Favna](https://github.com/favna/) | ||
> [Add TypeScript declarations](https://github.com/AtlasTheBot/booru/pull/21) | ||
> Improve TypeScript port | ||
> Various other small fixes | ||
[negezor](https://github.com/negezor) | ||
> [Add missing type information](https://github.com/AtlasTheBot/booru/pull/31) | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.