Zekfad / nhentai-api

Node.JS client for nhentai.net undocumented API.
https://zekfad.github.io/nhentai-api/
ISC License
42 stars 6 forks source link

Search returns request failed 404 #19

Open Joshj23icy opened 2 years ago

Joshj23icy commented 2 years ago

Hi,

attempting to search the following will return a 404:

herio heri heri o wont return a 404 however

these terms work fine via browser.

Welcome to Node.js v16.9.1.
Type ".help" for more information.
> const {API} = require('nhentai-api')
undefined
> const api = new API();
undefined
> api.search(encodeURI('herio'))
Promise {
  <pending>,
  [Symbol(async_id_symbol)]: 266,
  [Symbol(trigger_async_id_symbol)]: 5,
  [Symbol(destroyed)]: { destroyed: false }
}
> Uncaught Error: Request failed with status code 404
> api.search(encodeURI('literally anything else'))
Promise {
  <pending>,
  [Symbol(async_id_symbol)]: 448,
  [Symbol(trigger_async_id_symbol)]: 5,
  [Symbol(destroyed)]: { destroyed: false }
}

thanks in advance

Zekfad commented 2 years ago

I can confirm that API returns 404 with following content if search request evaluates to single word and includes sequence heri:

{"error": "does not exist"}
Example of failed queries ``` heri+-"0" heri%20-"null" heri%20-"empty" ```

My only assumption is that this word is blacklisted from API search (for some reason API search and search on site is different). I'll try to contact them and ask for your case, I'll keep you updated on that matter.

Joshj23icy commented 2 years ago

Thanks for the update, another quick question, didnt want to open a new issue are there ways to display total result count following a search or fetch currently popular galleries? search only returns page count, and books on currently requested page. thanks again

Zekfad commented 2 years ago

Sorry, still no response from support, I'll keep you in touch. Regarding your question, sorting (popular) is currently tracked here: #5 Also related issue #7 About getting total results - API provides no data for that, you have 2 options:

Joshj23icy commented 2 years ago

thanks for the reply, was using the latter method to count results but thought there might be a better way. one more term that appears to return 404 is ayane. ayan/yane are fine however.

Zekfad commented 2 years ago

From #21 adding: term touh is restricted as well. Workaround add uploaded:>3d to query.