Skip to content

Commit

Permalink
Add getLocationById example
Browse files Browse the repository at this point in the history
  • Loading branch information
raiym committed Oct 31, 2017
1 parent 8ecb444 commit 5384e4b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
6 changes: 0 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ $instagram->login();

$medias $instagram->getLocationTopMediasById(1)
$medias = $instagram->getLocationMediasById(1);
$location $instagram->getLocationById(1);
$medias = $instagram->getTopMediasByTagName('hello');
```
### Paginate medias
Expand Down Expand Up @@ -112,11 +111,6 @@ echo 'Media id: ' . Media::getIdFromCode('BGiDkHAgBF_');
// Media id: 1270593720437182847
```

### Get location id
```php
$medias = Instagram::getLocationById(1);
```

### Get location top medias by location id
```php
$medias = Instagram::getLocationTopMediasById(1);
Expand Down
17 changes: 17 additions & 0 deletions examples/getLocationById.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php
require __DIR__ . '/../vendor/autoload.php';

$instagram = \InstagramScraper\Instagram::withCredentials('username', 'password', '/path/to/cache/folder');
$instagram->login();

// Location id from facebook
$location = $instagram->getLocationById(1);

echo "Location info: \n";
echo "Id: {$location->getId()}\n";
echo "Name: {$location->getName()}\n";
echo "Latitude: {$location->getLat()}\n";
echo "Longitude: {$location->getLng()}\n";
echo "Slug: {$location->getSlug()}\n";
echo "Is public page available: {$location->getHasPublicPage()}\n";

3 changes: 3 additions & 0 deletions tests/InstagramTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,7 @@ public function testGeMediaCommentsByCode()
//TODO: check why returns less comments
$this->assertEquals(32, sizeof($comments));
}

// TODO: Add test getMediaById
// TODO: Add test getLocationById
}

0 comments on commit 5384e4b

Please sign in to comment.