]> git.mxchange.org Git - friendica.git/commitdiff
The order for the page parsing is changed.
authorMichael Vogel <icarus@dabo.de>
Sun, 5 Apr 2015 18:40:31 +0000 (20:40 +0200)
committerMichael Vogel <icarus@dabo.de>
Sun, 5 Apr 2015 18:40:31 +0000 (20:40 +0200)
mod/parse_url.php

index 7f4bd29a08b292728e2c07b3bb0f457c796420c3..951c0701107f96f47df0abe7f8de1a7358bdb27b 100644 (file)
@@ -97,15 +97,6 @@ function parseurl_getsiteinfo($url, $no_guessing = false, $do_oembed = true, $co
                return($siteinfo);
        }
 
-       if ($do_oembed) {
-               require_once("include/oembed.php");
-
-               $oembed_data = oembed_fetch_url($url);
-
-               if ($oembed_data->type != "error")
-                       $siteinfo["type"] = $oembed_data->type;
-       }
-
        // if the file is too large then exit
        if ($curl_info["download_content_length"] > 1000000)
                return($siteinfo);
@@ -116,6 +107,24 @@ function parseurl_getsiteinfo($url, $no_guessing = false, $do_oembed = true, $co
 
        $stamp1 = microtime(true);
 
+       if ($do_oembed) {
+               require_once("include/oembed.php");
+
+               $oembed_data = oembed_fetch_url($url);
+
+               if ($oembed_data->type != "error")
+                       $siteinfo["type"] = $oembed_data->type;
+
+               if (($oembed_data->type == "link") AND ($siteinfo["type"] != "photo")) {
+                       if (isset($oembed_data->title))
+                               $siteinfo["title"] = $oembed_data->title;
+                       if (isset($oembed_data->description))
+                               $siteinfo["text"] = trim($oembed_data->description);
+                       if (isset($oembed_data->thumbnail_url))
+                               $siteinfo["image"] = $oembed_data->thumbnail_url;
+               }
+       }
+
        // Now fetch the body as well
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
@@ -283,15 +292,6 @@ function parseurl_getsiteinfo($url, $no_guessing = false, $do_oembed = true, $co
                        }
        }
 
-       if (isset($oembed_data) AND ($oembed_data->type == "link") AND ($siteinfo["type"] != "photo")) {
-               if (isset($oembed_data->title) AND (trim($oembed_data->title) != ""))
-                       $siteinfo["title"] = $oembed_data->title;
-               if (isset($oembed_data->description) AND (trim($oembed_data->description) != ""))
-                       $siteinfo["text"] = trim($oembed_data->description);
-               if (isset($oembed_data->thumbnail_url) AND (trim($oembed_data->thumbnail_url) != ""))
-                       $siteinfo["image"] = $oembed_data->thumbnail_url;
-       }
-
        if ((@$siteinfo["image"] == "") AND !$no_guessing) {
            $list = $xpath->query("//img[@src]");
            foreach ($list as $node) {