increase timeout on oembed remote fetches. This is a balancing act. Too short and many sites won't show up. Too long and you could be watching a spinner anxiously waiting for the page to load even if your own site is blindingly fast.
This commit is contained in:
parent
d03c66c924
commit
85d8300421
@ -156,9 +156,12 @@ function oembed_fetch_url($embedurl){
|
|||||||
if ($action !== 'block') {
|
if ($action !== 'block') {
|
||||||
// try oembed autodiscovery
|
// try oembed autodiscovery
|
||||||
$redirects = 0;
|
$redirects = 0;
|
||||||
$result = z_fetch_url($furl, false, $redirects, array('timeout' => 15, 'accept_content' => "text/*", 'novalidate' => true ));
|
$result = z_fetch_url($furl, false, $redirects, array('timeout' => 30, 'accept_content' => "text/*", 'novalidate' => true ));
|
||||||
|
|
||||||
if($result['success'])
|
if($result['success'])
|
||||||
$html_text = $result['body'];
|
$html_text = $result['body'];
|
||||||
|
else
|
||||||
|
logger('fetch failure: ' . $furl);
|
||||||
|
|
||||||
if($html_text) {
|
if($html_text) {
|
||||||
$dom = @DOMDocument::loadHTML($html_text);
|
$dom = @DOMDocument::loadHTML($html_text);
|
||||||
@ -171,7 +174,10 @@ function oembed_fetch_url($embedurl){
|
|||||||
foreach($entries as $e){
|
foreach($entries as $e){
|
||||||
$href = $e->getAttributeNode("href")->nodeValue;
|
$href = $e->getAttributeNode("href")->nodeValue;
|
||||||
$x = z_fetch_url($href . '&maxwidth=' . App::$videowidth);
|
$x = z_fetch_url($href . '&maxwidth=' . App::$videowidth);
|
||||||
$txt = $x['body'];
|
if($x['success'])
|
||||||
|
$txt = $x['body'];
|
||||||
|
else
|
||||||
|
logger('fetch failed: ' . $href);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// soundcloud is now using text/json+oembed instead of application/json+oembed,
|
// soundcloud is now using text/json+oembed instead of application/json+oembed,
|
||||||
@ -180,7 +186,10 @@ function oembed_fetch_url($embedurl){
|
|||||||
foreach($entries as $e){
|
foreach($entries as $e){
|
||||||
$href = $e->getAttributeNode("href")->nodeValue;
|
$href = $e->getAttributeNode("href")->nodeValue;
|
||||||
$x = z_fetch_url($href . '&maxwidth=' . App::$videowidth);
|
$x = z_fetch_url($href . '&maxwidth=' . App::$videowidth);
|
||||||
$txt = $x['body'];
|
if($x['success'])
|
||||||
|
$txt = $x['body'];
|
||||||
|
else
|
||||||
|
logger('json fetch failed: ' . $href);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user