<?php
$xml = simplexml_import_dom(@DOMDocument::loadHTMLFile('http://www.whynotchemeng.com/uk-and-ireland/teachers/top-ten-flash-bang-demos'));
$durations = array('109','141','64','195','231','134','76','123','115','94');
$playlist = simplexml_load_string('<playlist version="1" xmlns="http://xspf.org/ns/0/"><trackList/></playlist>');
foreach ($xml->xpath('//div[@id="content"]/p/a[.="Video"]') as $item){
$asx = simplexml_load_file((string) $item['href']);
$ref = (string) $asx->ENTRY->REF['HREF'];
$out = basename($ref, '.wmv') . '.mp4';
$track = $playlist->trackList->addChild('track');
$track->location = htmlspecialchars($out);
system(sprintf('wget %s', escapeshellarg($ref)));
system(sprintf('ffmpeg -i %s -vcodec mpeg4 -acodec libfaac -ss 00:00:25 -t %s %s', escapeshellarg(basename($ref)), date('H:m:s', $durations[$count++]), escapeshellarg($out)));
}
$xspf = 'top-ten-flash-bang-demos.xspf';
file_put_contents($xspf, $playlist->asXML());
system(sprintf('totem %s', escapeshellarg($xspf)));
How to make a remote copy: http://www.youtube.com/my_videos_multiupload (needs Gears)