Exemple #1
0
    def get(self, request, *args, **kwargs):
        hashtags = request.GET
        if len(hashtags) == 0:
            self.queryset = Hashtag.objects.all()
            return super().get(request, *args, **kwargs)
        elif request.GET['submit'] == 'Очистить':
            Hashtag.objects.all().delete()
            Post.objects.all().delete()
            UserPost.objects.all().delete()
            PostList.objects.all().delete()
        elif request.GET['submit'] == 'submit':
            Hashtag.objects.all().delete()
            ShpionFollowingFollowers.objects.all().delete()
            ShpionFollowing.objects.all().delete()
            shpion = Shpion.objects.all()[0]
            user = shpion.username
            password = shpion.password
            loader = instaloader.Instaloader()
            loader.login(user, password)
            followees = instaloader.Profile.from_username(
                loader.context, user).get_followees()
            followees = LockedIterator(followees)
            for profile in followees:
                followers = instaloader.Profile.from_username(
                    loader.context, str(profile.username)).get_followers()
                followers = str(list(followers))
                ShpionFollowing.objects.create(username=profile.username,
                                               followers=followers)

            followees_users = ShpionFollowing.objects.all()
            for follow in followees_users:
                shpion.following.add(follow)
        l = []
        for hashtag in hashtags:
            if 'hashtag' in hashtag:
                l.append(hashtags[hashtag])
        hashtags = l
        # if request.GET['submit']=='Обновить':
        #     self.queryset = Hashtag.objects.all()
        #     hashtag = hashtags[0]
        #     Post.objects.filter(hashtag=hashtag).delete()
        #     UserPost.objects.filter(hashtag=hashtag).delete()
        #     return super().get(request, *args, **kwargs)
        for hashtag in hashtags:
            PostList.objects.filter(hashtag=hashtag).delete()
            h = instaloader.Hashtag.from_name(loader.context,
                                              hashtag).mediacount

            Hashtag.objects.create(hashtag=hashtag, count=int(h))
            # posts = instaloader.Hashtag.from_name(loader.context, str(hashtag)).get_all_posts()
            posts = instaloader.Instaloader().get_hashtag_posts(hashtag)
            for post in posts:

                if not PostList.objects.filter(hashtag=hashtag,
                                               posts=post.shortcode):
                    PostList.objects.create(hashtag=hashtag,
                                            posts=post.shortcode)
        self.queryset = Hashtag.objects.all()
        return super().get(request, *args, **kwargs)
Exemple #2
0
    def __init__(self, posttypes=config.POST_TYPES) -> None:

        self.post_types = posttypes

        self.ACL = instaloader.Instaloader(dirname_pattern=config.UNITEDREPO,
                                           download_videos=False,
                                           download_video_thumbnails=False)
        self.GL = instaloader.Instaloader(dirname_pattern=config.CITYREPO,
                                          download_videos=False,
                                          download_video_thumbnails=False)
Exemple #3
0
def loginIG(opts):
    if opts.action == "full":
        # we need a different instance, with different options, when we want to download the full posts, igtv and stories of an account
        L = instaloader.Instaloader(download_video_thumbnails=False, download_geotags=False, download_comments=False, save_metadata=False, post_metadata_txt_pattern="", dirname_pattern=opts.profilename, request_timeout=10.0)
        L.login('NNNNNNNN', 'XXXXXXXXX')
        return L
    else:
        # standard instance. No videos, basically
        L = instaloader.Instaloader(download_videos=False, download_video_thumbnails=False, download_geotags=False, download_comments=False, save_metadata=False, post_metadata_txt_pattern="", request_timeout=10.0)
        L.login('NNNNNNNN', 'XXXXXXXXX')
        return L
Exemple #4
0
    def __init__(self,
                 unitedrepo=config.UNITEDREPO,
                 cityrepo=config.CITYREPO) -> None:

        self.unitedrepo = unitedrepo
        self.cityrepo = cityrepo

        self.ACL = instaloader.Instaloader(dirname_pattern=config.UNITEDREPO,
                                           download_videos=False,
                                           download_video_thumbnails=False)
        self.GL = instaloader.Instaloader(dirname_pattern=config.CITYREPO,
                                          download_videos=False,
                                          download_video_thumbnails=False)
def scrapeVideos(username = "",
                 password = "",
                 output_folder = "",
                 days = 1):
        
    print("Starting Scraping")

    L = instaloader.Instaloader()

    # Login or load session for loader
    L.login(username, password)  
    profile = instaloader.Profile.from_username(L.context, username)
    following = profile.get_followees()
    print(following)

    for profile in following:
        acc = profile.username
        looter = ProfileLooter(acc, videos_only=True, template="{id}-{username}-{width}-{height}")
        if not looter.logged_in():
            looter.login(username, password)
        print("Scraping From Account: " + acc)

        today = datetime.date.today()
        timeframe = (today, today - dateutil.relativedelta.relativedelta(days=days))
        numDowloaded = looter.download(output_folder, media_count=30, timeframe=timeframe)
        print("Downloaded " + str(numDowloaded) + " videos successfully")
        print("")
Exemple #6
0
    def login(self, username, password):
        # Get followers from instagram
        if not os.path.isfile("followers.json"):
            L = instaloader.Instaloader()
            # Login or load session
            L.login(username, password)  # (login)
            # Obtain profile metadata
            profile = instaloader.Profile.from_username(L.context, username)
            self.followers = profile.get_followers()
            self.followers = [x.username for x in self.followers]
            with open('followers.json', 'w') as json_file:
                json.dump(self.followers, json_file)
        # Read list of followers, you can use as list of persons that you want to mention
        else:
            with open('followers.json') as f:
                self.followers = json.load(f)

        username_input = self.browser.find_element_by_css_selector(
            "input[name='username']")
        password_input = self.browser.find_element_by_css_selector(
            "input[name='password']")
        username_input.send_keys(username)
        password_input.send_keys(password)
        login_button = browser.find_element_by_xpath(
            "//button[@type='submit']")
        login_button.click()
        sleep(2)
Exemple #7
0
    def __init__(self, username):
        """"
        Initialize an instance of InstagramBot class.

        Args:
            username:str: The Instagram account username

        Attributes:
            driver:Selenium.webdriver.Chrome: The Chromedriver that is used for browser automation
        """
        # Username
        self.username = username

        # Define base url
        self.base_url = 'https://www.instagram.com'

        # Instantiate an instaloader object
        self.instance = instaloader.Instaloader()

        # Login with username from a session file. **Note that you have to login once with
        # your username from terminal to create a session file
        self.instance.load_session_from_file(self.username)

        # Get the profile with self.username
        self.user_profile = self.get_profile(self.username)
def get_hashtag_metrics(hashtag):
    L = instaloader.Instaloader()
    curr_time = datetime.datetime.now()
    # Get the posts for the hashtag as a generator
    hasthag_posts = L.get_hashtag_posts(hashtag)

    like_list = []
    comment_list = []
    days_list = []

    # Loop through the latest 5 post for the hashtag and calculate metrics
    count = 0

    for val in hasthag_posts:
        if count < 10:
            diff = curr_time - val.date_local
            days_list.append(diff.days)
            like_list.append(val.likes)
            comment_list.append(val.comments)
            count += 1
        else:
            break

    ## Get the averages of all the key metrics
    like_avg = abs(int(np.average(like_list)))
    comment_avg = abs(int(np.average(comment_list)))
    days_avg = max(
        abs(float(np.average(days_list))), 0.01
    )  # if this value is 0, we divide it by 0.01 so that the hashtag_score does not throw errors

    hashtag_score = round(((like_avg + (comment_avg * 3)) / days_avg), 2)

    return like_avg, comment_avg, days_avg, hashtag_score
 def __init__(self, username, password):
     self.username = username
     self.password = password
     self.insta_session = instaloader.Instaloader()
     self.insta_session.login(username, password)
     self.profile_data = instaloader.Profile.from_username(
         self.insta_session.context, username)
def ambilfollowers(target):
    L = instaloader.Instaloader(max_connection_attempts=0)

    # Login or load session
    username = '******'
    password = '******'
    L.login(username, password)  # (login)

    follow_list = [target]
    # Obtain profile metadata
    instagram_target = target
    profile = instaloader.Profile.from_username(L.context, instagram_target)
    #print(profile.get_followers())
    #count=1
    #file = open("instagram_followers.txt","w")
    for followee in profile.get_followers():
        username = followee.username
        follow_list.append(username)
        #follow_list.extend(username)
        #file.write(str(count) + ". " + username + "\n")
        #print(str(count) + ". " + username)
        #count = count + 1

    print("Follower " + target + " Berhasil Didapatkan")
    #file.close()
    return follow_list
Exemple #11
0
def insta_content(url):
    '''
    connects to the instagram post by given URL argument.
    downloads the content post image to the media/ dir.
    returns content post data to create ContentPost instance.
    '''
    L = instaloader.Instaloader()
    shortcode = url.split('/')[-2]
    try:
        post = instaloader.Post.from_shortcode(L.context, shortcode)
    except instaloader.exceptions.InstaloaderException:
        return None
    else:
        title = post.profile
        description = post.caption
        pub_date = post.date
        post_url = post.url

        path = settings.MEDIA_ROOT
        suffix = datetime.datetime.now().strftime("%y%m%d_%H%M%S")
        filename = "_".join([title, suffix]) + '.jpg'

        urllib.request.urlcleanup()
        urllib.request.urlretrieve(post_url, path + filename)

        return [title, description, pub_date, filename]
Exemple #12
0
def get_parameters():
    instagramid = input("Instagram ID: ")
    try:
        L = instaloader.Instaloader(save_metadata=False)
        instaloader.Profile.from_username(L.context, instagramid)
    except instaloader.exceptions.QueryReturnedNotFoundException:
        sys.exit("Profile https://www.instagram.com/" + instagramid +
                 " does not exist")

    print("Choose a start and end date. Format: 22-09-2020")
    from_date = input("From date: ")
    try:
        from_date = datetime.datetime.strptime(from_date, "%d-%m-%Y")
    except ValueError:
        sys.exit("invalid date format")

    end_date = input("End date: ")
    try:
        end_date = datetime.datetime.strptime(end_date, "%d-%m-%Y")
    except ValueError:
        sys.exit("invalid date format")

    print("Choose the order of images and videos in the presentation.")
    print("Choose 1 for newest to oldest, choose 2 for oldest to newest")
    order = input("Choose 1 or 2: ")
    if order != "1" and order != "2":
        sys.exit("Choose either 1 or 2")

    return instagramid, from_date, end_date, order
 def _from_instagram(self):
     ''' Downloads [num_images] latest images from an instagram profile.
     User and password may be needed to download pictures from private profiles.
     '''
     if not self.instagram:
         raise Exception("_from_instagram() cannot be invoked with current context. Set instagram=True.")
     
     # Get instance
     L = instaloader.Instaloader(save_metadata=False, download_comments=False, post_metadata_txt_pattern="")
     
     # If credentials were provided, login to Instagram
     if self.user is not None and self.password is not None:
         L.login(self.user, self.password)
     
     # Creates a profile object for the specified target
     profile = instaloader.Profile.from_username(L.context, self.path)
     
     # Adjusting the number of downloadable images
     post_iter = profile.get_posts()
     
     # Delete contents of ./tmp directory in case it exists
     self.path = "tmp"
     if os.path.isdir('./tmp'):
         shutil.rmtree('./tmp') 
         
     # Downloading only [num_images] images
     for post in islice(post_iter, self.num_images):
         L.download_post(post, "tmp")
def instaloader_download_hash(user: str, pw: str, hashtagList, start_time,
                              end_time):
    '''

    :param user: username for instagram login
    :param pw: the password for the username
    :param hashtag: the collection of hashtags given to that account
    :param start_time: the first datatime to keep
    :param end_time: the last datetime to keep
    :return: None
    '''

    L = instaloader.Instaloader(download_videos=False,
                                max_connection_attempts=1000,
                                download_geotags=True,
                                download_comments=False,
                                compress_json=False)
    if os.path.exists('session-' + user):
        L.load_session_from_file(username=user, filename='session-' + user)
    else:
        L.login(user, pw)
        L.save_session_to_file(filename='session-' + user)

    j = 0
    # for each hashtag, there is the download of all the post associated
    while (j < len(hashtagList)):
        try:
            hashtag = instaloader.Hashtag.from_name(L.context, hashtagList[j])

            posts = hashtag.get_posts()

            SINCE = start_time  # datetime(2020, 6, 29)  # further from today, inclusive (da)
            UNTIL = end_time  # datetime(2020, 7, 5)  # closer to today, not inclusive (a)

            k = 0  # initiate k
            k_list = []  # uncomment this to tune k

            for post in posts:
                postdate = post.date

                if postdate > UNTIL:
                    continue
                elif postdate <= SINCE:
                    k += 1
                    if k == 50:
                        break
                    else:
                        continue
                else:
                    time.sleep(5)
                    L.download_post(post, "Hashtag")
                    k = 0  # set k to 0
                    # if you want to tune k, uncomment below to get your k max
                    # k_list.append(k)
            j = j + 1
        except:

            j = j + 1

    return None
Exemple #15
0
def fetchUsersFromIG(login, password, srcUsernames, blacklist, quantity=1000):
    print("Fetching users to dm...")
    users = []
    igl = instaloader.Instaloader()
    igl.login(login, password)
    for user in srcUsernames:
        print(f"=> Fetching from '{user}' account...")
        profile = instaloader.Profile.from_username(igl.context, user)
        with tqdm(total=quantity) as pbar:
            for follower in profile.get_followers():
                #print(follower)
                users.append(follower.username)
                pbar.update(1)
                if len(users) == quantity:
                    if __is_followers_list_valid__(blacklist, users):
                        break
                    else:
                        print(
                            "/!\ : Too much blacklisted users in fetched ones! Continue..."
                        )
                        users.clear()
                        pbar.reset()

    print("Writing fetched data to csv...")
    if not os.path.exists('data/users.csv'):
        os.mknod('data/users.csv')
    with open("data/users.csv", 'w') as f:
        writer = csv.DictWriter(f, fieldnames=["Username"])
        writer.writeheader()
        for user in users:
            #print(user)
            writer.writerow({'Username': user})
    f.close()

    print("Users fetching successfully completed!")
Exemple #16
0
    def __init__(self,**kwargs):


        self.default_attr = dict(username='', usernames=[], filename=None,
                            login_user=None, login_pass=None,
                            followings_input=False, followings_output='profiles.txt',
                            destination='./', logger=None, retain_username=False, interactive=False,
                            quiet=False, maximum=0, media_metadata=False, profile_metadata=False, latest=False,
                            latest_stamps=False, cookiejar=None, filter_location=None, filter_locations=None,
                            media_types=['image', 'video', 'story-image', 'story-video'],
                            tag=False, location=False, search_location=False, comments=False,
                            verbose=0, include_location=False, filter=None, proxies={}, no_check_certificate=False,
                            template='{urlname}', log_destination='')
        allowed_attr = list(self.default_attr.keys())
        self.default_attr.update(kwargs)
        self.start_time = 0
        self.start_time1 = 0
        for key in self.default_attr:
            if key in allowed_attr:
                self.__dict__[key] = self.default_attr.get(key)
        self.instaloader = instaloader.Instaloader()
        self.instaloader.login(self.default_attr['login_user'], self.default_attr['login_pass'])
        self.session = requests.Session()
        self.session.headers = {'user-agent': CHROME_WIN_UA}
        self.cookiejar = None

        self.cookies = None
        self.authenticated = False
        self.logged_in = False
        self.last_scraped_filemtime = 0
        self.quit = False
Exemple #17
0
def main():
    intents = discord.Intents.default()
    intents.members = True
    bot = commands.Bot(command_prefix='!', intents=intents)
    slash = SlashCommand(bot, sync_commands=True, sync_on_cog_reload=True)

    config = parse_config()
    certificate = credentials.Certificate(config['firebase_credentials'])
    initialize_app(certificate, {'databaseURL': config['firebase_db']})
    firebase_ref = db.reference()
    twitter_api = twitter.Api(consumer_key=config['consumer_key'], consumer_secret=config['consumer_secret'], access_token_key=config['access_token_key'], access_token_secret=config['access_token_secret'], tweet_mode='extended')
    insta_api = instaloader.Instaloader(max_connection_attempts=1)
    insta_api.load_session_from_file(config['instagram_user'], filename='./.instaloader-session')
    calendar = build('calendar', 'v3', http=file.Storage('credentials.json').get().authorize(Http()))

    bot.add_cog(Help(bot))
    bot.add_cog(Oshi(bot))
    bot.add_cog(Info(bot))
    bot.add_cog(Events(bot))
    bot.add_cog(Tags(bot, firebase_ref))
    bot.add_cog(Pics(bot, twitter_api, insta_api))
    bot.add_cog(Misc(bot, config))
    bot.add_cog(Loop(bot, config, firebase_ref, calendar, twitter_api, insta_api))
    bot.add_cog(Listen(bot))

    bot.run(config['token'])
Exemple #18
0
def getComments():
    # print("This function will get comments")

    global btn_getRandom
    global label
    global usernames

    L = instaloader.Instaloader()
    post = Post.from_shortcode(L.context, 'CDjK4YqA5r6')
    usernames = list(set([comment.owner.username for comment in post.get_comments()]))

    #shuffling the list randomly
    random.shuffle(usernames)

    btn_getInfo.destroy()

    btn_getRandom = Button(canvas, text = "Randomly Select a Winner", font=("Helvetica", 12), command=selectWinner)
    canvas.create_window(250,200,window=btn_getRandom)
    label = Label(text = "Winner will be displayed here", font=("Helvetica", 12))
    canvas.create_window(250,270,window=label)

    #let me remove my own account from the list :
    usernames.remove("femindharamshi")
    usernames.remove("beyondhelloworld")

    for user in sorted(usernames):
        print(user)
Exemple #19
0
def baixar(hashtag, filtro, usa_paciencia, pasta):
    paciencia = 0
    paciencia_total = 1000

    instaBot = instaloader.Instaloader(compress_json=False,
                                       download_comments=False,
                                       download_videos=False,
                                       max_connection_attempts=8000,
                                       dirname_pattern='{target}',
                                       filename_pattern='{date_local}_BRT')

    print("Requisitando posts...\n")

    lista_posts = instaBot.get_hashtag_posts(hashtag)

    print("Iniciando contagem...\n")

    for post in lista_posts:
        if (filtro(post)):
            paciencia = 0
            print("Post encontrado!\n")
            instaBot.download_post(post, pasta)
        else:
            paciencia = paciencia + 1
            if (paciencia == paciencia_total and usa_paciencia):
                print("Fim do processo\n")
                break
def check_followers_with_details(username, password):
    L = instaloader.Instaloader()
    L.login(username, password)

    profile = instaloader.Profile.from_username(L.context, "lomos_dungeon")
    current_followers = profile.get_followers()
    current_followers = [user.username for user in current_followers]

    if not path.exists(follower_list_file):
        save_followers_to_file(current_followers)
    else:
        f = open(follower_list_file, "r+")
        old_followers = f.read()
        f.close()
        old_followers = ast.literal_eval(old_followers)

        follower_change = len(current_followers) - len(old_followers)

        if follower_change != 0:
            unfollowers = set(old_followers) - set(current_followers)
            message = "Followers changed by {} - from {} to {}".format(
                follower_change, len(old_followers), len(current_followers))
            send_discord_message(message, unfollowers)

        save_followers_to_file(current_followers)
Exemple #21
0
def ruins_work(username, password, proxy):
    print('Ruin {} with password {} started his work'.format(username.upper(), password))
    instaloader_session = instaloader.Instaloader()
    instaloader_session.login(username, password, proxy)
    while True:
        block = get_find_people_block(username)
        process_find_people_block(instaloader_session, block, username)
Exemple #22
0
def download():
    try:
        ig = instaloader.Instaloader()
        dp = input("UserName: "******"Oops, Username is wrong")
Exemple #23
0
 def get(self, request, *args, **kwargs):
     if request.GET:
         Shpion.objects.all().delete()
         ShpionFollowing.objects.all().delete()
         shpion = request.GET['username']
         password = request.GET['password']
         Shpion.objects.create(username=shpion, password=password)
         loader = instaloader.Instaloader()
         loader.login(shpion, password)
         # followees = instaloader.Profile.from_username(loader.context, shpion)
         # for profile in followees.get_followees():
         #     ShpionFollowing.objects.create(username=profile.username)
         # user = Shpion.objects.filter(username=shpion)[0]
         # followees_users = ShpionFollowing.objects.all()
         # for follow in followees_users:
         #     user.following.add(follow)
         # shpion_following = []
         # for i in user.following.all():
         #     shpion_following.append(i)
         # for i in shpion_following:
         #     followers = instaloader.Profile.from_username(loader.context, str(i)).get_followers()
         #     followers = LockedIterator(followers)
         #     for profile in followers:
         #         ShpionFollowingFollowers.objects.create(username=profile.username, user_id=profile.userid)
         #     user = ShpionFollowing.objects.filter(username=i)[0]
         #     for i in ShpionFollowingFollowers.objects.all():
         #         user.followers.add(i)
     self.queryset = Shpion.objects.all()
     return super().get(request, *args, **kwargs)
Exemple #24
0
def index(request):

    loader = instaloader.Instaloader(compress_json=False)
    lista_usernames = []
    #lista_usernames= ["adasdas_studio","poco"]
    lista_profiles = []

    for username in lista_usernames:
        profile = instaloader.Profile.from_username(loader.context, username)
        lista_profiles.append(profile)
        p = Profile(username=profile.username,
                    user_id=profile.userid,
                    n_followers=profile.followers,
                    n_followees=profile.followees)
        p.save()

        for post in profile.get_posts():

            aware_datetime = make_aware(post.date_utc)

            t = Post(profile=p,
                     mediaid=post.mediaid,
                     date_utc=aware_datetime,
                     caption=post.caption,
                     video_view_count=post.video_view_count,
                     likes=post.likes,
                     comments=post.comments)
            t.save()

    loader.download_profiles(lista_profiles)

    return HttpResponse("Hecho")
Exemple #25
0
def get_non_following_back(username, password):
    insta = instaloader.Instaloader()

    try:
        insta.login(username, password)
    except BadCredentialsException:
        print("Bad  Credentials.")
        exit()

    print("Logged in to instaLoader.")

    profile = instaloader.Profile.from_username(insta.context, username)

    excludes = open('./excludes.txt').read().splitlines()
    followers = []
    followings = []
    non_following_back = []

    for follower in profile.get_followers():
        followers.append(follower.username)

    for following in profile.get_followees():
        followings.append(following.username)

    for following in followings:
        if following not in followers and following not in excludes:
            non_following_back.append(following)

    return non_following_back
def downloadIG():
    ig = instaloader.Instaloader()
    dp = input("Enter Insta Username: "******"downloading >>>>>>>> ")
    try:
        ig.download_profile(dp, profile_pic_only=True)
        print("downloaded successfully!")

        ROOT_DIR = os.path.abspath(os.curdir)

        print("DOWNLOAD PATH: " + path_to_download_folder)
        for (dirpath, dirnames, filenames) in walk("./" + dp + "/"):
            for filename in filenames:
                if ".jpg" in filename:
                    shutil.move(ROOT_DIR + "/" + dp + "/" + filename,
                                path_to_download_folder + filename)
                    print("moved " + filename + " to Downloads!")
    except:
        print("Error downloading profile >>>>")

    if path.exists("./" + dp + "/"):
        try:
            shutil.rmtree("./" + dp + "/")
        except OSError as e:
            print("Error: %s - %s." % (e.filename, e.strerror))

    menu()
Exemple #27
0
def drive():
    il = instaloader.Instaloader()
    profile = login_self(il)
    followers, followings = get_follow_info(profile)
    sav_in_file = input(
        "Do you want to save Follower/Following details in a file?(y/n)\n$> "
    ).casefold()
    if sav_in_file == 'y':
        followers_file = open("followers.txt", '+a')
        write_to_file(followers, followers_file)
        followings_file = open("following.txt", '+a')
        write_to_file(followings, followings_file)
        followers_file.close()
        followings_file.close()

    desperados = find_desperate_influencers(followers,
                                            followings,
                                            mode='strict')
    sav_in_file = input(
        "\n\nDo you want to save these desperate influencers details to a file(y/n)\n$>"
    ).casefold()
    if sav_in_file == 'y':
        desperados_file = open("jerks.txt", '+a')
        write_to_file(desperados, desperados_file)
        desperados_file.close()
Exemple #28
0
def downloadProfilePic(username):
    parser = instaloader.Instaloader(dirname_pattern=".//chat//icons",
                                     filename_pattern="{owner_username}",
                                     save_metadata=False,
                                     download_pictures=False,
                                     download_videos=False,
                                     download_video_thumbnails=False,
                                     download_geotags=False,
                                     download_comments=True,
                                     compress_json=False,
                                     post_metadata_txt_pattern=None,
                                     storyitem_metadata_txt_pattern=None,
                                     max_connection_attempts=3,
                                     request_timeout=None,
                                     rate_controller=None,
                                     resume_prefix='iterator',
                                     check_resume_bbd=True)
    try:
        parser.download_profile(username, profile_pic_only=True)
    except instaloader.exceptions.ProfileNotExistsException:
        print(
            "https://raw.githubusercontent.com/matteoraffoul/instagramChats/master/44884218_345707102882519_2446069589734326272_n.jpg"
        )
        return
    try:
        os.remove(".//chat//icons//" + username + "_id")
    except:
        pass
    return
Exemple #29
0
    def getinfo(self, url):
        html = urllib.request.urlopen(url, context=self.ctx).read()
        soup = BeautifulSoup(html, 'html.parser')
        data = soup.find_all('meta', attrs={'property': 'og:description'})
        text = data[0].get('content').split()
        user = '******' % (text[-3], text[-2], text[-1])
        followers = text[0]
        following = text[2]
        posts = text[4]
        L = instaloader.Instaloader()
        # Login or load session
        L.login("fniazi4u", "Byzz059@@")  # (login)
        # Obtain profile metadata
        var = L.download_pictures

        profile = instaloader.Profile.from_username(L.context, "navhas")
        # Print list of followees

        follow_list = []
        count = 0
        for followee in profile.get_followers():
            follow_list.append(followee.username)
            # file = open("prada_followers.txt", "a+")
            # file.write(follow_list[count])
            # file.write("\n")
            # file.close()
            print(follow_list[count])
            count = count + 1

        print('User:'******'Followers:', followers)
        print('Following:', following)
        print('Posts:', posts)
        print('---------------------------')
Exemple #30
0
    def get_followers(self):
        L = instaloader.Instaloader()
        L.login(INSTAGRAM_ID, INSTAGRAM_PASSWORD)  # (login)

        profile = instaloader.Profile.from_username(L.context, INSTAGRAM_ID)
        for follower in profile.get_followers():
            print(follower.username)