DMarby / humblebundle-ebook-downloader

An easy way to download ebooks from your humblebundle account
The Unlicense
230 stars 27 forks source link

crash with weird book type #14

Closed vvuk closed 6 years ago

vvuk commented 6 years ago

I'm getting this when trying to download everything:

Downloading Humble eBook Bundle - Signal to Noise (Read Me) (0 bytes)... (480/990)
/home/vladimir/.npm_global/lib/node_modules/humblebundle-ebook-downloader/index.js:369
        url: download.url.web
                         ^

TypeError: Cannot read property 'web' of undefined
    at checkSignatureMatch (/home/vladimir/.npm_global/lib/node_modules/humblebundle-ebook-downloader/index.js:369:26)
    at ReadStream.stream.on (/home/vladimir/.npm_global/lib/node_modules/humblebundle-ebook-downloader/index.js:333:14)
    at emitNone (events.js:110:20)
    at ReadStream.emit (events.js:207:7)
    at endReadableNT (_stream_readable.js:1059:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)

Note the (Read Me) as the type and 0 bytes as the size; should probably skip "weird" entries like this.

vvuk commented 6 years ago

The JSON from the humble site has this as the 4th entry in the download_struct, after 3 valid ones (bad copy paste, but you get the idea):

3 | {…}
-- | --
small | 1
human_size | 0 bytes
external_link | https://support.humblebundle.com/hc/en-us/articles/202422214
name | Read Me

Can probably filter out entries that don't have a file_size (alongside entries that don't have a name that are already filtered out).

DMarby commented 6 years ago

Thanks for reporting this, I've released version 1.0.7 which fixes this.