Skip to content

Commit

Permalink
Merge pull request #23 from alexpablo/patch-1
Browse files Browse the repository at this point in the history
Add media location name
  • Loading branch information
raiym authored Jun 29, 2016
2 parents dcb0e6c + 1313463 commit fc39ab4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/InstagramScraper/Model/Media.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class Media
public $owner;
public $ownerId;
public $likesCount;
public $locationName;
public $commentsCount;

function __construct()
Expand Down Expand Up @@ -54,6 +55,9 @@ public static function fromApi($mediaArray)
$instance->videoStandardResolutionUrl = $mediaArray['videos']['standard_resolution']['url'];
$instance->videoLowBandwidthUrl = $mediaArray['videos']['low_bandwidth']['url'];
}
if (isset($mediaArray['location'])) {
$instance->locationName = $mediaArray['location']['name'];
}
return $instance;
}

Expand Down Expand Up @@ -91,6 +95,9 @@ public static function fromMediaPage($mediaArray)
if (isset($mediaArray['caption'])) {
$instance->caption = $mediaArray['caption'];
}
if (isset($mediaArray['location'])) {
$instance->locationName = $mediaArray['location']['name'];
}
$instance->owner = Account::fromMediaPage($mediaArray['owner']);
return $instance;
}
Expand Down Expand Up @@ -179,4 +186,4 @@ public static function getCodeFromId($id)
};
return $shortenedId;
}
}
}

0 comments on commit fc39ab4

Please sign in to comment.