X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Foembed.php;h=d4d7ce05e115212c096ac3e8bf7c19d22b620316;hb=abe31d7e60b2c6640abf799f807b8258bed10ab8;hp=aec92bfa04ee05498e8baa8b5124728a9183ddf1;hpb=b52bc71c6cdc3ee328604d9b68b730137c6df92d;p=friendica.git diff --git a/include/oembed.php b/include/oembed.php index aec92bfa04..d4d7ce05e1 100755 --- a/include/oembed.php +++ b/include/oembed.php @@ -56,25 +56,21 @@ function oembed_fetch_url($embedurl, $no_rich_type = false){ if ($txt==false || $txt==""){ $embedly = get_config("system", "embedly"); - if ($embedly == "") { - // try oohembed service - $ourl = "http://oohembed.com/oohembed/?url=".urlencode($embedurl).'&maxwidth=' . $a->videowidth; - $txt = fetch_url($ourl); - } else { + if ($embedly != "") { // 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); + logger("oembed_fetch_url: ".$txt, LOGGER_DEBUG); + } } $txt=trim($txt); - if ($txt[0]!="{") $txt='{"type":"error"}'; - - //save in cache - Cache::set($a->videowidth . $embedurl,$txt, CACHE_DAY); + if ($txt[0]!="{") + $txt='{"type":"error"}'; + else //save in cache + Cache::set($a->videowidth . $embedurl,$txt, CACHE_DAY); } $j = json_decode($txt);