nodejs-web-scraper
nodejs-web-scraper copied to clipboard
Transform via getElementContent
Hi @ibrod83,
Thank you so much for this package, it is extremely useful.
I have a feature suggestion: ability to return objects from getElementContent. This way we can keep the data together.
At the moment I'm doing this...
const x = new CollectContent('a[id="some_id"]', {
name: 'x',
getElementContent: (a, b, c) => {
const href = c.attr('href').substr(7)
const html = c.html()
return `${html}___${href}` // would like to return { html, href }
},
})
Something unexpected happens when you try to return an object, you get what you would get if you didn't have the getElementContent option.
Thanks for considering!
Lydia
Hey, I'm not really working on this package anymore. Do you maybe want to do it yourself and create a PR?
hey @LydiaF! Check out the latest version; I had wanted the same thing and submitted a PR to return all data types for getElementContent
Hey, I'm not really working on this package anymore. Do you maybe want to do it yourself and create a PR?
Hey, sorry I didn't reply to this, don't remember reading :)
hey @LydiaF! Check out the latest version; I had wanted the same thing and submitted a PR to return all data types for getElementContent
Great stuff @jamin84, I will check out and get back to you in next few days!
@jamin84 Sorry for slow response, but it's perfect, thank you v v much!