H2Owater425 / node-hitomi

Hitomi.la api for Node.js
https://npm.im/node-hitomi
MIT License
15 stars 2 forks source link

Add Support for "cg" type of galllery #28

Closed ayenz closed 2 years ago

ayenz commented 2 years ago

An error occured when trying to download cg gallery, ex url: https://hitomi.la/cg/...

(node:6408) UnhandledPromiseRejectionWarning: HitomiError [REQEUST_REJECTED]: Request to 'https://hitomi.la/artistcg/redacted-xxx.html' was rejected
    at ClientRequest.<anonymous> (/Users/stillmen/Documents/PROJEKT/rej-hitomi/node_modules/node-hitomi/library/index.js:1:1472)
    at Object.onceWrapper (events.js:422:26)
    at ClientRequest.emit (events.js:315:20)
    at HTTPParser.parserOnIncomingClient (_http_client.js:641:27)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:126:17)
    at TLSSocket.socketOnData (_http_client.js:509:22)
    at TLSSocket.emit (events.js:315:20)
    at addChunk (internal/streams/readable.js:309:12)
    at readableAddChunk (internal/streams/readable.js:284:9)
    at TLSSocket.Readable.push (internal/streams/readable.js:223:10)
(Use node --trace-warnings ... to show where the warning was created)
(node:6408) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:6408) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

As you can see, the request url changed from cg to artistcg Thank you.

Edited My code:

const hitomi = require('node-hitomi').default;

hitomi.getGallery(2006297)
.then(function (value) {
    console.log(value['title']['display'], value['id']);
});
H2Owater425 commented 2 years ago

Hmm... I didn't know that Hitomi treats artistcg in the different way in URL. I found what caused the error, and the new release will soon be released with some other bug fix. Thank you for reporting the issue!

ayenz commented 2 years ago

Thank you for fast response. I'm sorry I couldn't be more helpful, I'm not a node programmer :disappointed: Can't wait for new release!

H2Owater425 commented 2 years ago

image I tested it out and now it works fine, please check out for package's new release!

ayenz commented 2 years ago

Tested and works as expected! Thank you so much. Closing issue now.