Wednesday, 28 January 2015

Get Flipkart's Item Details in an Excel File Using jQuery

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"

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.

Saturday, 3 January 2015

Reset Firefox to its Default State

Hi pals!

I wish you all a very happy new year and welcome you to this exiting world of tips and tricks. May our learning be exponential this year!

We begin this year by learning to reset Mozilla Firefox to its default state.

Now why would you do this?
Possible explanation are to get rid of Extensions and themes, website permissions, user styles and social features, download actions, plugin settings, toolbar customizations etc.
But Firefox saves certain things as well. You can get a complete list from here

So let's get started:

#1: Find the 3 horizontal lines on the Toolbar and follow the steps in screenshot:



#2: Click on Troubleshooting Information



#3: Click on the Reset Firefox button as shown below:



That's it. Once done, you will see Old Firefox Data folder on your systems' desktop


This folder will help you to restore some important old data from your old Firefox. I will talk about it in my later blogs.


Wish you a very happy new year again!

Cheers!
Vipul