Skip to content

Commit 7922527

Browse files
authored
Merge pull request #1 from onenonelee/location
Update InstagramAPI.py
2 parents 684fa51 + fde23f5 commit 7922527

1 file changed

Lines changed: 47 additions & 2 deletions

File tree

InstagramAPI/InstagramAPI.py

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,23 @@
1-
#!/usr/bin/env python
1+
Skip to content
2+
3+
Search or jump to
4+
5+
Pull requests
6+
Issues
7+
Marketplace
8+
Explore
9+
10+
@onenonelee Sign out
11+
146
12+
1,740 615 LevPasha/Instagram-API-python
13+
Code Issues 163 Pull requests 42 Projects 0 Wiki Insights
14+
Instagram-API-python/InstagramAPI/InstagramAPI.py
15+
Егор Малышев Added searchLocations() method.
16+
ed74ee4 on 28 Sep 2018
17+
@LevPasha @ri7nz @westscz @raphasousa @Rahandi @DigitalForecast @xecgr @desecho @darland @jamesbrink
18+
1069 lines (927 sloc) 57.5 KB
19+
20+
#!/usr/bin/env python
221
# -*- coding: utf-8 -*-
322

423
import requests
@@ -78,7 +97,6 @@ def setUser(self, username, password):
7897
def setProxy(self, proxy=None):
7998
"""
8099
Set proxy for all requests::
81-
82100
Proxy format - user:password@ip:port
83101
"""
84102

@@ -735,6 +753,21 @@ def searchLocation(self, query):
735753
locationFeed = self.SendRequest('fbsearch/places/?rank_token=' + str(self.rank_token) + '&query=' + str(query))
736754
return locationFeed
737755

756+
def geosearchLocations(self, lat, lng):
757+
"""
758+
Search for nearby Instagram locations by geographical coordinates
759+
:rtype: bool
760+
:param lat: latitude
761+
:param lng: longitude
762+
"""
763+
query = "location_search?latitude={lat}&longitude={lng}&rank_token={token}".format(
764+
lat=str(lat),
765+
lng=str(lng),
766+
token=self.rank_token,
767+
)
768+
locations_status = self.SendRequest(query)
769+
return locations_status
770+
738771
def getLocationFeed(self, locationId, maxid=''):
739772
return self.SendRequest('feed/location/' + str(locationId) + '/?max_id=' + maxid + '&rank_token=' + self.rank_token + '&ranked_content=true&')
740773

@@ -1050,3 +1083,15 @@ def getTotalLikedMedia(self, scan_rate=1):
10501083
except KeyError as e:
10511084
break
10521085
return liked_items
1086+
© 2019 GitHub, Inc.
1087+
Terms
1088+
Privacy
1089+
Security
1090+
Status
1091+
Help
1092+
Contact GitHub
1093+
Pricing
1094+
API
1095+
Training
1096+
Blog
1097+
About

0 commit comments

Comments
 (0)