Web scraping using firefox & jQuery


Hits: 5880  

Hello Friends,

Today we will scrape HTML from any web page using jQuery and firefox firebug console. This is useful when you want to grab HTML of web page dynamically created by JavaScript or Ajax.

This example is quite useful when you want to extract any web content based on HTML Tag element ID or Class like ‘<div id=”svnlabs”></div>’ or ‘<img src=”svnlabs.jpg” id=”svn_labs”>’

See the code in action here… scraper.txt

jQuery(“body”).append(‘<textarea id=”svnlabs” cols=”70″ rows=”20″></textarea>’);

jQuery(“#svnlabs”).val(jQuery(“body”).html());

OR

copy and paste below code in browser address bar….

javascript: jQuery(“body”).append(‘<textarea id=”svnlabs” cols=”70″ rows=”20″></textarea>’); jQuery(“#svnlabs”).val(jQuery(“body”).html());

You have to post above code in firefox firebug javascript console. The latest jQuery library must be included on that web page you want to scrap 😉
Above two JavaScript lines will add a new textarea in body of same web page to set content of any HTML element. Please make sure after copy the above code; no illegal character in it.

Keep blogging……… 😉

Bookmark and Share

Published by

Sandeep Verma

I’m an Entrepreneur. I’m proud to work as Blogger, LAMP Programmer, Linux Admin, Web Consultant, Cloud Manager, Apps Developer, Searcher. Concentrate > Observe > Imagine > Launch

  • Mahesh Patel

    TOTALLY LAMP THING!