Skip to content
This repository has been archived by the owner on Feb 25, 2024. It is now read-only.

DEVELOPERS: add location (geo tag) to a post #65

Closed
ppleskov opened this issue Feb 22, 2017 · 2 comments
Closed

DEVELOPERS: add location (geo tag) to a post #65

ppleskov opened this issue Feb 22, 2017 · 2 comments

Comments

@ppleskov
Copy link
Contributor

ppleskov commented Feb 22, 2017

Related php code: mgp25/Instagram-API#34 (klawdyo commented on Apr 17, 2016)

Trying to change configurePhoto in api_photo.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:

<Response [500]>
{'status': 'fail', 'message': "Other media configure error: b'E3v4zLVnwi'"}

@ohld ohld closed this as completed Jul 14, 2017
@LopesX
Copy link

LopesX commented Nov 9, 2018

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

@ohld
Copy link
Owner

ohld commented Nov 10, 2018

Nice. Can you please implement it in our bot? Let's make a Pull Request.

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

No branches or pull requests

3 participants