Would anyone know of how this process works? I'm using two node packages, 'request' and 'cheerio' var request = require('request'); var cheerio = require('cheerio'); var link = 'http://ift.tt/2c8M1ov'; request(link, function(response, html){ var $ = cheerio.load(html); var data = $(this); console.log(data); } This following block of code will convert the HTML webpage into a block of JSON properties initialize { options: { withDomLvl1: true, normalizeWhitespace: false, xml: false, decodeEntities: true }, _root: initialize { '0': { type: 'root', name: 'root', namespace: 'http://ift.tt/lH0Osb', attribs: {}, 'x-attribsNamespace': {}, 'x-attribsPrefix': {}, children: [Object], parent: null, prev: null, next: null }, How would I know which JSON key/property belongs to which HTML element/tag? If there was a
tag that has some text in it, would it automatically be within parent or children?Cheerio: http://ift.tt/1qHiFNB Request: http://ift.tt/1FWyok9
Submitted September 04, 2017 at 11:09PM by lolososo
No comments:
Post a Comment