Skip to content

Commit

Permalink
Support youtu.be links.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Jan 10, 2012
1 parent 3eae151 commit cb6762a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions feed/index.php
Expand Up @@ -74,6 +74,19 @@ function process_item($item, $url)
$credithtml = "<br/><font size='-2'><a href='$url'>view this at imgur.com</a></font>";
$url .= '.jpg';
} // if
else if (preg_match('/^.*?\:\/\/(.*?\.|)youtu\.be\/.*$/', $url) > 0) // stupid youtube short url.
{
// pull youtube video out of base URL.
$url = preg_replace('/^(.*)\/youtu\.be\/(.*)$/', '$1/youtube.com/v/$2', $url, 1);
$morehtml = "<br/><hr/><object width='480' height='385'>" .
"<param name='movie' value='$url'></param>" .
"<param name='allowscriptaccess' value='always'></param>" .
"<embed src='$url' type='application/x-shockwave-flash'" .
" allowscriptaccess='always' width='480' height='385'>" .
"</embed></object>";

$credithtml = "<br/><font size='-2'><a href='$url'>view this at youtube.com</a></font>";
} // else if
else if (preg_match('/^.*?\:\/\/(.*?\.|)youtube\.com\/.*$/', $url) > 0)
{
// pull youtube video out of base URL.
Expand Down

0 comments on commit cb6762a

Please sign in to comment.