Skip to content

Commit

Permalink
Merge branch 'master' of github.com:AtoraSuunva/booru
Browse files Browse the repository at this point in the history
  • Loading branch information
AtoraSuunva committed Jan 13, 2022
2 parents bba213d + cad558e commit 299ad85
Show file tree
Hide file tree
Showing 13 changed files with 517 additions and 515 deletions.
10 changes: 5 additions & 5 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"presets": [
"@babel/preset-env",
"@babel/preset-typescript"
]
{
"presets": [
"@babel/preset-env",
"@babel/preset-typescript"
]
}
49 changes: 24 additions & 25 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
The MIT License (MIT)
=====================

Copyright © `2020` `D. "AtlasTheBot" Plaza`

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the “Software”), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
# The MIT License (MIT)

Copyright © `2022` `Atora Suunva`

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the “Software”), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ module.exports = {
testEnvironment: 'node',
testMatch: ['<rootDir>/test/*.spec.ts'],
setupFiles: ['<rootDir>/test/jest.setup.ts'],
};
}
28 changes: 16 additions & 12 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# `booru`

> *A node package to search boorus*
> _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)
[![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)

## Features

Expand Down Expand Up @@ -33,11 +33,11 @@ yarn add booru
```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)
})
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')
Expand Down Expand Up @@ -105,18 +105,22 @@ Why not?
## Contributors

[BobbyWibowo](https://github.com/BobbyWibowo/booru)
> [Change from request-promise-native to snek-fetch](https://github.com/AtlasTheBot/booru/pull/9)

> [Change from request-promise-native to snek-fetch](https://github.com/AtoraSuunva/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)

> [Add 2 new boorus (furry.booru.org/realbooru.com)](https://github.com/AtoraSuunva/booru/pull/17)
> [Various Derpibooru fixes](https://github.com/AtoraSuunva/booru/pull/19)
[Favna](https://github.com/favna/)
> [Add TypeScript declarations](https://github.com/AtlasTheBot/booru/pull/21)

> [Add TypeScript declarations](https://github.com/AtoraSuunva/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)

> [Add missing type information](https://github.com/AtoraSuunva/booru/pull/31)
---
11 changes: 5 additions & 6 deletions src/boorus/Booru.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,17 +251,16 @@ export class Booru {
throw new BooruError(result.message || result.reason)
}

// What the fuck gelbooru
// Gelbooru
if (result['@attributes']) {
const attributes = result['@attributes']

if (attributes.count === '0' || !result.post) {
result = []
} else if (Array.isArray(result.post)) {
result = result.post
} else {
if (Array.isArray(result.post)) {
result = result.post
} else {
result = [result.post]
}
result = [result.post]
}
}

Expand Down
Loading

0 comments on commit 299ad85

Please sign in to comment.