{"id":9385,"date":"2019-05-19T04:11:27","date_gmt":"2019-05-18T22:41:27","guid":{"rendered":"http:\/\/198.58.113.91\/blog\/?p=9385"},"modified":"2023-07-31T18:55:04","modified_gmt":"2023-07-31T13:25:04","slug":"how-to-extract-links-from-a-webpage-in-windows","status":"publish","type":"post","link":"https:\/\/www.winhelponline.com\/blog\/how-to-extract-links-from-a-webpage-in-windows\/","title":{"rendered":"How to Extract Links from a Webpage in Windows"},"content":{"rendered":"<p>You may need to extract the links (URLs) in a webpage for different purposes &#8212; eg., internet research, web development, security assessments, or webpage testing. This article tells you how to extract links from a webpage or HTML document in Windows.<!--more--><\/p>\n<h2>How to Extract Links from a Webpage in Windows<\/h2>\n<p>There are several methods to extract URLs in a webpage. Let&#8217;s start with a native way &#8212; using your web browser&#8217;s developer tools section.<\/p>\n<h3>Using your Web browser&#8217;s Developer Tools<\/h3>\n<ol>\n<li>Open Chrome for Firefox, and visit the website or webpage first.<\/li>\n<li>Press <kbd>F12<\/kbd> to open the Developer Tools window.<\/li>\n<li>Click on the Console tab in Developer Tools.<\/li>\n<li>Clear the console output by clicking on <strong>Clear console<\/strong> (in Chrome) or <strong>Clear the Web console output<\/strong> (in Firefox) button.<\/li>\n<li>Type the following code at the console prompt:\n<pre>Array.prototype.slice.call(document.querySelectorAll('a'), 0).forEach((a,i)=&gt;console.log(`#${i+1} - ${a.innerText} -- ${a.href}`));<\/pre>\n<\/li>\n<\/ol>\n<p>This outputs the ordered list of links in that webpage along with the title in the console window.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-9386\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/05\/extract-webpage-links-console-1.png\" alt=\"Extract Links from a Webpage\" width=\"701\" height=\"343\" \/><\/p>\n<p>If you only want to grab the URLs without the serial number or the title text, use this command:<\/p>\n<pre>urls = $$('a'); for (url in urls) console.log ( urls[url].href );<\/pre>\n<p>Copy the output to Notepad and save it.<\/p>\n<hr \/>\n<h3>Using PowerShell<\/h3>\n<p>Launch PowerShell and use the following command-line syntax:<\/p>\n<pre>(Invoke-WebRequest -Uri \"https:\/\/www.winhelponline.com\/blog\").Links.Href | Sort-Object | Get-Unique | out-gridview<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-9387\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/05\/extract-webpage-links-powershell-2.png\" alt=\"extract links from a webpage in windows\" width=\"698\" height=\"308\" \/><\/p>\n<p>This gets the list of links in the specified webpage and outputs the list to grid view control.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-9388\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/05\/extract-webpage-links-powershell-1.png\" alt=\"extract links from a webpage in windows\" width=\"699\" height=\"123\" \/><\/p>\n<p>Another advantage of this PowerShell command is that it sorts the entries and also removes duplicate URLs from the collection.<\/p>\n<p>The grid view control lets you filter URLs key keyword search, as well as copy the listings to the clipboard using <kbd>Ctrl<\/kbd> + <kbd>C<\/kbd><\/p>\n<p><strong>Grab title and URL<\/strong><\/p>\n<p>To view the innerText in addition to the corresponding links or URLs, run:<\/p>\n<pre>(Invoke-WebRequest -Uri \"https:\/\/www.winhelponline.com\").Links | sort-object href -Unique | Format-List innerText, href<\/pre>\n<p>You&#8217;ll get an output like this:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-9389\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/05\/extract-webpage-links-powershell-3.png\" alt=\"extract links from a webpage in windows\" width=\"699\" height=\"407\" \/><\/p>\n<p>The duplicate URLs are removed automatically in the output.<\/p>\n<p>You can even copy the output to the clipboard automatically using the <code>| clip<\/code> parameter:<\/p>\n<pre>(Invoke-WebRequest -Uri \"https:\/\/www.winhelponline.com\").Links | sort-object href -Unique | Format-List innerText, href | clip<\/pre>\n<p><strong>Grab Image URLs only<\/strong><\/p>\n<p>To extract the list of image URLs, use this syntax:<\/p>\n<pre>(Invoke-WebRequest -Uri \"https:\/\/www.winhelponline.com\").Images | Select-Object src<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-9390\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/05\/extract-webpage-images-powershell-3.png\" alt=\"extract links from a webpage in windows\" width=\"698\" height=\"334\" \/><\/p>\n<hr \/>\n<h3>Using AddrView from Nirsoft<\/h3>\n<p>Nirsoft&#8217;s <a href=\"https:\/\/www.nirsoft.net\/utils\/addrview.html\" target=\"_blank\" rel=\"noopener nofollow noreferrer\">AddrView<\/a> tool extracts the links (including image links) from a given webpage or a local HTML file automatically and lists it in a grid view.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-9391\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/05\/extract-links-addrview.png\" alt=\"extract links from a webpage in windows\" width=\"701\" height=\"222\" \/><\/p>\n<p>You can even sort the results by <strong>Type<\/strong> and copy only the image URLs to the clipboard or save to file.<\/p>\n<div class=\"qt\">If you only want to grab the image links, you can use Firefox&#8217;s built-in <strong>View Page Info<\/strong> option. In Firefox, right-click on the current webpage, click <strong>View Page Info<\/strong> \u2192 Media.The <a href=\"https:\/\/www.winhelponline.com\/blog\/download-flickr-photos-disabled-download-by-owner\/\">Media tab<\/a> lists all the image URLs, including the <code>data:image<\/code> links. You can copy selected items or all items to the clipboard, or save the entries to a file.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-8621\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/04\/flickr-download-owner-disabled-images-4.png\" alt=\"extract links from a webpage in windows - firefox media\" width=\"602\" height=\"582\" \/><\/p>\n<\/div>\n<p>Other than the above methods, for browsers like Chrome or Firefox, there are plenty of extensions or add-ons that will grab the URL or image links from the currently active web page in your browser.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>You may need to extract the links (URLs) in a webpage for different purposes &#8212; eg., internet research, web development, security assessments, or webpage testing. This article tells you how to extract links from a webpage or HTML document in Windows.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[7],"tags":[396],"class_list":["post-9385","post","type-post","status-publish","format-standard","hentry","category-windows","tag-powershell"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":1049,"url":"https:\/\/www.winhelponline.com\/blog\/ie-extension-open-web-page-different-browser\/","url_meta":{"origin":9385,"position":0},"title":"Internet Explorer Extension to Open Current Page in Chrome, Firefox or Edge","author":"Ramesh","date":"May 19, 2010","format":false,"excerpt":"I'd like to share the extensions I made for Internet Explorer, to open current web page in a different browser such as Google Chrome, Mozilla Firefox and Microsoft Edge (Windows 10). This extension works fine in all versions of Windows, including Windows 10.After adding this extension, you'll see the following\u2026","rel":"","context":"In &quot;Internet Explorer&quot;","block_context":{"text":"Internet Explorer","link":"https:\/\/www.winhelponline.com\/blog\/category\/microsoft\/internet-explorer\/"},"img":{"alt_text":"open with browser extension for IE","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2010\/05\/ie-extensions-1.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2010\/05\/ie-extensions-1.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2010\/05\/ie-extensions-1.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":271,"url":"https:\/\/www.winhelponline.com\/blog\/copy-title-and-url-menu-extension-for-internet-explorer\/","url_meta":{"origin":9385,"position":1},"title":"Copy Title and URL Extension for Internet Explorer","author":"Ramesh","date":"May 7, 2008","format":false,"excerpt":"Here is a nice Internet Explorer extension which copies the current webpage title and address to the Windows clipboard. The script from billsway.com was originally written for earlier Internet Explorer versions, and I've modified a line - thanks to IE MVP Socrates (Soc) Trikes - to make it work in\u2026","rel":"","context":"In &quot;Internet Explorer&quot;","block_context":{"text":"Internet Explorer","link":"https:\/\/www.winhelponline.com\/blog\/category\/microsoft\/internet-explorer\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2008\/05\/titleurl1.gif?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":14934,"url":"https:\/\/www.winhelponline.com\/blog\/download-twitter-dm-video\/","url_meta":{"origin":9385,"position":2},"title":"How to Download Twitter DM Video in Windows","author":"Ramesh","date":"March 22, 2020","format":false,"excerpt":"Twitter videos are .m3u8 playlist files that link to multiple .ts (Transport Stream) video stream files. The Twitter user interface doesn't provide an option to download the video embedded in a tweet or Direct Message (DM). There are 3rd party Twitter video downloader websites such as savetweetvid.com, twdown.net etc., that\u2026","rel":"","context":"In &quot;General&quot;","block_context":{"text":"General","link":"https:\/\/www.winhelponline.com\/blog\/category\/general\/"},"img":{"alt_text":"download twitter dm video using fbdown extension for chrome","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2020\/03\/twitter-dm-video-download-fbdown-chrome.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2020\/03\/twitter-dm-video-download-fbdown-chrome.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2020\/03\/twitter-dm-video-download-fbdown-chrome.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2020\/03\/twitter-dm-video-download-fbdown-chrome.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":23399,"url":"https:\/\/www.winhelponline.com\/blog\/what-is-reading-list-in-chrome-how-disable\/","url_meta":{"origin":9385,"position":3},"title":"What is Reading List in Chrome and how to Disable it","author":"Ramesh","date":"March 22, 2021","format":false,"excerpt":"After updating to Chrome browser version 89 or higher, you'll see a new \"Reading List\" button on the right-hand side of the bookmarks bar.\u00a0If you've been using the \"Other bookmarks\" folder, its icon is moved slightly to the left, as the \"Reading List\" button occupies the right-most slot. You may\u2026","rel":"","context":"In &quot;General&quot;","block_context":{"text":"General","link":"https:\/\/www.winhelponline.com\/blog\/category\/general\/"},"img":{"alt_text":"reading list disable chrome 90","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2021\/03\/chrome-reading-list-disable-chrome-90.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":760,"url":"https:\/\/www.winhelponline.com\/blog\/go-to-registry-key-right-click-chrome-firefox-ie\/","url_meta":{"origin":9385,"position":4},"title":"Jump to a Registry Key via Right-Click in Chrome, Firefox or IE","author":"Ramesh","date":"October 31, 2008","format":false,"excerpt":"Many of our articles contain information about modifying the registry. To quickly open the Registry Editor to a selected key from the web browser, you can browser add-ons available for Chrome, Firefox or Internet Explorer. Google Chrome \"Chome Registry Jumper\" extension The Chome Registry Jumper extension available at the Chrome\u2026","rel":"","context":"In &quot;General&quot;","block_context":{"text":"General","link":"https:\/\/www.winhelponline.com\/blog\/category\/general\/"},"img":{"alt_text":"chrome open regedit extension","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2008\/10\/chrome-open-regedit-extension.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2008\/10\/chrome-open-regedit-extension.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2008\/10\/chrome-open-regedit-extension.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2008\/10\/chrome-open-regedit-extension.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":3745,"url":"https:\/\/www.winhelponline.com\/blog\/edge-copy-title-url-web-page-bookmarklet\/","url_meta":{"origin":9385,"position":5},"title":"Microsoft Edge Copy Title and URL of a Web Page [Bookmarklet]","author":"Ramesh","date":"August 31, 2016","format":false,"excerpt":"There are several third-party extensions out there to copy webpage title and address, for browsers like Chrome, Firefox and others. Here is a neat trick to add your own Copy Title & URL bookmarklet for Microsoft Edge. Copy Title and URL Bookmarklet for Microsoft Edge In Microsoft Edge (Chromium), create\u2026","rel":"","context":"In &quot;Microsoft Edge&quot;","block_context":{"text":"Microsoft Edge","link":"https:\/\/www.winhelponline.com\/blog\/category\/edge\/"},"img":{"alt_text":"microsoft edge chromium - copy title and url","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/08\/edge-chromium-copy-title-bookmarklet.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/08\/edge-chromium-copy-title-bookmarklet.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/08\/edge-chromium-copy-title-bookmarklet.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/posts\/9385","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/comments?post=9385"}],"version-history":[{"count":0,"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/posts\/9385\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/media?parent=9385"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/categories?post=9385"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/tags?post=9385"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}