1

Scraping address information

This commit is contained in:
Alex Yatskov 2014-11-17 13:23:58 +09:00
parent 726f3b8b9e
commit ca9a5c2a5e
2 changed files with 4995 additions and 3526 deletions

File diff suppressed because it is too large Load Diff

View File

@ -35,13 +35,18 @@ function reviewScraped(err, resp, html) {
var $ = cheerio.load(html); var $ = cheerio.load(html);
var bars = $('div.fill'); var address = $('span.format_address').text().trim();
if (bars.length != 9) { if (!address) {
return; return;
} }
var storeName = $('h1#HEADING').text().trim(); var storeName = $('h1#HEADING').text().trim();
if (storeName.indexOf('CLOSED') != -1) { if (storeName.indexOf('CLOSED') !== -1) {
return;
}
var bars = $('div.fill');
if (bars.length !== 9) {
return; return;
} }
@ -55,13 +60,14 @@ function reviewScraped(err, resp, html) {
} }
var data = { var data = {
'name': storeName, name: storeName,
'relativeUrl': this.relativeUrl, relativeUrl: this.relativeUrl,
'rating': { address: address,
'food': (rateFood - 0.5) * 2.0, rating: {
'service': (rateService - 0.5) * 2.0, food: (rateFood - 0.5) * 2.0,
'value': (rateValue - 0.5) * 2.0, service: (rateService - 0.5) * 2.0,
'atmosphere': (rateAtmosphere - 0.5) * 2.0 value: (rateValue - 0.5) * 2.0,
atmosphere: (rateAtmosphere - 0.5) * 2.0
} }
}; };