Giter VIP home page Giter VIP logo

asin_lookup's Introduction

ASIN Lookup

Things you'll need to install:

  1. Node.js. This project was developed and tested on Node v9.3.0.
  2. Yarn or NPM Package managers to install node module project dependencies
  3. MongoDB. This project was developed using MongoDB v3.2.6 installed via Homebrew

How to run the app:

  1. cd ./node_asin_lookup
  2. run yarn or npm install
  3. run yarn start or npm start
  4. Go to localhost:8000 in your browser and supply a valid ASIN from Amazon.com to search with!

How it works:

When you provide an ASIN for the very first time, ASIN Lookup will launch a headless browser and navigate to Amazon.com, and attempt to scrape the category, best seller's rank and product dimensions for the pertinent ASIN. That product information then gets saved to the Product collection in mongodb for easy access, and no web scraping the next time you search for that ASIN!

Caveats:

Amazon.com likes to use different HTML templates between their product listings... it makes reliably screen scraping the data we want a little bit trickier! ASIN Lookup tries to deal with this the best it can by considering various HTML templates that Amazon.com uses.

Thanks for checking out my project! For things to come... I hope to improve upon the view layer soon :)

asin_lookup's People

Contributors

brandynprasad avatar

Watchers

 avatar  avatar

asin_lookup's Issues

Error in loggin

Hello,

2 problem found one solved other not yet.

  1. Chrome desn't run as root, so i have changed the "route/product.js" to add --no sandbox

  2. Solved this, i have this error:

2019-12-09T21:39:57.771Z - verbose: Creating mongoose instance context=Database 2019-12-09T21:39:57.773Z - verbose: Mongoose instance created context=Database 2019-12-09T21:39:57.773Z - verbose: Attaching plugins context=Database 2019-12-09T21:39:57.774Z - verbose: Plugins attached context=Database 2019-12-09T21:39:57.774Z - verbose: Registering models context=Database 2019-12-09T21:39:57.781Z - verbose: Models registered context=Database 2019-12-09T21:39:57.811Z - verbose: Creating express app and HTTP server instance context=Server 2019-12-09T21:39:57.813Z - verbose: Express app and HTTP server instance created context=Server 2019-12-09T21:39:57.818Z - verbose: Attaching middleware to express app context=Server 2019-12-09T21:39:57.819Z - verbose: Middleware attached context=Server 2019-12-09T21:39:57.819Z - verbose: Attaching resource routers to express app context=Server 2019-12-09T21:39:57.820Z - verbose: Resource routers attached context=Server 2019-12-09T21:39:57.820Z - verbose: Attaching error handler context=Server 2019-12-09T21:39:57.820Z - verbose: Error handler attached context=Server 2019-12-09T21:39:57.820Z - verbose: Starting AsinLookup context=AsinLookup 2019-12-09T21:39:57.821Z - verbose: Connecting to database context=Database 2019-12-09T21:39:57.843Z - verbose: Attempting to bind HTTP server to http://localhost:8000 context=Server (node:30901) DeprecationWarning: open()is deprecated in mongoose >= 4.11.0, useopenUri()instead, or set theuseMongoClientoption if usingconnect()orcreateConnection()`. See http://mongoosejs.com/docs/4.x/docs/connections.html#use-mongo-client
2019-12-09T21:39:57.857Z - verbose: HTTP server bound context=Server
2019-12-09T21:39:57.952Z - verbose: Connected to database context=Database
2019-12-09T21:39:57.958Z - verbose: Registering AsinLookup as a service with Consul context=AsinLookup
2019-12-09T21:39:57.958Z - verbose: AsinLookup ready and awaiting requests context=AsinLookup
2019-12-09T21:39:57.958Z - info: Listening for HTTP requests at http://localhost:8000 context=AsinLookup
2019-12-09T21:40:02.284Z - info: Incoming request httpVersion=1.1, method=GET, url=/product/B071CV8CG2, host=localhost:8000, user-agent=Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:70.0) Gecko/20100101 Firefox/70.0, accept=text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8, accept-language=en-US,en;q=0.5, accept-encoding=gzip, deflate, referer=http://localhost:8000/search, connection=keep-alive, upgrade-insecure-requests=1,
2019-12-09T21:40:02.289Z - info: Finding product with asin B071CV8CG2

(node:30901) UnhandledPromiseRejectionWarning: Error: Evaluation failed: TypeError: Cannot read property 'replace' of undefined
at puppeteer_evaluation_script:4:64
at ExecutionContext._evaluateInternal (/var/www/test/reverseasin/asin_lookup/node_modules/puppeteer/lib/ExecutionContext.js:122:13)
at runMicrotasks ()
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async ExecutionContext.evaluate (/var/www/test/reverseasin/asin_lookup/node_modules/puppeteer/lib/ExecutionContext.js:48:12)
at async /var/www/test/reverseasin/asin_lookup/route/product.js:28:24
-- ASYNC --
at ExecutionContext. (/var/www/test/reverseasin/asin_lookup/node_modules/puppeteer/lib/helper.js:111:15)
at DOMWorld.evaluate (/var/www/test/reverseasin/asin_lookup/node_modules/puppeteer/lib/DOMWorld.js:112:20)
at runMicrotasks ()
at processTicksAndRejections (internal/process/task_queues.js:97:5)
-- ASYNC --
at Frame. (/var/www/test/reverseasin/asin_lookup/node_modules/puppeteer/lib/helper.js:111:15)
at Page.evaluate (/var/www/test/reverseasin/asin_lookup/node_modules/puppeteer/lib/Page.js:833:43)
at Page. (/var/www/test/reverseasin/asin_lookup/node_modules/puppeteer/lib/helper.js:112:23)
at /var/www/test/reverseasin/asin_lookup/route/product.js:28:35
at runMicrotasks ()
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:30901) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:30901) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.