Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I download the links (not the content in the pages that the links point to, just the links themselves. I'm trying to give a list of about 300 videos to my network admin to unblock, he just wants the URLs.

share|improve this question
1  
If you were coding this, you could just use regex to pull out the link tags... – soandos Sep 13 '11 at 2:19
    
I'll do that, thanks. Add it as an answer to recieve credit – wizlog Sep 13 '11 at 2:46
up vote 3 down vote accepted

In PHP:

<?php

$webpagehtml=file_get_contents("http://www.example.com");

$dom=new DOMDocument();
$dom->loadHTML($webpagehtml);

$xpath=new DOMXPath($dom);
$items = $xpath->query("//a");

$links=array();

for ($i = 0;  $i < $items->length; $i++ ) {
$item = $items->item($i);
$title=$item->textContent;
$href=$item->getAttribute('href');

if($href && $title){
echo "$href = $title<br/>";
}
}
?>

In Python, use http://arshaw.com/scrapemark/docs/examples/.

Or you can use downthemall in firefox to do the dirty work.

share|improve this answer

When I want to see the links on a webpage, I grab an old copy of Avant browser (ver 10) out of my archives and install it. Run the webpage you want. Right-click on the page and select "Open All Links in This page." You can't cut-and-paste them.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .