|
@ -2,6 +2,7 @@ |
|
|
namespace XRay\Formats; |
|
|
namespace XRay\Formats; |
|
|
|
|
|
|
|
|
use DOMDocument, DOMXPath; |
|
|
use DOMDocument, DOMXPath; |
|
|
|
|
|
use DateTime, DateTimeZone; |
|
|
use Parse; |
|
|
use Parse; |
|
|
|
|
|
|
|
|
class Instagram { |
|
|
class Instagram { |
|
@ -25,11 +26,14 @@ class Instagram { |
|
|
] |
|
|
] |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
$profiles = []; |
|
|
|
|
|
|
|
|
// Fetch profile info for this user
|
|
|
// Fetch profile info for this user
|
|
|
$username = $photoData['owner']['username']; |
|
|
$username = $photoData['owner']['username']; |
|
|
$profile = self::_getInstagramProfile($username, $http); |
|
|
$profile = self::_getInstagramProfile($username, $http); |
|
|
if($profile) { |
|
|
if($profile) { |
|
|
$entry['author'] = self::_buildHCardFromInstagramProfile($profile); |
|
|
$entry['author'] = self::_buildHCardFromInstagramProfile($profile); |
|
|
|
|
|
$profiles[] = $profile; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Content and hashtags
|
|
|
// Content and hashtags
|
|
@ -55,7 +59,6 @@ class Instagram { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
$refs = []; |
|
|
$refs = []; |
|
|
$profiles = []; |
|
|
|
|
|
|
|
|
|
|
|
// Find person tags and fetch user profiles
|
|
|
// Find person tags and fetch user profiles
|
|
|
if(array_key_exists('usertags', $photoData) && $photoData['usertags']['nodes']) { |
|
|
if(array_key_exists('usertags', $photoData) && $photoData['usertags']['nodes']) { |
|
@ -72,6 +75,9 @@ class Instagram { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Published date
|
|
|
|
|
|
$published = DateTime::createFromFormat('U', $photoData['date']); |
|
|
|
|
|
|
|
|
// Include venue data
|
|
|
// Include venue data
|
|
|
$locations = []; |
|
|
$locations = []; |
|
|
if($photoData['location']) { |
|
|
if($photoData['location']) { |
|
@ -80,9 +86,19 @@ class Instagram { |
|
|
$entry['location'] = [$location['url']]; |
|
|
$entry['location'] = [$location['url']]; |
|
|
$refs[$location['url']] = $location; |
|
|
$refs[$location['url']] = $location; |
|
|
$locations[] = $location; |
|
|
$locations[] = $location; |
|
|
|
|
|
|
|
|
|
|
|
// Look up timezone
|
|
|
|
|
|
if($location['latitude']) { |
|
|
|
|
|
$tz = \p3k\Timezone::timezone_for_location($location['latitude'], $location['longitude']); |
|
|
|
|
|
if($tz) { |
|
|
|
|
|
$published->setTimeZone(new DateTimeZone($tz)); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$entry['published'] = $published->format('c'); |
|
|
|
|
|
|
|
|
$response = [ |
|
|
$response = [ |
|
|
'data' => $entry |
|
|
'data' => $entry |
|
|
]; |
|
|
]; |
|
|