Closed ppleskov closed 7 years ago
I found it on other bot, i hope it help: https://github.com/LopesX/instabot.py/blob/master/src/instabot.py#L351
def get_media_id_by_tag(self, tag): """ Get media ID set, by your hashtag or location """
if self.login_status:
if tag.startswith('l:'):
tag = tag.replace('l:', '')
self.by_location = True
log_string = "Get Media by location: %s" % (tag)
self.write_log(log_string)
if self.login_status == 1:
url_location = self.url_location % (tag)
try:
r = self.s.get(url_location)
all_data = json.loads(r.text)
self.media_by_tag = list(all_data['graphql']['location']['edge_location_to_media']['edges'])
except:
self.media_by_tag = []
self.write_log("Except on get_media!")
logging.exception("get_media_id_by_tag")
else:
return 0
else:
log_string = "Get Media by tag: %s" % (tag)
self.by_location = False
self.write_log(log_string)
if self.login_status == 1:
url_tag = self.url_tag % (tag)
try:
r = self.s.get(url_tag)
all_data = json.loads(r.text)
self.media_by_tag = list(all_data['graphql']['hashtag']['edge_hashtag_to_media']['edges'])
except:
self.media_by_tag = []
self.write_log("Except on get_media!")
logging.exception("get_media_id_by_tag")
else:
return 0
Nice. Can you please implement it in our bot? Let's make a Pull Request.
Related php code: https://github.com/mgp25/Instagram-API/issues/34 (klawdyo commented on Apr 17, 2016)
Trying to change configurePhoto in _apiphoto.py by adding:
'location' : { 'external_source': 'facebook_places', 'facebook_places_id': 115213835158481, 'lng': 108.1, 'lat': 10.9333, 'name': 'Phan Thiet', 'city': '', 'address': '', 'pk': 216918627 },
but got the following error: