fb55/domutils

Maximum call stack size exceeded

danielgindi opened this issue · 4 comments

findAll is recursive, and fails on big pages.

Looks like this is still a problem. I'm using cheerio to scrape a YouTube page (https://www.youtube.com/watch?v=6SFNW5F8K9Y). cheerio depends on css-select, which depends on domutils:

.../node_modules/domutils/lib/traversal.js:22
exports.getName = function(elem){
                          ^

RangeError: Maximum call stack size exceeded
    at Object.exports.getName (.../node_modules/domutils/lib/traversal.js:22:27)
    at tag (.../node_modules/css-select/lib/general.js:21:11)
    at findAll (.../node_modules/domutils/lib/querying.js:87:6)
    at findAll (.../node_modules/domutils/lib/querying.js:90:27)
    at findAll (.../node_modules/domutils/lib/querying.js:90:27)
    at findAll (.../node_modules/domutils/lib/querying.js:90:27)
    at findAll (.../node_modules/domutils/lib/querying.js:90:27)
    at findAll (.../node_modules/domutils/lib/querying.js:90:27)
    at findAll (.../node_modules/domutils/lib/querying.js:90:27)
    at findAll (.../node_modules/domutils/lib/querying.js:90:27)

Noticed the same error occasionally.

Recently ran into this issue - I opened an issue with the wrong repo unfortunately.

lgraubner/sitemap-generator#11

Same issue with the getName in traversal.js line 22.

image

fb55 commented

Fixed in #22. There is still some bug that prevents this from being used in css-select, but it's getting there.