Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

2 Answers 2

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.