Another scraper, this time for Youtube:
USAGE:
1 | <?php youtube("BMW") ?> |
CODE:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | <?php function youtube($keyword) { $url = 'http://www.youtube.com/rss/tag/'.urlencode($keyword).'.rss'; $youtube = fopen($url, "r"); if (preg_match('/<enclosure url=\"(.*)swf/s', $youtube, $y)) { $youtube = $y[1]; $youtube = substr($y[1], 0, 36); $video = ''; $video .= "\n".'<object type="application/x-shockwave-flash" style="width:400px; height:325px;" data="'.$youtube.'">'; $video .= "\n".'<param name="movie" value="'.$youtube.'" />'; $video .= "\n".'</object>'; $video .= "\n"; print $video; } } ?> |