Skip to content

Commit

Permalink
Update scraper.js
Browse files Browse the repository at this point in the history
  • Loading branch information
oddjones committed Sep 4, 2019
1 parent bb273f9 commit bf2e109
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scraper.js
Expand Up @@ -59,15 +59,15 @@ function run(db) {
readRows(db);
});
// Use request to read in pages.
fetchPage("https://liv-cycling.com/gb/bikes", function (body) {
fetchPage("https://www.liv-cycling.com/gb/bikes", function (body) {
// Use cheerio to find things in the page with css selectors.
var $ = cheerio.load(body);

var elements = $("div.tile").each(function () {
var bikeName = $(this).find('div.caption h3').text().trim();
var imgUrl = $(this).find('picture.image img').attr('src');
var price= $(this).find('div.caption p.prices').text();
var buyLink = 'https://liv-cycling.com' + $(this).find('a').attr('href');
var buyLink = 'https://www.liv-cycling.com' + $(this).find('a').attr('href');
updateRow(db, bikeName, imgUrl, price, buyLink);
});

Expand Down

0 comments on commit bf2e109

Please sign in to comment.