Skip to content

Commit

Permalink
fixes #13
Browse files Browse the repository at this point in the history
  • Loading branch information
Bolandish committed Jun 14, 2016
1 parent 4713035 commit 2449912
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"email": "[email protected]"
}
],
"version": "1.0.8",
"version": "1.0.9",
"autoload": {
"psr-4": {"Bolandish\\": "src/"}
}
Expand Down
14 changes: 12 additions & 2 deletions src/Instagram.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,13 @@ public static function getMediaByHashtag($hashtag = null, $count = 16, $assoc =
{
return false;
}
if($comment_count){
$comments = "comments.last($comment_count) { count, nodes { id, created_at, text, user { id, profile_pic_url, username } }, page_info }";
}else{
$comments = "comments { count }";
}
$hashtag = strtolower($hashtag);
$parameters = urlencode("ig_hashtag($hashtag) { media.first($count) { count, nodes { caption, code, comments.last($comment_count) { count, nodes { id, created_at, text, user { id, profile_pic_url, username } }, page_info }, date, dimensions { height, width }, display_src, id, is_video, likes { count }, owner { id, username, full_name, profile_pic_url, biography }, thumbnail_src, video_views, video_url }, page_info } }");
$parameters = urlencode("ig_hashtag($hashtag) { media.first($count) { count, nodes { caption, code, $comments, date, dimensions { height, width }, display_src, id, is_video, likes { count }, owner { id, username, full_name, profile_pic_url, biography }, thumbnail_src, video_views, video_url }, page_info } }");
$url = "https://www.instagram.com/query/?q=$parameters&ref=tags%3A%3Ashow";
$media = json_decode(file_get_contents($url), ($assoc || $assoc == "array"));
if($assoc == "array")
Expand All @@ -25,7 +30,12 @@ public static function getMediaByUserID($user = null, $count = 16, $assoc = fals
{
return false;
}
$parameters = urlencode("ig_user($user) { media.first($count) { count, nodes { caption, code, comments.last($comment_count) { count, nodes { id, created_at, text, user { id, profile_pic_url, username } }, page_info }, date, dimensions { height, width }, display_src, id, is_video, likes { count }, owner { id, username, full_name, profile_pic_url, biography }, thumbnail_src, video_views, video_url }, page_info } }");
if($comment_count){
$comments = "comments.last($comment_count) { count, nodes { id, created_at, text, user { id, profile_pic_url, username } }, page_info }";
}else{
$comments = "comments { count }";
}
$parameters = urlencode("ig_user($user) { media.first($count) { count, nodes { caption, code, $comments, date, dimensions { height, width }, display_src, id, is_video, likes { count }, owner { id, username, full_name, profile_pic_url, biography }, thumbnail_src, video_views, video_url }, page_info } }");
$url = "https://www.instagram.com/query/?q=$parameters&ref=tags%3A%3Ashow";
$media = json_decode(file_get_contents($url),($assoc || $assoc == "array"));
if($assoc == "array")
Expand Down

0 comments on commit 2449912

Please sign in to comment.