pikax / gin-downloader

download manga from public websites
MIT License
11 stars 1 forks source link

gin.mangafox.images -> Error: Image not found #11

Closed calgara12 closed 7 years ago

calgara12 commented 7 years ago

Hey, its me again :)

Since Yestserday i encounter the following error:

When i do:


 gin.mangafox.images("One Piece", 1)
    .then(x=>{
        console.log('starting...')
        console.log('getting %d images', x.length);
        return x.map(p=>{

            p.then(r=>{
                //this will run as soon each promise is resolved
                //r contains url
                console.log(r);
            })
        });
    })
    .then(x=>Promise.all(x))
    .then(x=>console.log('resolved'))
    .catch(console.error);

It starts listing the images, until i get multiple errors saying: Error: Image not found and (node:5880) [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.

I only encounter this error on specific mangas and chapters. for example the second chapter of one piece lists all images without the error, the first chapter of Berserk returns multiple errors.

I did not receive this error a couple days ago. When i visit mangafox, all pages of this manga seem to be online.

Thanks, and have a nice day!

pikax commented 7 years ago

Hey,

I think the issue is because mangafox has some licence mangas, one piece is one of them, if you are in USA you can't see the first chapter

it should show this error: image

if that's the case I can't do much.

if you can access to the chapters via browser without proxy or VPN, it gin-downloader should work without an issue.

Can you tell me the country from you're accessing mangafox?

calgara12 commented 7 years ago

I can access the first chapter of one piece without a problem. Im accessing it from Europe, Austria.

Thank you for your effort :)

pikax commented 7 years ago

It seems the One Piece is licence in Austria image

I'm using a VPN and connected to Vienna

can you try other manga:

gin.mangafox.images("Tales of Demons and Gods", 1)
    .then(x=>{
        console.log('starting...')
        console.log('getting %d images', x.length);
        return x.map(p=>{

            p.then(r=>{
                //this will run as soon each promise is resolved
                //r contains url
                console.log(r);
            })
        });
    })
    .then(x=>Promise.all(x))
    .then(x=>console.log('resolved'))
    .catch(console.error);
calgara12 commented 7 years ago

That is odd. Here is what i get when accessing one piece on mangafox: snip

op

I also dont get an error when I try to download chapter 2,3, 666 When i try to get images of the first chapter of one piece i get this output: output.txt

The amount of "Error: Image not found" is variable. Sometimes i get 2, sometimes 4 and sometimes 10+

The pattern I've found was that i get the errors when the chapter has a lot of pages. For example, first chapter of one piece has 61 pages, First chapter of berserk has 89 pages. Although it could just be that just the chance of an error occurance is higher the more pages are in the chapter.

Do you have an idea what's wrong here?

pikax commented 7 years ago

That's odd, I've just added a licensed field and throw an exception when is licensed, I can't publish now, I will publish at night.

I've just tried in UK, and it downloads the first chapter as expected.

I use debug to be able to debug, to debug mangafox just use gin-downloader:mangafox*

#windows
set DEBUG=`gin-downloader:mangafox*` node index.js
#linux
DEBUG=`gin-downloader:mangafox*` node index.js

Can you send the log of that when it fails?

Thank you

pikax commented 7 years ago

Just read your log, it seems the regex is failing to find the image.

You need to wait until next publish (tonight) to be able to have a proper debug of the error.

Thank you :)

calgara12 commented 7 years ago

Alright thanks ill wait. Could you give me a notice once you commit the update?

pikax commented 7 years ago

just manage to publish, can you update gin-downloader

and run with *DEBUG:gin-downloader:mangafox**

calgara12 commented 7 years ago

Unfortunately i am unfamilliar with 'debug'... i assume you are talking about https://www.npmjs.com/package/debug

I installed this and i did set DEBUG=gin-downloader:mangafox* then i ran "node app DEBUG:gin-downloader:mangafox*" and this was the output: output.txt

not sure if i did that how im supposed to. i did not make any change in the code. As i said i am new to this. Just let me know if i should do something different.

pikax commented 7 years ago

create a new folder and place this two files in it:

package.json:

{
  "name": "tess",
  "version": "1.0.0",
  "main": "index.js",
  "license": "MIT",
  "scripts":{
    "start" :"cross-env DEBUG=gin-downloader:* node index"
  },
  "dependencies": {
    "cross-env": "^5.0.1",
    "gin-downloader": "^1.0.6"
  }
}

index.js

var gin = require('gin-downloader')

gin.mangafox.images("One Piece", 1)
    .then(x=>{
        console.log('starting...')
        console.log('getting %d images', x.length);
        return x.map(p=>{

            p.then(r=>{
                //this will run as soon each promise is resolved
                //r contains url
                console.log(r);
            })
        });
    })
    .then(x=>Promise.all(x))
    .then(x=>console.log('resolved'))
    .catch(console.error);

save the output

calgara12 commented 7 years ago

Thanks, here is my output: output.txt

pikax commented 7 years ago

Thank you, it seems the website is returning 503 Service Temporarily Unavailable

Mangafox uses rate-limit, if you do too many requests it will block some calls, I already retry automatically, the issue was the retry time was too short, I double it, it seems to be working, but not a definitive solution.

calgara12 commented 7 years ago

Ok thanks, but after the update i still get the same error message... output.txt

Or do you still have to commit the change?

pikax commented 7 years ago

it should have fix it.

can you tell me the version?

calgara12 commented 7 years ago

1.0.7

I included the version in the output.txt in my last post

pikax commented 7 years ago

I will fix that issue, I will try make it today, but is quite a change.

Thank you to point that out.

Hope to see having fun using this library 😄

calgara12 commented 7 years ago

Thanks :) no rush. just let me know once its fixed please :)

pikax commented 7 years ago

Sure

It will take a while, it will be a huge change in code and API

you can check my v2 API vision

you are using javascript, probably you should check the cool stuff from es6/es2015 :)

calgara12 commented 7 years ago

i will definitely do that :)

calgara12 commented 7 years ago

Hey, did you get the chance to fix this problem, or will it still take some time? :)

pikax commented 7 years ago

just published 1.1.0 with the fix, but you need to change a bit of code.

Before I was trying to resolve all promises at once, now I'm returning a objecting with lazy loading pattern, that means only when you do .value it will create a promise therefore you will not have the same issue :)

images(manga, chapter_number) : return Promise<Promise<{value: {name:string,src:string}>[]>

mangafox.images("Gintama", 1)
      .then(x=>Promise.all(x.map(t=>t.value))) //resolve all promises
      .then(console.log)
calgara12 commented 7 years ago

Thank you,

But if i run your code i get: output.txt

thanks in advance. keep up the great work :)

pikax commented 7 years ago

try this


gin.mangafox.images("One Piece", 1)
  .then(x=>{
    console.log('starting...')
    console.log('getting %d images', x.length);
    return x.map(p=>{

      p.then(x=>x.value) //resole lazyload promise
        .then(r=>{
        //this will run as soon each promise is resolved
        //r contains url
        console.log(r);
      })
    });
  })
  .then(x=>Promise.all(x))
  .then(x=>console.log('resolved'))
  .catch(console.error);
calgara12 commented 7 years ago

That does the trick! You are AWESOME :) Thanks!

calgara12 commented 7 years ago

Unfortunately now i encounter the problem again, but this time i get the Image not found error for each image. Here is my output: output.txt