10 February 2014

How To Extract All Hyperlinks In A Webpage ?


Sometimes you might need to have the all the hyperlinks from a webpage.For example if you are a developer you might be in need of a javascript or css of a webpage that is hosted externally.Sometimes this trick will also help you extract the download link from survey sites.Whatever might be the reason let us learn to do this.We will learn 3 different ways to extract hyperlinks from a webpage in this post.



Extract Hyperlinks From A Webpage In Chrome

This trick is very simple but is limited to Google chrome users.The trick is performed with  via the Chrome Dev tools.
Steps To Extract Hyperlinks From A Webpage In Chrome
Extract hyperlinks from a webpage in chrome
  1. Go to the page from which you want to extract the hyperlinks.
  2. Click on 'Inspect Element' from the right click menu.
  3. Click on the 'Console tab'.
  4. Now paste the following code in the input field.                                                                                                                                 urls = $$('a'); for (url in urls) console.log ( urls[url].href );
  5. Hit enter.

iWeb Tools's Link Extractor
Extract hyperlinks using iweb tool

This is a web based service which means you don't have to download any software nor it is limited to any users.You can use this tool here.This tool will show the type of file along with the anchor text in the output field.
How To Use This Tool?
Using this tool is very simple.All you have to do is to go the the above url.Enter the webpage url in the input field and hit extract!

BuzzStream Tool

Extract hyperlink from html codes
This is quite different from the other two because in this case we are extracting all the urls from an html code.This trick will not display the output links on the website itself.All the links on that page are exported as a CSV file which automatically downloads to your computer once you hit the create CSV button.The CSV file has three different columns including the actual link,it's original website and the anchor text.
How To Use This Tool?
  1. Go to Buzz Stream Urls Extract Tool
  2. Copy the source code of the webpage from which you want to extract the Url.
  3. Paste it in the tool's input field and hit create CSV.A CSV file containing the hyperlinks will automatically be downloaded to your computer.
How To Get The Source Code Of Webpages?

Chrome:Right click on the webpage and click on view page source or press Ctrl + U
Internet Explorer:Right click from the webpage and click on view source.
Firefox & Netscape:Right click  and click on  view page source or press Ctrl + U
Opera:From the view menu click on source or press Ctrl + F3

Sharing Is Caring