Example #1
0
        private async Task ExecuteQueueLikePhotosAsync(Queue queue, InstaBotContext db)
        {
            var tags = queue.LoadId.Split(' ');

            foreach (var tag in tags)
            {
                var top = await _api.GetExploreFeedAsync(PaginationParameters.MaxPagesToLoad(0));

                var media = top.Value.Medias.FirstOrDefault();

                //var foundPhotos = await _api.GetTagFeedAsync(tag, PaginationParameters.MaxPagesToLoad(0));
                //var media = foundPhotos.Value.Medias.FirstOrDefault();

                var isPhotoAlreadyLiked = db.UserActivityHistories.Any(x =>
                                                                       x.PostedImageURI == media.InstaIdentifier && x.Queue.QueueType == QueueType.LikePhoto);

                if (isPhotoAlreadyLiked)
                {
                    break;
                }

                await _api.LikeMediaAsync(media.InstaIdentifier);

                var rand            = new Random();
                var isNeedToComment = rand.Next(3);
                if (isNeedToComment == 1)
                {
                    var randNumber   = rand.Next(0, comments.Length);
                    var instaComment = await _api.CommentMediaAsync(media.InstaIdentifier, comments[randNumber]);

                    Console.WriteLine("Photo liked and commented!" + Environment.NewLine + instaComment.Info);
                }
                else
                {
                    Console.WriteLine("Photo liked only!");
                }


                queue.LastActivity = DateTime.UtcNow;
                db.UserActivityHistories.Add(new UserActivityHistory
                {
                    Queue          = queue,
                    CreatedOn      = DateTime.UtcNow,
                    PostedImageURI = media.InstaIdentifier,
                });
                await db.SaveChangesAsync();

                Thread.Sleep(1000);
            }
        }
Example #2
0
        private static async void RunLikeTaskAsync(TaskModel t, IInstaApi api)
        {
            List <InstaMedia> medias = new List <InstaMedia>();

            t = t.Refreshed;

            var _temp = await api.GetExploreFeedAsync(PaginationParameters.MaxPagesToLoad(15));

            if (_temp.Succeeded)
            {
                _temp.Value.Medias.RemoveAll(m => !m.HasLiked);

                medias.AddRange(_temp.Value.Medias);

                var FilteredMedia = await Helper.GetFilteredMediaAsync(medias, t.Searches, api, 5);


                // Execute
                if (FilteredMedia.Count > 0)
                {
                    foreach (var media in FilteredMedia)
                    {
                        if (media != null)
                        {
                            var result = await api.LikeMediaAsync(media.InstaIdentifier);

                            if (result.Succeeded)
                            {
                                t.TaskExecuted();
                                Helper.Log($"Task Executed: {t.Name} - {t.TaskType.ToString()} {Environment.NewLine} {JsonConvert.SerializeObject(result.Value)}");
                            }
                            else
                            {
                                Helper.Log(JsonConvert.SerializeObject(result.Info));
                            }
                        }
                    }
                }
            }
        }
Example #3
0
        async void MassLike()
        {
            Stat        = true;
            userInfoLog = await api.GetCurrentUserAsync();

            EventFromMyClass(this, new MyEventMessage($"[{userInfoLog.Value.UserName}][{DateTime.Now.ToString("HH:mm:ss")}][{Info()}] Масслайкинг запущен"));
            EventFromMyClass(this,
                             new MyEventMessage(
                                 $"[{userInfoLog.Value.UserName}][{DateTime.Now:HH:mm:ss}][{Info()}] Загружаю базу."));
            try
            {
                foreach (string str in File.ReadAllLines(setting.FileNameBase))
                {
                    try
                    {
                        usersID.Add(Convert.ToInt64(str));
                        usersIDcopy.Add(Convert.ToInt64(str));
                    }
                    catch
                    {
                        continue;
                    }
                }
            }
            catch (Exception e)
            {
                EventFromMyClass(this,
                                 new MyEventMessage(
                                     $"[{userInfoLog.Value.UserName}][{DateTime.Now.ToString("HH:mm:ss")}][{Info()}] ОШИБКА: {e.Message}"));
            }
            EventUpdateGrid(this, new UpdateGridEvent(
                                $"{userInfoLog.Value.UserName}:Лайкинг:{CountLikes}/{usersID.Count}:{UpdateInfoUser(await api.GetUserInfoByIdAsync(userInfoLog.Value.Pk))}:" +
                                $"Выполняется"));

            foreach (long id in usersID)
            {
                try
                {
                    if (_source == null || _source.IsCancellationRequested)
                    {
                        break;
                    }

                    if (setting.ChekedSkipSubscriber)
                    {
                        var x = await api.GetCurrentUserFollowersAsync(PaginationParameters.MaxPagesToLoad(10));

                        var o = new InstaUserShort();
                        o.Pk = id;
                        if (x.Value.IndexOf(o) != -1)
                        {
                            EventFromMyClass(this, new MyEventMessage($"[{userInfoLog.Value.UserName}][{DateTime.Now.ToString("HH:mm:ss")}][{Info()}] Подписчик с id: {id} пропущен"));
                            usersIDcopy.Remove(id);
                            Thread.Sleep(500);
                            continue;
                        }
                    }

                    int pages    = (int)setting.LikeAtUserMax;
                    var userInfo = await api.GetUserInfoByIdAsync(id);

                    Thread.Sleep(100);
                    var media = await api.GetUserMediaAsync(
                        userInfo.Value.Username,
                        PaginationParameters.MaxPagesToLoad(pages % 18 == 0 ? pages : pages + 1));     //Учет загруки страаниц

                    var mediaList = media.Value.ToList();

                    int random = rnd.Next((int)setting.LikeAtUserMin - 1, (int)setting.LikeAtUserMax);

                    for (int i = 0; i < random; i++)                                                                                                               //Учет кол-во лайков на пользователя
                    {
                        if (mediaList.Count > i && setting.LikeUnderPublicMin <= mediaList[i].LikesCount && mediaList[i].LikesCount <= setting.LikeUnderPublicMax) //Учет настройки лайков под публикацией
                        {
                            if (_source == null || _source.IsCancellationRequested)
                            {
                                break;
                            }

                            await api.LikeMediaAsync(mediaList[i].Pk);

                            CountLikes++;
                            CountPause++;

                            EventFromMyClass(this, new MyEventMessage($"[{userInfoLog.Value.UserName}][{DateTime.Now.ToString("HH:mm:ss")}][{Info()}] Поставил лайк пользователю {userInfo.Value.Username}. Кол-во лайков: {CountLikes}"));
                            EventUpdateGrid(this, new UpdateGridEvent(
                                                $"{userInfoLog.Value.UserName}:Лайкинг:{CountLikes}/{usersID.Count}:{UpdateInfoUser(await api.GetUserInfoByIdAsync(userInfoLog.Value.Pk))}:" +
                                                $"Выполняется"));

                            if (setting.ChekedDeleteInBaseAfterLike)
                            {
                                usersIDcopy.Remove(id);
                            }

                            Delay();

                            if (setting.ChekedPause)
                            {
                                if (CountPause >= setting.PauseLimit)
                                {
                                    CountPause = 0;
                                    EventUpdateGrid(this, new UpdateGridEvent($"{userInfoLog.Value.UserName}:Лайкинг:{CountLikes}/{usersID.Count}:{UpdateInfoUser(await api.GetUserInfoByIdAsync(userInfoLog.Value.Pk))}:" +
                                                                              $"Пауза"));
                                    EventFromMyClass(this,
                                                     new MyEventMessage(
                                                         $"[{userInfoLog.Value.UserName}][{DateTime.Now.ToString("HH:mm:ss")}][{Info()}] Пауза на " +
                                                         setting.PauseTime + " минут "));
                                    if (timer != null)
                                    {
                                        timer.Dispose();
                                    }
                                    timer = new Timer(CancelDelay, null, 60000 * (int)setting.PauseTime, Timeout.Infinite);
                                    ew.Reset();
                                    ew.WaitOne();
                                }
                            }
                        }
                        else
                        {
                            EventFromMyClass(this, new MyEventMessage($"[{userInfoLog.Value.UserName}][{DateTime.Now.ToString("HH:mm:ss")}][{Info()}] Недостаточно лайков под постом пользователя {userInfo.Value.Username}. Пропуск"));
                            if (setting.ChekedDeleteInBaseAfterLike)
                            {
                                usersIDcopy.Remove(id);
                            }
                            Thread.Sleep(1000);
                        }
                    }
                }
                catch (Exception e)
                {
                    EventFromMyClass(this, new MyEventMessage($"[{userInfoLog.Value.UserName}][{DateTime.Now.ToString("HH:mm:ss")}][{Info()}] ОШИБКА : {e.Message}"));
                    continue;
                }
            }
            EventFromMyClass(this, new MyEventMessage($"[{userInfoLog.Value.UserName}][{DateTime.Now.ToString("HH:mm:ss")}][{Info()}] Выполнено"));
            EventUpdateGrid(this, new UpdateGridEvent(
                                $"{userInfoLog.Value.UserName}:Лайкинг:{CountLikes}/{usersID.Count}:{UpdateInfoUser(await api.GetUserInfoByIdAsync(userInfoLog.Value.Pk))}:" +
                                $"Завершено"));
            Stat = false;
            Save();
        }
Example #4
0
        public async Task DoShow()
        {
            // get currently logged in user
            var currentUser = await _instaApi.GetCurrentUserAsync();

            Console.WriteLine(
                $"Logged in: username - {currentUser.Value.UserName}, full name - {currentUser.Value.FullName}");

            // get self followers
            var followers = await _instaApi.GetUserFollowersAsync(currentUser.Value.UserName, 5);

            Console.WriteLine($"Count of followers [{currentUser.Value.UserName}]:{followers.Value.Count}");

            // get self folling
            var following = await _instaApi.GetUserFollowingAsync(currentUser.Value.UserName, 5);

            Console.WriteLine($"Count of following [{currentUser.Value.UserName}]:{following.Value.Count}");

            // get self user's media, latest 5 pages
            var currentUserMedia = await _instaApi.GetUserMediaAsync(currentUser.Value.UserName, 5);

            if (currentUserMedia.Succeeded)
            {
                Console.WriteLine($"Media count [{currentUser.Value.UserName}]: {currentUserMedia.Value.Count}");
                foreach (var media in currentUserMedia.Value)
                {
                    ConsoleUtils.PrintMedia("Self media", media, _maxDescriptionLength);
                }
            }

            //get user time line feed, latest 5 pages
            var userFeed = await _instaApi.GetUserTimelineFeedAsync(5);

            if (userFeed.Succeeded)
            {
                Console.WriteLine(
                    $"Feed items (in {userFeed.Value.MediaItemsCount} pages) [{currentUser.Value.UserName}]: {userFeed.Value.Medias.Count}");
                foreach (var media in userFeed.Value.Medias)
                {
                    ConsoleUtils.PrintMedia("Feed media", media, _maxDescriptionLength);
                }
                //like first 10 medias from user timeline feed
                foreach (var media in userFeed.Value.Medias.Take(10))
                {
                    var likeResult = await _instaApi.LikeMediaAsync(media.InstaIdentifier);

                    var resultString = likeResult.Value ? "liked" : "not liked";
                    Console.WriteLine($"Media {media.Code} {resultString}");
                }
            }

            // get tag feed, latest 5 pages
            var tagFeed = await _instaApi.GetTagFeedAsync("quadcopter", 5);

            if (tagFeed.Succeeded)
            {
                Console.WriteLine(
                    $"Tag feed items (in {tagFeed.Value.MediaItemsCount} pages) [{currentUser.Value.UserName}]: {tagFeed.Value.Medias.Count}");
                foreach (var media in tagFeed.Value.Medias)
                {
                    ConsoleUtils.PrintMedia("Tag feed", media, _maxDescriptionLength);
                }
            }
        }
Example #5
0
        async System.Threading.Tasks.Task StartSubscribe()
        {
            Stat        = true;
            userInfoLog = await api.GetCurrentUserAsync();

            EventFromMyClass(this, new MyEventMessage($"[{userInfoLog.Value.UserName}][{DateTime.Now:HH:mm:ss}][{Info()}] Массфоловинг запущен."));
            EventFromMyClass(this,
                             new MyEventMessage(
                                 $"[{userInfoLog.Value.UserName}][{DateTime.Now:HH:mm:ss}][{Info()}] Загружаю базу."));
            try
            {
                string[] stringID = System.IO.File.ReadAllLines(setting.FileNameBaseId);
                foreach (string str in stringID)
                {
                    try
                    {
                        usersID.Add(Convert.ToInt64(str));
                        usersIDcopy.Add(Convert.ToInt64(str));
                    }
                    catch { continue; }
                }
                EventFromMyClass(this,
                                 new MyEventMessage(
                                     $"[{userInfoLog.Value.UserName}][{DateTime.Now:HH:mm:ss}][{Info()}] База загружена."));
            }
            catch (Exception e)
            {
                EventFromMyClass(this, new MyEventMessage($"[{userInfoLog.Value.UserName}][{DateTime.Now.ToString("HH:mm:ss")}][{Info()}] ОШИБКА: {e.Message}"));
            }

            EventFromMyClass(this,
                             new MyEventMessage(
                                 $"[{userInfoLog.Value.UserName}][{DateTime.Now:HH:mm:ss}][{Info()}] Начинаю подписку."));
            foreach (long id in usersID)
            {
                try
                {
                    userInfoLog = await api.GetCurrentUserAsync();

                    var userInfo = await api.GetUserInfoByIdAsync(id);

                    if (_source == null || _source.IsCancellationRequested)
                    {
                        break;
                    }

                    if (setting.ChekedSkipSubscriber) //Пропуск подписчиков
                    {
                        var x = await api.GetCurrentUserFollowersAsync(PaginationParameters.MaxPagesToLoad(100));

                        var o = new InstaUserShort();
                        o.Pk = id;
                        if (x.Value.IndexOf(o) != -1)
                        {
                            EventFromMyClass(this, new MyEventMessage($"[{userInfoLog.Value.UserName}][{DateTime.Now.ToString("HH:mm:ss")}][{Info()}] Подписчик с ником: {userInfo.Value.Username} пропущен"));
                            if (setting.ChekedDeleteAdfter)
                            {
                                usersIDcopy.Remove(id);
                            }

                            Delay();
                            continue;
                        }
                    }

                    if (!setting.ChekedSendPrivateUser) //Учет приватных пользователей
                    {
                        if (userInfo.Value.IsPrivate)
                        {
                            EventFromMyClass(this, new MyEventMessage($"[{userInfoLog.Value.UserName}][{DateTime.Now.ToString("HH:mm:ss")}][{Info()}] Приватный аккаунт {userInfo.Value.Username} пропущен"));
                            Delay();
                            continue;
                        }
                    }

                    await api.FollowUserAsync(id); //Подписка

                    CountSubscribe++;
                    CountPause++;

                    EventFromMyClass(this, new MyEventMessage($"[{userInfoLog.Value.UserName}][{DateTime.Now.ToString("HH:mm:ss")}][{Info()}] " +
                                                              $"Подписался на пользователя с ником {userInfo.Value.Username}. " +
                                                              $"Количество подписок: {CountSubscribe}"));

                    EventUpdateGrid(this, new UpdateGridEvent($"{userInfoLog.Value.UserName}:Подписка:{CountSubscribe}/{usersID.Count}:{UpdateInfoUser(await api.GetUserInfoByIdAsync(userInfoLog.Value.Pk))}:" +
                                                              $"Выполняется"));

                    Delay();
                    ew.WaitOne();

                    if (setting.ChekedLikingBySubscribe) //Учет лайков при подписке
                    {
                        int pages = setting.LikingMax;
                        var media = await api.GetUserMediaAsync(
                            userInfo.Value.Username,
                            PaginationParameters.MaxPagesToLoad(pages % 18 == 0 ? pages : pages + 1)); //Учет загруки страниц

                        var mediaList = media.Value.ToList();

                        int random = rnd.Next(setting.LikingMin, setting.LikingMax + 1);

                        for (int i = 0; i < random; i++)
                        {
                            if (_source == null || _source.IsCancellationRequested)
                            {
                                break;
                            }

                            await api.LikeMediaAsync(mediaList[i].Pk);

                            EventFromMyClass(this, new MyEventMessage($"[{userInfoLog.Value.UserName}][{DateTime.Now.ToString("HH:mm:ss")}][{Info()}] Поставил лайк пользователю с ником {userInfo.Value.Username}"));

                            int randomLikeDelay = rnd.Next(setting.DelayLikeMin, setting.DelayLikeMax + 1);
                            EventFromMyClass(this, new MyEventMessage($"[{userInfoLog.Value.UserName}][{DateTime.Now.ToString("HH:mm:ss")}][{Info()}] Задержка на {randomLikeDelay} сек"));
                            if (timer != null)
                            {
                                timer.Dispose();
                            }
                            timer = new Timer(CancelDelay, null, 1000 * randomLikeDelay, Timeout.Infinite);
                            ew.Reset();
                            ew.WaitOne();
                        }
                    }

                    if (setting.ChekedDeleteAdfter)
                    {
                        usersIDcopy.Remove(id);
                    }

                    if (setting.ChekedPause) //Учет паузы
                    {
                        if (CountPause >= setting.PauseLimit)
                        {
                            CountPause = 0;
                            EventUpdateGrid(this, new UpdateGridEvent($"{userInfoLog.Value.UserName}:Подписка:{CountSubscribe}/{usersID.Count}:{UpdateInfoUser(await api.GetUserInfoByIdAsync(userInfoLog.Value.Pk))}:" +
                                                                      $"Пауза"));
                            EventFromMyClass(this,
                                             new MyEventMessage(
                                                 $"[{userInfoLog.Value.UserName}][{DateTime.Now.ToString("HH:mm:ss")}][{Info()}] Пауза на " +
                                                 setting.PauseTime + " минут "));
                            if (timer != null)
                            {
                                timer.Dispose();
                            }
                            timer = new Timer(CancelDelay, null, 60000 * setting.PauseTime, Timeout.Infinite);
                            ew.Reset();
                            ew.WaitOne();
                        }
                    }

                    if (CountSubscribe >= setting.LimitSubscribe) //Учет лимита подписок
                    {
                        EventFromMyClass(this, new MyEventMessage($"[{userInfoLog.Value.UserName}][{DateTime.Now:HH:mm:ss}][{Info()}] Превышен лимит подписок"));
                        EventFromMyClass(this,
                                         new MyEventMessage(
                                             $"[{userInfoLog.Value.UserName}][{DateTime.Now:HH:mm:ss}] Выполнено"));
                        EventUpdateGrid(this, new UpdateGridEvent(
                                            $"{userInfoLog.Value.UserName}:Подписка:{CountSubscribe}/{usersID.Count}:{UpdateInfoUser(await api.GetUserInfoByIdAsync(userInfoLog.Value.Pk))}:" +
                                            $"Завершено"));
                        return;
                    }
                }
                catch (Exception e)
                {
                    EventFromMyClass(this, new MyEventMessage($"[{userInfoLog.Value.UserName}][{DateTime.Now:HH:mm:ss}][{Info()}] ОШИБКА: {e.Message}"));
                }
            }
            EventFromMyClass(this,
                             new MyEventMessage(
                                 $"[{userInfoLog.Value.UserName}][{DateTime.Now:HH:mm:ss}][{Info()}] Задача завершена"));
            EventUpdateGrid(this, new UpdateGridEvent(
                                $"{userInfoLog.Value.UserName}:Подписка:{CountSubscribe}/{usersID.Count}:{UpdateInfoUser(await api.GetUserInfoByIdAsync(userInfoLog.Value.Pk))}:" +
                                $"Завершено"));
            Stat = false;
            Save();
        }
 public async static Task Like(string post_id)
 {
     await _instaApi.LikeMediaAsync(post_id);
 }
Example #7
0
        public async Task DoShow()
        {
            // get currently logged in user
            var currentUser = await _instaApi.GetCurrentUserAsync();

            Console.WriteLine(
                $"Logged in: username - {currentUser.Value.UserName}, full name - {currentUser.Value.FullName}");

            // get followers of user 'elonmusk'
            var followers = await _instaApi.GetUserFollowersAsync("elonmusk",
                                                                  PaginationParameters.MaxPagesToLoad(5)
                                                                  .StartFromId("AQAC8w90POWyM7zMjHWmO9vsZNL_TuLp6FR506_C_y3fUAjlCclrIDI2RdSGvur5UjLrq4Cq7NJN8QUhHG-vpbT6pCLB5X9crDxBOHUEuNJ4fA"));

            Console.WriteLine($"Count of followers [elonmusk]:{followers.Value.Count}");
            Console.WriteLine($"Next id will be: '{followers.Value.NextId}'");

            // get self folling
            var following = await _instaApi.GetUserFollowingAsync(currentUser.Value.UserName, PaginationParameters.MaxPagesToLoad(5));

            Console.WriteLine($"Count of following [{currentUser.Value.UserName}]:{following.Value.Count}");

            // get self user's media, latest 5 pages
            var currentUserMedia = await _instaApi.GetUserMediaAsync(currentUser.Value.UserName, PaginationParameters.MaxPagesToLoad(5));

            if (currentUserMedia.Succeeded)
            {
                Console.WriteLine($"Media count [{currentUser.Value.UserName}]: {currentUserMedia.Value.Count}");
                foreach (var media in currentUserMedia.Value)
                {
                    ConsoleUtils.PrintMedia("Self media", media, _maxDescriptionLength);
                }
            }

            //get user time line feed, latest 5 pages
            var userFeed = await _instaApi.GetUserTimelineFeedAsync(PaginationParameters.MaxPagesToLoad(5));

            if (userFeed.Succeeded)
            {
                Console.WriteLine(
                    $"Feed items (in {userFeed.Value.MediaItemsCount} pages) [{currentUser.Value.UserName}]: {userFeed.Value.Medias.Count}");
                foreach (var media in userFeed.Value.Medias)
                {
                    ConsoleUtils.PrintMedia("Feed media", media, _maxDescriptionLength);
                }
                //like first 10 medias from user timeline feed
                foreach (var media in userFeed.Value.Medias.Take(10))
                {
                    var likeResult = await _instaApi.LikeMediaAsync(media.InstaIdentifier);

                    var resultString = likeResult.Value ? "liked" : "not liked";
                    Console.WriteLine($"Media {media.Code} {resultString}");
                }
            }

            // get tag feed, latest 5 pages
            var tagFeed = await _instaApi.GetTagFeedAsync("quadcopter", PaginationParameters.MaxPagesToLoad(5));

            if (tagFeed.Succeeded)
            {
                Console.WriteLine(
                    $"Tag feed items (in {tagFeed.Value.MediaItemsCount} pages) [{currentUser.Value.UserName}]: {tagFeed.Value.Medias.Count}");
                foreach (var media in tagFeed.Value.Medias)
                {
                    ConsoleUtils.PrintMedia("Tag feed", media, _maxDescriptionLength);
                }
            }
        }
Example #8
0
        private async void ProcessHashtag(string tag)
        {
            try {
                // ищем информацию о теге
                var hashtagInfo = await api.GetHashtagInfo(tag);

                if (hashtagInfo.Succeeded)
                {
                    //logBox.Items.Add("Hashtag: #" + hashtagInfo.Value.Name + ", media count = " + hashtagInfo.Value.MediaCount);
                    // получаем ленту с постами по хештегу
                    var tagFeed = await api.GetTagFeedAsync(hashtagInfo.Value.Name, PaginationParameters.MaxPagesToLoad(5));

                    int count = actionCount < (tagFeed.Value.Medias.Count) ? actionCount : tagFeed.Value.Medias.Count;
                    foreach (var media in tagFeed.Value.Medias.Take(count))
                    {
                        if (chk_boxLike.Checked)
                        {
                            // ставим лайки каждому посту
                            var likeResult = await api.LikeMediaAsync(media.InstaIdentifier);

                            var resultString = likeResult.Value ? "liked" : "not liked";
                            if (media.Images.Count > 0)
                            {
                                logger.WriteLog($"Hashtag: #{hashtagInfo.Value.Name}, URI:{media.Images[0].URI}");
                            }
                            logger.WriteLog($" Post URI: https://www.instagram.com/p/{media.Code}");
                            logger.WriteLog($"User: {media.User.UserName} {resultString}");
                        }
                        if (chk_follow.Checked)
                        {
                            // подписываемся на автора картинки
                            var followResult = await api.FollowUserAsync(media.User.Pk);

                            var resultString = followResult.Succeeded ? "followed" : "not folowwed";
                            logger.WriteLog($"{resultString} {media.User.UserName}");
                            folowingUsers.Add(media.User.Pk.ToString());
                        }
                        if (chk_boxComment.Checked && commentsArr.Length > 0)
                        {
                            // ставим случайный комментарий автору фотки
                            Random rnd      = new Random();
                            int    randIndx = rnd.Next(0, commentsArr.Length - 1);
                            string comment  = commentsArr[randIndx];

                            var commentResult = await api.CommentMediaAsync(media.InstaIdentifier, comment);

                            var resultString = commentResult.Succeeded ? "comented" : "not comented";
                            logger.WriteLog($"{resultString}");
                            logger.WriteLog($"-------------------------------------------------------------");
                        }
                        if (media.Images.Count > 1)
                        {
                            PrintImage(media.Images[1].URI);
                        }
                        progressBar.Increment(1);
                    }
                }
            } catch (Exception ex)
            {
                logger.CloseLog();
                MessageBox.Show(ex.ToString());
            }
        }