RobK / photobox-downloader

NodeJS app to download all photos from Photobox website
MIT License
12 stars 11 forks source link

TypeError: Cannot read property 'parent' of undefined on calls to all Photobox Domains #14

Closed ahibbitt closed 4 years ago

ahibbitt commented 4 years ago

Calls to Photobox domains are blocked by their WAF as there is no User-Agent specified when requests makes a call. This results in the error:

/Users/alex.hibbitt/pbdl/photobox-downloader/node_modules/cheerio/lib/parse.js:55
    var oldParent = node.parent || node.root,
                         ^

TypeError: Cannot read property 'parent' of undefined
    at Function.exports.update (/Users/alex.hibbitt/pbdl/photobox-downloader/node_modules/cheerio/lib/parse.js:55:26)
    at module.exports (/Users/alex.hibbitt/pbdl/photobox-downloader/node_modules/cheerio/lib/parse.js:17:11)
    at Function.exports.load (/Users/alex.hibbitt/pbdl/photobox-downloader/node_modules/cheerio/lib/static.js:19:14)
    at Object.getAlbumList (/Users/alex.hibbitt/pbdl/photobox-downloader/lib/photobox.js:56:23)
    at Object.downloadAll (/Users/alex.hibbitt/pbdl/photobox-downloader/lib/photobox.js:326:25)
    at /Users/alex.hibbitt/pbdl/photobox-downloader/photobox-dl.js:107:16
    at Request._callback (/Users/alex.hibbitt/pbdl/photobox-downloader/lib/photobox.js:50:11)
    at Request.self.callback (/Users/alex.hibbitt/pbdl/photobox-downloader/node_modules/request/request.js:198:22)
    at Request.emit (events.js:314:20)
    at Request.<anonymous> (/Users/alex.hibbitt/pbdl/photobox-downloader/node_modules/request/request.js:1057:14)

I've implemented this pull request in order to present a User-Agent in expected form

RobK commented 4 years ago

I really have to rewrite this in Typscript! Thanks again for your pull request, have merged and will update NPM.