示例#1
0
        private async Task ExecuteQueueFollowRecomendations(Queue queue, InstaBotContext db)
        {
            var top = await _api.GetExploreFeedAsync(PaginationParameters.MaxPagesToLoad(0));

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

            await _api.FollowUserAsync(firstRecomendation.User.Pk);

            Console.WriteLine("Followed for user - " + firstRecomendation.User.Pk);
            queue.LastActivity = DateTime.UtcNow;
            await db.SaveChangesAsync();

            Thread.Sleep(1000);
        }
示例#2
0
        private async void GetFeedButtonClick(object sender, EventArgs e)
        {
            // Note2: A RichTextBox control added to show you some of feeds.

            if (InstaApi == null)
            {
                MessageBox.Show("Login first.");
            }
            if (!InstaApi.IsUserAuthenticated)
            {
                MessageBox.Show("Login first.");
            }

            var x = await InstaApi.GetExploreFeedAsync(PaginationParameters.MaxPagesToLoad(1));

            Debug.WriteLine("Explore Feeds Result: " + x.Succeeded);

            if (x.Succeeded)
            {
                StringBuilder sb = new StringBuilder();
                foreach (var media in x.Value.Medias)
                {
                    sb.AppendLine(DebugUtils.PrintMedia("Feed media", media));
                }
                RtBox.Text    = sb.ToString();
                RtBox.Visible = true;
                Size          = ChallengeSize;
            }
        }
示例#3
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));
                            }
                        }
                    }
                }
            }
        }