GithubHelp home page GithubHelp logo

Comments (2)

LopesX avatar LopesX commented on May 19, 2024 1

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

from igbot.

ohld avatar ohld commented on May 19, 2024

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

from igbot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.