Skip to content

Instantly share code, notes, and snippets.

@row1
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save row1/d9e1cfdffef8f68b3505 to your computer and use it in GitHub Desktop.
Save row1/d9e1cfdffef8f68b3505 to your computer and use it in GitHub Desktop.
var request = require("request"),
jsdom = require("jsdom"),
$ = require("jquery")(jsdom.jsdom().createWindow()),
http = require('http');
var options = {
uri: "http://en.wikipedia.org/wiki/List_of_PlayStation_Vita_games",
method: "GET"
};
request(options, function(error, response, body) {
//console.log('starting');
var $body = $(body);
//console.log('loaded body');
var $table = $("#mw-content-text", $body).find("table.wikitable:first");
//console.log('loaded table');
var $rows = $table.find("tr");
//console.log('loaded ' + $rows.length + ' rows');
for(var i = 1; i < $rows.length; i++){
var $tr = $($rows[i]);
var $tdSupport = $tr.find("td:eq(7)");
if($tdSupport.hasClass('table-unknown') || $tdSupport.hasClass('table-no')){
continue;
}
var $tdName = $tr.find("td:eq(0)");
var title = $tdName.text().replace(/(\[\d+\])+/, '');
if(!$tdSupport.hasClass('table-yes')){
title += " [**" + $tdSupport.text() + "**]";
}
console.log(" - " + title);
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment