Search code examples
javascriptgoogle-chromegoogle-chrome-extension

How can i make a chrome extension if there is no API is in offer?


How can i make a chrome extension for searching a shopping site like www.flipkart.com or www.junglee.com as they don't offer an API?

Something like this - https://chrome.google.com/webstore/detail/kjajclaocdighkjplbekkofpmdbcjghf


Solution

  • This will be gross... and more than likely break over a short period of time. But without an API the best way would be to do an Ajax request with an XMLHttpRequest and then parse out the site using javascript or jQuery based on the sites markup classes and ID's.

    Essential you are scraping the site.

    Although this would work it probably won't be worth your time - if the site was designed well the markup classes and id's shouldn't change to much, it will be the css that changes. But this is not guaranteed by the dev team behind the website. An API is more of a guarantee, and I would be iffy about spending a lot of time scraping a site that does not provide an API because more than likely the markup will change as the company grows and hires engineers.

    Good luck though!