Closed sumanla13a closed 8 years ago
You'd want to write a recursive function that takes an element and returns its tagName and attributes, then maps its children through that same function. For example:
function getTree ($el, $) {
return {
tagName: $el[0].tagName,
attributes: $el[0].getAttributes(), // Not how you do this, just pseudo-code
children: $el.children().map((child) => getTree($(child)))
};
}
Is there any way of getting every tags, every attributes from requesting a url?
htmlToJson.request('http://prolificinteractive.com/team', { //some option to get everything }, function (err, result) { console.log(result); });