oembed: Now it is possible to use the service from embedly with an API key.

This commit is contained in:
Michael Vogel 2014-04-04 10:56:33 +02:00
parent a64948b7f7
commit 96a41a16fd

View file

@ -12,6 +12,9 @@ function oembed_replacecb($matches){
function oembed_fetch_url($embedurl){ function oembed_fetch_url($embedurl){
$embedurl = trim($embedurl, "'");
$embedurl = trim($embedurl, '"');
$a = get_app(); $a = get_app();
$txt = Cache::get($a->videowidth . $embedurl); $txt = Cache::get($a->videowidth . $embedurl);
@ -48,9 +51,18 @@ function oembed_fetch_url($embedurl){
} }
if ($txt==false || $txt==""){ if ($txt==false || $txt==""){
// try oohembed service $embedly = get_config("system", "embedly");
$ourl = "http://oohembed.com/oohembed/?url=".urlencode($embedurl).'&maxwidth=' . $a->videowidth; if ($embedly == "") {
$txt = fetch_url($ourl); // try oohembed service
$ourl = "http://oohembed.com/oohembed/?url=".urlencode($embedurl).'&maxwidth=' . $a->videowidth;
$txt = fetch_url($ourl);
} else {
// try embedly service
$ourl = "https://api.embed.ly/1/oembed?key=".$embedly."&url=".urlencode($embedurl);
$txt = fetch_url($ourl);
}
logger("oembed_fetch_url: ".$txt, LOGGER_DEBUG);
} }
$txt=trim($txt); $txt=trim($txt);