API::Instagram::Media - Instagram Media Object
version 0.009
my $media = $instagram->media(3); printf "Caption: %s\n", $media->caption; printf "Posted by %s (%d likes)\n\n", $media->user->username, $media->likes; my $location = $media->location; printf "Media Location: %s (%f,%f)", $location->name, $location->latitude, $location->longitude;
See http://instagr.am/developer/endpoints/media/.
Returns media id.
Returns media type.
Returns the API::Instagram::User object of the user who posted the media.
Returns media shortlink.
Returns media filter.
Returns a list API::Instagram::Tag objects of media tags.
Returns media API::Instagram::Location object.
my $thumbnail = $media->images->{thumbnail}; printf "URL: %s (%d x %d)" $thumbnail->{url}, $thumbnail->{width}, $thumbnail->{height};
Returns media images options and details.
my $standart = $media->videos->{standart_resolution}; printf "URL: %s (%d x %d)" $standart->{url}, $standart->{width}, $standart->{height};
Returns media videos options and details, when video type.
for my $each ( @{ $media->users_in_photo } ) { my $user = $each->{user}; my $position = $each->{position}; printf "%s is at %f, %f\n", $user->username, $position->{x}, $position->{y}; }
Returns a list of API::Instagram::User objects of users tagged in the media with their coordinates.
Returns media caption text.
Returns the media date in a Time::Moment object.
printf "Total Likes: %d\n", $media->likes; # Total likes when object was created or printf "Total Likes: %d\n", $media->likes(1); # Up to date total likes
Returns media total likes. If you set 1 as parameter it will renew all media data and return an up-do-date total likes.
1
Hint: 1 as parameter also updates total comments, last likes and last comments.
printf "Total Comments: %d\n", $media->comments; # Total comments when object was created or printf "Total Comments: %d\n", $media->comments(1); # Up to date total comments
Returns media total comments. If you set 1 as parameter it will renew all media data and return an up-do-date total comments.
Hint: 1 as parameter also updates total likes, last likes and last comments.
for my $user ( @{ $media->last_likes } ) { say $user->username; }
Returns a list of API::Instagram::User of the last users who liked the media. If you set 1 as parameter it will renew all media data and return an up-do-date list.
API::Instagram::User
Hint: 1 as parameter also updates total likes, total comments and last comments.
for my $comment ( @{ $media->last_comments } ) { printf "%s: %s\n", $comment->from->username, $comment->text; }
Returns a list of API::Instagram::Media::Comment of the last comments on the media. If you set 1 as parameter it will renew all media data and return an up-do-date list.
API::Instagram::Media::Comment
Hint: 1 as parameter also updates total likes, total comments and last likes.
my @likers = $media->get_likes( count => 5 );
Returns a list of API::Instagram::User objects of users who liked the media.
Accepts count.
count
my @comments = $media->get_comments( count => 5 );
Returns a list of API::Instagram::Media::Comment objects of the media.
Gabriel Vieira <gabriel.vieira@gmail.com>
This software is copyright (c) 2014 by Gabriel Vieira.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install API::Instagram, copy and paste the appropriate command in to your terminal.
cpanm
cpanm API::Instagram
CPAN shell
perl -MCPAN -e shell install API::Instagram
For more information on module installation, please visit the detailed CPAN module installation guide.