Return to Snippet

Revision: 5368
at March 3, 2008 20:56 by jaytee


Initial Code
require_once('magpierss/rss_fetch.inc');
$rss = fetch_rss("http://www.youtube.com/rss/user/$username/videos.rss");
foreach ($rss->items as $item) {
	preg_match('/http:\/\/(.*)default.jpg/',$item['description'],$matches);
	$thumb = $matches[0];
	$title = $item['title'];
	$link = $item['link'];
	$date = date("n/d/Y",strtotime($item['pubdate']));
?>
<div class="video">
	<a href="<?php echo $link; ?>"><img src="<?php echo $thumb; ?>" /></a><br />
	<strong><?php echo $title; ?></strong><br />
	posted on <?php echo $date; ?>
</div>
<?php
}
?>

Initial URL


Initial Description
Uses the Magpie RSS library (http://magpierss.sourceforge.net/).  I suppose I should be using the GData API, but this was a quicker solution for me.

Initial Title
Display a user's YouTube videos

Initial Tags


Initial Language
PHP