Skip to content

Commit

Permalink
fix: asterisk should apply at the beginning and end tags (#2)
Browse files Browse the repository at this point in the history
* fix: asterisk should apply at the beginning and end tags

* pre release

* bump types/node and typedoc

* make description clearly

* bump v3 workflows
  • Loading branch information
sinkaroid authored Mar 2, 2023
1 parent 8ca10e9 commit d345f7d
Show file tree
Hide file tree
Showing 17 changed files with 61 additions and 62 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/danbooru.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ jobs:
node-version: [14.x]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Installing dependencies
run: npm install
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/gelbooru.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ jobs:
node-version: [14.x]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/hypnohub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ jobs:
node-version: [14.x]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/konachan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ jobs:
node-version: [14.x]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lolibooru.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ jobs:
node-version: [14.x]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/mocha.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ jobs:
node-version: [14.x]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/realbooru.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ jobs:
node-version: [14.x]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/rule34.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ jobs:
node-version: [14.x]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/safebooru.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ jobs:
node-version: [14.x]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/status.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ jobs:
node-version: [14.x]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tbib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ jobs:
node-version: [14.x]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/xbooru.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ jobs:
node-version: [14.x]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/yandere.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ jobs:
node-version: [14.x]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@


## The problem
TL;DR use arbitrary query to consume imageboard API. The whole booru api does not have wildcard endpoint, That mean You cannot using arbitrary query to interact with. Each websites can use direct wildcards with asterisk symbols like `?tags=<SomeQuery>*` But sometime misleading occur and Your query returned no results.
TL;DR use arbitrary query to consume imageboard API, each websites could using direct wildcards with asterisk symbols like `?tags=<SomeQuery>*`. The whole booru api does not have wildcard endpoint, that mean You cannot using arbitrary query to interact with. This library bringing the wildcard usage on JS/TS environment.

## The solution
A query completion (JS/TS) Booru imageboards module that uses wildcard for It's query resolver.
A query completion Booru imageboards module that uses wildcard for It's query resolver.
<center>
<table>
<tr>
Expand Down
43 changes: 21 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
{
"name": "eiyuu",
"description": "A query completion for Booru imageboards",
"description": "Search tags and query completion for booru imageboards",
"funding": "https://github.com/sponsors/sinkaroid",
"version": "1.0.12",
"version": "1.1.0",
"main": "build/src/index.js",
"types": "build/src/index.d.ts",
"files": [
"build"
],
"scripts": {
"build": "rm -rf build && tsc",
"test": "npx ts-node test/fetch.test.ts",
"lint": "npx eslint . --ext .ts",
"lint:fix": "npx eslint . --fix",
"docs": "npx typedoc --cname eiyuu.js.org --entryPointStrategy expand src/ index.ts",
"test:dry": "npx ts-node test/eiyuu.test.ts",
"test:gelbooru": "npx ts-node test/eiyuu.test.ts --gelbooru",
"test:danbooru": "npx ts-node test/eiyuu.test.ts --danbooru",
"test:hypnohub": "npx ts-node test/eiyuu.test.ts --hypnohub",
"test:konachan": "npx ts-node test/eiyuu.test.ts --konachan",
"test:lolibooru": "npx ts-node test/eiyuu.test.ts --lolibooru",
"test:rule34": "npx ts-node test/eiyuu.test.ts --rule34",
"test:realbooru": "npx ts-node test/eiyuu.test.ts --realbooru",
"test:safebooru": "npx ts-node test/eiyuu.test.ts --safebooru",
"test:tbib": "npx ts-node test/eiyuu.test.ts --tbib",
"test:xbooru": "npx ts-node test/eiyuu.test.ts --xbooru",
"test:yandere": "npx ts-node test/eiyuu.test.ts --yandere",
"test:mocha": "npx mocha --timeout 15000 -r ts-node/register 'test/mocha.test.ts'"
"test": "ts-node test/fetch.test.ts",
"lint": "eslint . --ext .ts",
"lint:fix": "eslint . --fix",
"docs": "typedoc --cname eiyuu.js.org --entryPointStrategy expand src/ index.ts",
"test:dry": "ts-node test/eiyuu.test.ts",
"test:gelbooru": "ts-node test/eiyuu.test.ts --gelbooru",
"test:danbooru": "ts-node test/eiyuu.test.ts --danbooru",
"test:hypnohub": "ts-node test/eiyuu.test.ts --hypnohub",
"test:konachan": "ts-node test/eiyuu.test.ts --konachan",
"test:lolibooru": "ts-node test/eiyuu.test.ts --lolibooru",
"test:rule34": "ts-node test/eiyuu.test.ts --rule34",
"test:realbooru": "ts-node test/eiyuu.test.ts --realbooru",
"test:safebooru": "ts-node test/eiyuu.test.ts --safebooru",
"test:tbib": "ts-node test/eiyuu.test.ts --tbib",
"test:xbooru": "ts-node test/eiyuu.test.ts --xbooru",
"test:yandere": "ts-node test/eiyuu.test.ts --yandere",
"test:mocha": "mocha --timeout 15000 -r ts-node/register 'test/mocha.test.ts'"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -62,16 +62,15 @@
"@types/chai": "^4.3.1",
"@types/chai-as-promised": "^7.1.5",
"@types/mocha": "^9.1.1",
"@types/node": "^17.0.23",
"@types/node": "^18.14.2",
"@typescript-eslint/eslint-plugin": "^5.33.0",
"@typescript-eslint/parser": "^5.33.0",
"chai": "^4.3.6",
"chai-as-promised": "^7.1.1",
"eslint": "^7.32.0",
"mocha": "^10.0.0",
"npx": "^10.2.2",
"ts-node": "^10.8.1",
"typedoc": "^0.23.10",
"typedoc": "^0.23.26",
"typedoc-plugin-rename-defaults": "^0.6.4",
"typedoc-theme-hierarchy": "^3.0.0",
"typescript": "^4.6.4"
Expand Down
22 changes: 11 additions & 11 deletions src/class/Eiyuu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default class Eiyuu {
public async danbooru(query: string): Promise<string[]> {
try {
const res = await request(
this.danbooruURL, query, "%2A&search%5Border%5D=count",
this.danbooruURL, `*${query}`, "*%2A&search%5Border%5D=count",
this.useragent, this.followRedirects);

const $ = load(res.body);
Expand Down Expand Up @@ -88,7 +88,7 @@ export default class Eiyuu {
public async gelbooru(query: string): Promise<string[]> {
try {
const res = await request(
this.gelbooruURL, query, this.searchSortings,
this.gelbooruURL, `*${query}`, this.searchSortings,
this.useragent, this.followRedirects);

const $ = load(res.body);
Expand All @@ -115,7 +115,7 @@ export default class Eiyuu {
public async hypnohub(query: string): Promise<string[]> {
try {
const res = await request(
this.hypnohubURL, query, this.searchSortings,
this.hypnohubURL, `*${query}`, this.searchSortings,
this.useragent, this.followRedirects);

const $ = load(res.body);
Expand Down Expand Up @@ -143,7 +143,7 @@ export default class Eiyuu {
public async konachan(query: string): Promise<string[]> {
try {
const res = await request(
this.konachanURL, query, "&type=&order=count",
this.konachanURL, `*${query}`, "&type=&order=count",
this.useragent, this.followRedirects);

const $ = load(res.body);
Expand Down Expand Up @@ -171,7 +171,7 @@ export default class Eiyuu {
public async lolibooru(query: string): Promise<string[]> {
try {
const res = await request(
this.lolibooruURL, query, "&type=&order=count",
this.lolibooruURL, `*${query}`, "*&type=&order=count",
this.useragent, this.followRedirects);

const $ = load(res.body);
Expand Down Expand Up @@ -199,7 +199,7 @@ export default class Eiyuu {
public async rule34(query: string): Promise<string[]> {
try {
const res = await request(
this.rule34URL, query, this.searchSortings,
this.rule34URL, `*${query}`, this.searchSortings,
this.useragent, this.followRedirects);

const $ = load(res.body);
Expand All @@ -226,7 +226,7 @@ export default class Eiyuu {
public async realbooru(query: string): Promise<string[]> {
try {
const res = await request(
this.realbooruURL, query, this.searchSortings,
this.realbooruURL, `*${query}`, this.searchSortings,
this.useragent, this.followRedirects);

const $ = load(res.body);
Expand All @@ -253,7 +253,7 @@ export default class Eiyuu {
public async safebooru(query: string): Promise<string[]> {
try {
const res = await request(
this.safebooruURL, query, this.searchSortings,
this.safebooruURL, `*${query}`, this.searchSortings,
this.useragent, this.followRedirects);

const $ = load(res.body);
Expand All @@ -280,7 +280,7 @@ export default class Eiyuu {
public async tbib(query: string): Promise<string[]> {
try {
const res = await request(
this.tbibURL, query, this.searchSortings,
this.tbibURL, `*${query}`, this.searchSortings,
this.useragent, this.followRedirects);

const $ = load(res.body);
Expand All @@ -307,7 +307,7 @@ export default class Eiyuu {
public async xbooru(query: string): Promise<string[]> {
try {
const res = await request(
this.xbooruURL, query, this.searchSortings,
this.xbooruURL, `*${query}`, this.searchSortings,
this.useragent, this.followRedirects);

const $ = load(res.body);
Expand All @@ -334,7 +334,7 @@ export default class Eiyuu {
public async yandere(query: string): Promise<string[]> {
try {
const res = await request(
this.yandereURL, query, "&type=&order=count",
this.yandereURL, `*${query}`, "*&type=&order=count",
this.useragent, this.followRedirects);

const $ = load(res.body);
Expand Down

0 comments on commit d345f7d

Please sign in to comment.