Hi fellas!
Kak bbl Bce? [pardon my Russian, I just meant to ask, "how are you all?"] :P
Today we are going to replicate some functionality of WebHarvy Web Scrapper. You can get more documentation on this tool at its official website, https://www.webharvy.com/ [wait for my new posts on this!]
So, in today's blog, we will try to retrieve data from Flipkart after making a search for laptop into an excel file using jQuery (a client side scripting language, can read about it at http://jquery.com/ or wait for my new posts).
I recommend Google Chrome for this trick! So let's get started:
#1: Open Google Chrome. Navigate to Flikart.com and then search for laptop and hit enter
#2: Press F12 (in laptops, you may have to press Fn + F12 simultaneously). You will see Web Developer window, either at the bottom or at the right side of the web page.
Click on Console
#3: Now paste the following code into the "Area for writing jQuery scripts"
Kak bbl Bce? [pardon my Russian, I just meant to ask, "how are you all?"] :P
Today we are going to replicate some functionality of WebHarvy Web Scrapper. You can get more documentation on this tool at its official website, https://www.webharvy.com/ [wait for my new posts on this!]
So, in today's blog, we will try to retrieve data from Flipkart after making a search for laptop into an excel file using jQuery (a client side scripting language, can read about it at http://jquery.com/ or wait for my new posts).
I recommend Google Chrome for this trick! So let's get started:
#1: Open Google Chrome. Navigate to Flikart.com and then search for laptop and hit enter
#2: Press F12 (in laptops, you may have to press Fn + F12 simultaneously). You will see Web Developer window, either at the bottom or at the right side of the web page.
#3: Now paste the following code into the "Area for writing jQuery scripts"
var title="";
var price="";
var html="<table><tr><td>Title</ td><td>Price</td></tr>";
$('#products .gd-col').each(function(){
title=$(this).find('.pu-title a').text();
price=$(this).find('.pu-price .pu-final span').text();
var tempdetails="<tr><td>"+title+" </td><td>"+price+"</td></tr>";
html=html+tempdetails;
});
html=html+"</table>";
window.open('data:application/ vnd.ms-excel,' + encodeURIComponent(html));
and hit Enter. You may receive download exception. In that case, select the radio button which says to allow download from this web-site.
#4: There will be an excel file downloaded to your system. Open it
You may receive format error. Don't worry about that, click Yes
And that's it! You have all the data in an excel format available at your disposal. You can tweak the code to include other options in separate columns in excel.
I have tested the code in Chrome, and not sure about how it behaves in Mozilla or IE.
Please use the comment section to let me know the result of running this code on other browsers.
El descanso es proximo!
Adios.