jonstuebe / scraper

Node.js based scraper using headless chrome
MIT License
46 stars 18 forks source link

No longer fetches Amazon price data #1

Closed sophyphreak closed 4 years ago

sophyphreak commented 6 years ago

Sample output reads:

{ title: 'Amazon Echo - Black (1st Generation)',
  price: '',
  image: 'https://images-na.ssl-images-amazon.com/images/I/61GlYAX7WoL._SY355_.jpg',
  description: 'Plays all your music from Amazon Music, Spotify, Pandora, iHeartRadio, TuneIn, and more using just your voice\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t \n\t\t\t\t\t\t\tCall or message anyone hands-free with your Echo device. Also, instantly connect to other Echo devices in your home using just your voice.\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t \n\t\t\t\t\t\t\tFills the room with immersive, 360º omni-directional audio. Play music simultaneously across Echo devices with multi-room music (Spotify and Sirius XM support coming soon).\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t \n\t\t\t\t\t\t\tHears you from across the room with far-field voice recognition, even while music is playing\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t \n\t\t\t\t\t\t\tAnswers questions, reads the news, reports traffic and weather, reads audiobooks from Audible, gives info on local businesses, provides sports scores and schedules, controls Amazon Video on Fire TV, and more using the Alexa Voice Service\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t \n\t\t\t\t\t\t\tControls lights, fans, TVs, switches, thermostats, garage doors, sprinklers, locks, and more with compatible connected devices from WeMo, Philips Hue, Sony, Samsung SmartThings, Nest, and others\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t \n\t\t\t\t\t\t\tAlways getting smarter and adding new features, plus thousands of skills like Uber, Domino\'s, DISH, and more' }

Price data is blank. Needs to be updated

sinisavukovic commented 6 years ago

@sophyphreak I guess you found a solution by this time.

For everyone else looking for a quick workaround:

(async () => {
  const site = {
    name: 'amazon',
    hosts: ['http://www.amazon.com'],
    scrape: async (page) => {
      const title = await Scraper.getText('#title', page);
      const price = await Scraper.getText('span#price_inside_buybox.a-color-price', page);
      const image = await Scraper.getSrc('img.a-dynamic-image', page);
      const description = await Scraper.getText('#featurebullets_feature_div', page);
      const availability = await Scraper.getText('#availability', page);
      const data = {
        title,
        price,
        image,
        description,
        inStock: availability.toLocaleLowerCase().indexOf('in stock') > -1,
      };

      return data;
    },
  };

  const data = await Scraper.scrape('http://www.amazon.com/gp/product/B07G4MLC4M/', site);
  console.log(data);
})();
jonstuebe commented 4 years ago

updated the internals on this guy