For a while YouTube has been making its videos available as downloadable MP4 files. Here is how you can change a regular YouTube RSS feed into an MP4 video podcast.
You will need a server or webspace that supports PHP. Create a PHP file containing the following:
<?php
if ($_GET["source"]=="youtube") {
if ($_GET["user"]!="") {
$url = "http://gdata.youtube.com/feeds/base/users/".$_GET["user"]."/uploads?alt=rss&v=2&orderby=published";
} else if ($_GET["q"]!="") {
$url = "http://gdata.youtube.com/feeds/base/videos?q=".urlencode($_GET["q"])."&alt=rss&v=2&orderby=published";
}
}
if ($url!="") {
$xml = file_get_contents($url);
$items = explode("<item>",$xml);
$output = $items[0];
for ($i=1;$i<count($items);$i++) {
$tmp = explode("http://www.youtube.com/watch?v=",$items[$i]);
$tmp = explode("\"",$tmp[1]);
$tmp = $tmp[0];
$output.= "<item><enclosure url=\"http://www.youtubemp4.com/video/".$tmp.".mp4\" type=\"video/mp4\"/>".$items[$i];
}
echo $output;
}
?>
Video podcast of a certain YouTube user:
http://your.file.name?source=youtube&user=USERNAME
Video podcast based on a search on YouTube:
http://your.file.name?source=youtube&q=SEARCH+THIS
This script makes use of a site named youtubemp4.com which spits out the MP4 file of any given YouTube video.
Thanks a lot, I was searching for this kind of script.
Can you pleases explain where I do need to make changes in the script?
Video podcast of a certain YouTube user:
http://your.file.name?source=youtube&user=USERNAME
Video podcast based on a search on YouTube:
http://your.file.name?source=youtube&q=SEARCH+THIS
This script makes use of a site named youtubemp4.com which spits out the MP4 file of any given YouTube video.
Where in the script I need to insert these lines?
Thanks
Hey Peter
Could you please add some more details here of how to implement this? I really would like to submit my YouTube RSS feed to iTunes and get it to work.
I am not a technical person, but it seems like you have found a solution. A step by step guide would be so much appreciated!
Gideon Shalwick