X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FUtil%2FParseUrl.php;h=04afc927ba6cec4229c8167a6bcafe66e4c317d9;hb=720a43461d67ab229de0aecfc5008f22cc4c1c54;hp=03cfd7d7611cf338f71f375763be4dcc28b3fb20;hpb=1d0955f75939a600a53a377284aac27501a46e0e;p=friendica.git diff --git a/src/Util/ParseUrl.php b/src/Util/ParseUrl.php index 03cfd7d761..04afc927ba 100644 --- a/src/Util/ParseUrl.php +++ b/src/Util/ParseUrl.php @@ -1,6 +1,6 @@ get($url, [HttpClientOptions::CONTENT_LENGTH => 1000000]); if (!$curlResult->isSuccess() || empty($curlResult->getBody())) { + Logger::info('Empty body or error when fetching', ['url' => $url, 'success' => $curlResult->isSuccess(), 'code' => $curlResult->getReturnCode()]); return $siteinfo; } @@ -451,6 +452,12 @@ class ParseUrl case 'og:site_name': $siteinfo['publisher_name'] = trim($meta_tag['content']); break; + case 'og:locale': + $siteinfo['language'] = trim($meta_tag['content']); + break; + case 'og:type': + $siteinfo['pagetype'] = trim($meta_tag['content']); + break; case 'twitter:description': $siteinfo['text'] = trim($meta_tag['content']); break; @@ -521,7 +528,7 @@ class ParseUrl * * @param string $page_url * @param array $siteinfo - * @return void + * @return array */ private static function checkMedia(string $page_url, array $siteinfo) : array { @@ -967,6 +974,16 @@ class ParseUrl } } + $content = JsonLD::fetchElement($jsonld, 'datePublished'); + if (!empty($content) && is_string($content)) { + $jsonldinfo['published'] = DateTimeFormat::utc($content); + } + + $content = JsonLD::fetchElement($jsonld, 'dateModified'); + if (!empty($content) && is_string($content)) { + $jsonldinfo['modified'] = DateTimeFormat::utc($content); + } + $jsonldinfo = self::parseJsonLdAuthor($jsonldinfo, $jsonld); Logger::info('Fetched article information', ['url' => $siteinfo['url'], 'fetched' => $jsonldinfo]);