Bolandish\Instagram::getMediaByHashtag PHP Method

getMediaByHashtag() public static method

public static getMediaByHashtag ( $hashtag = null, $count = 16, $assoc = false, $comment_count = false )
    public static function getMediaByHashtag($hashtag = null, $count = 16, $assoc = false, $comment_count = false)
    {
        if (empty($hashtag) || !is_string($hashtag)) {
            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},     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 }  }");
        $media = json_decode(static::getContentsFromUrl($parameters), $assoc || $assoc == "array");
        if ($assoc == "array") {
            $media = $media["media"]["nodes"];
        } else {
            $media = $media->media->nodes;
        }
        return $media;
    }