diff options
Diffstat (limited to 'scrape.js')
-rw-r--r-- | scrape.js | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/scrape.js b/scrape.js new file mode 100644 index 0000000..9f0b5b5 --- /dev/null +++ b/scrape.js @@ -0,0 +1 @@ +var beers = []; $('.beer-details').each(function(i, b) { b = $(b); var beer = {}; beer['name'] = b.find('.name a').text().trim(); beer['style'] = b.find('.style').text().trim().replace('This beer is no longer being produced by the brewery', '').split(' - '); beer['abv'] = parseFloat(b.next('.details').find('.abv').text()); beer['added'] = b.next('.details').find('.date').text().trim().replace('Added ', '').split('/').map(t => parseInt(t, 10)); beer['rating'] = parseFloat(b.next('.details').find('.num').text().replace('(', '').replace(')','')); beer['ratings'] = parseInt(b.next('.details').find('.raters').text().replace(',','')); beers.push(beer); }); console.log(JSON.stringify(beers)); |