Created
September 3, 2012 16:11
-
-
Save ideiudicibus/3610373 to your computer and use it in GitHub Desktop.
paginegialle.it cinema web scraping
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var request = require('request'), | |
cheerio = require('cheerio'), | |
url= 'http://www.paginegialle.it/cinema-programmazione/Roma%20(RM)', | |
ua = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/534.57.2 (KHTML, like Gecko) Version/5.1.7 Safari/534.57.2'; | |
var parsePage = function(error, response, body) { | |
if (error || response.statusCode != 200) { | |
console.log(error); | |
} | |
else { | |
$ = cheerio.load(body); | |
$('.one-sala').siblings().each(function(i, elem) { | |
var cinema = $(elem).find('div .col-1'); | |
var cinemaName = $(cinema).find('h5').text(); | |
var cinemaAddress = $(cinema).find('.address-cine').text(); | |
var cinemaCity = $(cinema).find('.city-cine').text(); | |
var cinemaPhone = $(cinema).find('.cine-tel').text(); | |
var schedule = $(elem).find('div .col-2'); | |
$(schedule).find('div .row').each( | |
function(key,value){ | |
var filmName = $(value).find('div .cel-2 a').text(); | |
var scheduleTime = $(value).find('div .cel-2 .film-orari').text().replace('orari:',''); | |
} | |
); | |
}) | |
} | |
}; | |
request( | |
{ | |
url : url, | |
headers : { | |
"User-Agent" : ua | |
} | |
},parsePage | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, it seems they changed the policies so after the first attempts the site returns a "Block page"