DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: LinkGrabber: Grabs all links on a webpage and exports as a text file.  (Read 21,491 times)

scancode

  • I will eat Cody someday.
  • Honorary Member
  • Joined in 2007
  • **
  • Posts: 641
    • Cody Award
    • Participated in NANY Challenge Twice
    • Coding Snacks
    • Furry Fandom Badge - Furry Fandom
    • DJ Badge - DJ
http://scancode.dcmembers.com/files/linkgrabber-install.htm

It's a bookmarklet that grabs all links on a webpage and exports them as a text file.. Enjoy.

Edit: typo
« Last Edit: April 12, 2008, 02:33 PM by scancode »

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • Coding Snacks
    • Volunteers/Staff
    • Gathering Badge
    • Participated in NANY Challenge Once
    • Linux User
sounds good, scancode.. will try this out later. btw, will it work on Firefox?

jgpaiva

  • Artificial Idiocy
  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • Cody Award
    • Participated in NANY Challenge Once
    • Coding Snacks
    • Portugal Inhabitant
    • Linux User
It will, lanux. It was tested under ie, ff and opera.

kalos

  • Member
  • Joined in 2006
  • **
  • Posts: 1,824
this is very interesting

can it save the txt file though?

scancode

  • I will eat Cody someday.
  • Honorary Member
  • Joined in 2007
  • **
  • Posts: 641
    • Cody Award
    • Participated in NANY Challenge Twice
    • Coding Snacks
    • Furry Fandom Badge - Furry Fandom
    • DJ Badge - DJ
this is very interesting

can it save the txt file though?

Sure it can, I can add a button, but it'll work in IE only. You can always right-click on it :)

This one will save it as HTML / TXT on IE6
Code
javascript:var%20i;var%20o_0=window.open('','o_0','width=450,height=250,status=0,toolbar=0,location=0,menubar=0,directories=0,resizable=1,scrollbars=1');o_0.document.open('text/plain','replace');for%20(i=0;i%3Cdocument.links.length;i++){o_0.document.write(document.links[i].href+'\r\n\r\n');}%20o_0.document.title='Links';o_0.document.close();o_0.document.execCommand("SaveAs");void%200;
« Last Edit: April 12, 2008, 02:32 PM by scancode »

kalos

  • Member
  • Joined in 2006
  • **
  • Posts: 1,824
very nice!

how can I add regex filters to display specific links (or text) ? eg *.some.com/*.pdf

scancode

  • I will eat Cody someday.
  • Honorary Member
  • Joined in 2007
  • **
  • Posts: 641
    • Cody Award
    • Participated in NANY Challenge Twice
    • Coding Snacks
    • Furry Fandom Badge - Furry Fandom
    • DJ Badge - DJ
Honestly, that escapes my knowledge. You'd better off parsing the list.
« Last Edit: April 12, 2008, 04:18 PM by scancode »

kalos

  • Member
  • Joined in 2006
  • **
  • Posts: 1,824
thanks your work is brilliant

it also gives me many ideas

scancode

  • I will eat Cody someday.
  • Honorary Member
  • Joined in 2007
  • **
  • Posts: 641
    • Cody Award
    • Participated in NANY Challenge Twice
    • Coding Snacks
    • Furry Fandom Badge - Furry Fandom
    • DJ Badge - DJ
Here's a cleaned up version, in case you want to add the regexp yourself.
Thank you for your kind words  :)
Show Source Code
Code: (JavaScript)
var i;
var o_0 = window.open('', 'o_0', 'width=450,height=250,status=0,toolbar=0,location=0,menubar=0,directories=0,resizable=1,scrollbars=1');
o_0.document.open('text/plain', 'replace');
for (i = 0; i < document.links.length; i++) {
    o_0.document.write(document.links[i].href + '\r\n\r\n');
}
o_0.document.title = 'Links';
o_0.document.close();
o_0.document.execCommand("SaveAs"); // ie only; show save as dialog
void 0;
« Last Edit: April 12, 2008, 04:19 PM by scancode »

scancode

  • I will eat Cody someday.
  • Honorary Member
  • Joined in 2007
  • **
  • Posts: 641
    • Cody Award
    • Participated in NANY Challenge Twice
    • Coding Snacks
    • Furry Fandom Badge - Furry Fandom
    • DJ Badge - DJ
Woot! Regexp is working.

Code
javascript:var i;var p_0=prompt("Enter your regexp (default%3A don't filter)%3A","/()/");eval("p_0="%2Bp_0%2B";");var o_0=window.open('','o_0','width=450,height=250,status=0,toolbar=0,location=0,menubar=0,directories=0,resizable=1,scrollbars=1');o_0.document.open('text/plain','replace');for(i=0;i%3Cdocument.links.length;i%2B%2B){if(p_0.test(document.links[i].href)){o_0.document.write(document.links[i].href%2B'%5Cr%5Cn%5Cr%5Cn')}}o_0.document.title='Links';o_0.document.close();o_0.document.execCommand("SaveAs");void 0;

Code: (javascript)
var i;
var p_0 = prompt("Enter your regexp (default: don't filter):", "/()/");
eval("p_0=" + p_0 + ";"); // HELP! Is there a cleaner way? // for example sets a comment.
var o_0 = window.open('', 'o_0', 'width=450,height=250,status=0,toolbar=0,location=0,menubar=0,directories=0,resizable=1,scrollbars=1');
o_0.document.open('text/plain', 'replace');
for (i = 0; i < document.links.length; i++) {
    if (p_0.test(document.links[i].href)) {
        o_0.document.write(document.links[i].href + '\r\n\r\n')
    }
}
o_0.document.title = 'Links';
o_0.document.close();
o_0.document.execCommand("SaveAs");
void 0;

Enjoy :)

kalos

  • Member
  • Joined in 2006
  • **
  • Posts: 1,824
marvelous!
many thanks!
:)

jimmsta

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 2
Awesome :D

Original address: https://www.donationcoder.com/forum/index.php?topic=11893.0