javascript - Node.js http: Parse "index of" -


i need write node.js function finds available node.js versions on official website. this, wanted receive content of link: https://nodejs.org/download/release/, in form of array. there way how can automagically receive , parse available urls via module or need request site via http , somehow parse content manually, , if so, how?

as suggested rahilwazir, can use different url give json.

var request = require('request'); request( 'https://raw.githubusercontent.com/nodejs/nodejs.org/master/source/versions.json',         function(err, resp, json) {           if (err) return console.error(err);           var data = json.parse(json);           // need here        }; ); 

if want scrape html page mentioned, use following, copy pasted (and adapted) http://maxogden.com/scraping-with-node.html

var $ = require('cheerio');  function gothtml(err, resp, html) {   if (err) return console.error(err);   var parsedhtml = $.load(html);   // tags , loop on them   var links = parsedhtml('a').map(function(i, link) {     return $(link).attr('href');   }); }  request('https://nodejs.org/download/release/', gothtml); 

Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -