auto-extracting URL LINKS from webpage?

is there a way to extract all the linked url's from a webpage?


i am trying to put together some lists and would like to gather these up and then insert them into a numbers spreadsheet. in some cases there are 30 to 50 of these listed on the left hand side of a webpage and right now I imagine clicking on a link, copying the url from the browser, inserting into numbers, clicking back, clicking on the next link etc.


is there a way to save some steps by exporting these to a text document and then copying and pasting from there?


thanks for any help.

Posted on Oct 4, 2011 9:43 AM

Reply
8 replies

Oct 5, 2011 2:47 PM in response to hotwheels22

Something went terribly wrong with the script when I pasted it into the message, so that copy-paste from here into the URL fails miserably. The exact same script is on this web page:


http://www.pcreview.co.uk/forums/bookmarklets-marklets-favelet-powercons-re-link -grabber-bert-hibbard-re-web-page-info-david-lewis-t1961707.html


It's about a third to half-way down--do a "Find" on the page for


javascript:WN7z


then copy that and paste. When I did it that way, instead of copying what I pasted in the message above, the new link worked fine. I can't tell WHAT goes wrong with the copy of the version here!

Francine

Oct 4, 2011 10:22 AM in response to hotwheels22

There is a way to get a complete list of all links on a web page, what to do this list to simplify what you want, well, that's up to you.


To generate a Safari page with all links:


1. Create a new Bookmark, name it Links (or whatever appeals to you)

2. Click the Safari Bookmarks icon in the Bookmarks bar so you get to the list of all your bookmarks

3. Go to the new Links bookmark and click to URL field to select it

4. Replace the URL with this:


javascript:WN7z=open('','Z6','width=400,height=200,scrollbars,resizable,menubar' );DL5e=document.links;with(WN7z.document){write('<base%20target=_blank>');for(lK i=0;lKi<DL5e.length;lKi++){write(DL5e[lKi].toString().link(DL5e[lKi])+'<br><br>' )};void(close())}


I recommend Copy and Paste!


Go to a web page, then select your Links javascript, and a new Safari window will open containing all the URLs on the page.

Francine

Oct 4, 2011 4:01 PM in response to Francine Schwieder

Hi Francine.


Boy am I always super (super) impressed.


Thank you.


Can you help me with one thing here regarding the steps?


A. I navigated to the page I want the links from.

B. I created a bookmark for it ("architecture links")

C. I went to bookmarks pulldown and selected show all bookmarks

D. In the list (mine is at the top) I selected the address and pasted your script over the original url.

E. Now I am stuck.


What do I do now?


I go to the webpage that I want the links from?

And then somehow there is some way to select "Your Links Javascript"?


Obviously I am sort of missing a step or two here.


Thank you!!

Oct 5, 2011 8:48 AM in response to hotwheels22

You create the new bookmark with the javascript replacing the original URL from any old bookmark you have and no longer need, or just create a new bookmark for any thing at all specifically for your links script. Then once you are at a page where you want the links displayed, you just select your new links bookmark. Your page will stay open, but a new window will open as well, with all the links listed. You might want to change the size of the window, the width=400 and height=200 result in a pretty small window. Anyway, I put the Links javascript bookmarklet in my Bookmarks menu, so while I am here on this page I just go to the Bookmarks menu, slide down and select Links, and a new window opens with all the links on this page listed.

Francine


PS--It would be more impressive if I had written that script, but I didn't. I found it years ago and saved it with a batch of bookmarklets that do other useful things, such as suppressing animated gifs. I just checked, and a particularly useful collection, Jesse's Bookmarklets, still exists:


https://www.squarefree.com/bookmarklets/

Oct 5, 2011 12:03 PM in response to Francine Schwieder

Hi Francine,


I am not getting this to work.


I am in Safari. I am copying the text and pasting it into a newly created Bookmark ("LINK EXTRACTOR") that is in my Bookmarks Bar (it sits at the top of the list above all the other folders that are here). This new text goes in the place where the old url was under "address". It starts with "javascript" and ends with "close ())}


After pulling up the url of the site that I want the links for - I am clicking on the LINK EXTRACTOR and nothing happens.


I click on this bookmark and go to Open or Open in New Tab or Open in New Browser and nothing happens.


What am I missing here?

Can I try it in Firefox and test it there?



Thanks.


Jonathan

Oct 5, 2011 12:13 PM in response to hotwheels22

If you don't mind doing one at a time, you can just click-and-hold on a link in a webpage, then drag it directly into the cell on the spreadsheet in Numbers.


This will generate an entry showing the plain-text name for the link (as shown in the webpage) which masks the real URL. It is clickable within Numbers - clicking it will open that link's webpage in Safari.


No need to copy/paste or retype.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

auto-extracting URL LINKS from webpage?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.