Example #1
0
    def find_user_by_keywords(self, *keywords, max_profiles=10):
        '''
        Cerca dei profili Instagram in base alle parole chiave usate

        Params:
        @keyords: Nome utente dell'utente da trovare
        @max_profiles: NUmero massimo di profili da ottenere

        Return:
        Lista di profili individuati
        '''

        try:
            # Unisce le keywords
            keywords = [str(i) for i in keywords if i is not None]
            keyword = ' '.join(keywords).strip()
            if keyword == '':
                return []

            # Ricerca i profili
            results = instaloader.TopSearchResults(self._ig_client.context,
                                                   keyword)
            profiles = [profile for profile in results.get_profiles()]

            # Limita il numero di profili
            if len(profiles) > max_profiles:
                profiles = profiles[:10]

            if self._logger is not None:
                self._logger.info('Found {} profiles with keywords {}'.format(
                    len(profiles), generic.only_ASCII(keyword)))
            return profiles
        except Exception as ex:
            self._manage_error(WEBDRIVER_GENERIC_ERROR, ex)
            return []
Example #2
0
def main():
    userName = input("Enter username/Email/Phoneno:")
    passWord = getpass.getpass(prompt='Password:'******'1':
            username1 = input("Enter desired username:"******"=" * 22)
            for i in mutual_following:
                print(i)
        if k == '2':
            accept_follow_requests(session)
        if k == '3':
            username1 = input("Enter desired username:"******"Enter desired username:"******"what you want to search:-")
            print(
                "By:-\n1)Profiles\n2)Location\n3)Hashtag Strings\n4)Hashtags\n5)Prefixed_username"
            )
            s = input("Enter your chice-")
            tsr = instaloader.TopSearchResults(L.context, search)

            if s == '1': q = tsr.get_profiles()
            if s == '2': q = tsr.get_locations()
            if s == '3': q = tsr.get_hastag_string()
            if s == '4': q = tsr.get_hashtags()
            if s == '5': q = tsr.get_prefixed_usernames()
            for i in q:
                print(i)

        if k == '6':
            username1 = input("Enter desired username:")
            profile = createprofile(L, username1)
            print(profile.profile_pic_url)

        if k == '7':

            profile = createprofile(L, userName)
            savedPost = profile.get_saved_posts()
            for i in savedPost:
                L.download_post(i, target=profile.username)

        if k == '8':
            break
def get_top_5_hashtags(search_string):
    """
    This takes any search string and then queries instagram to find 
    """
    L = instaloader.Instaloader()
    hashtag_list = []
    hashtags = instaloader.TopSearchResults(L.context, search_string)

    for val in hashtags.get_hashtag_strings():
        hashtag_list.append(val)

    return hashtag_list[0:5]