Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return list of photos by hash tag. #1

Closed
cnizzardini opened this issue Jul 17, 2017 · 6 comments
Closed

Return list of photos by hash tag. #1

cnizzardini opened this issue Jul 17, 2017 · 6 comments

Comments

@cnizzardini
Copy link

Return list of photos by hash tag.

IG used to allow this via their API but then removed it. If you can add this I'll give it a go on my works website to replace that functionality.

Thanks.

@NicklasWallgren
Copy link
Owner

NicklasWallgren commented Jul 17, 2017

I have added initial support for the feed endpoint. I'll finish it up tomorrow and create a new release.

You'll be able to access the feeds and tags methods directly from the Instagram instance in the next commit.

Have a look at Instagram\SDK\Client\Features\HashtagFeaturesTrait

Example

// Retrieve the feed
$feed = $instagram->client->feed('INSERT TAG');

$feed->getRankedItems();
$feed->getItems();

// Retrieve the next batch of items 
$result = $feed->next();

@NicklasWallgren
Copy link
Owner

https://github.com/NicklasWallgren/instagram-api/tree/v0.7.6

The release was a bit rushed since I'm going away for a few days, so the API might change in future updates.

Feed example

// Retrieve hashtag feed
$message = $instagram->feed('instagram', Instagram::$FEED_TYPE_HASHTAG);

// Output top result
var_dump($message->getRankedItems());

Search example

// Search by hashtag
$message = $instagram->search('instagram', Instagram::$FEED_TYPE_HASHTAG);

// Retrieve the results collection
$result = $message->getResults();

// Pick the first entry
$hashtag = current($result);

// Retrieve the hashtag feed
$feed = $hashtag->getFeed();

// Output items
var_dump($feed->getRankedItems());

@cnizzardini
Copy link
Author

Damn, wish I could test this out, but the site I am working on runs off 5.6 and you're using 7.x only language features. I'll test this out again when we get around to upgrading.

@NicklasWallgren
Copy link
Owner

No worries. Can we close this issue? :)

@cnizzardini
Copy link
Author

Your call.

@NicklasWallgren
Copy link
Owner

NicklasWallgren commented Jul 22, 2017

Resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants