Esempio n. 1
0
        void LoginAndCheck()
        {
            var         User  = Globals.GetMainUserList[listView1.SelectedIndices[0]];
            InstaGodApi Insta = new InstaGodApi();
            var         info  = Insta.GetInfo(User);

            if (info != null)
            {
                User.followers = Convert.ToInt32(info["user"]["followed_by"]["count"]);
                User.following = Convert.ToInt32(info["user"]["follows"]["count"]);
                User.posts     = Convert.ToInt32(info["user"]["media"]["count"]);
                if (User.cookie == null)
                {
                    User.cookie = Insta.login(User);
                }
                if (User.cookie != null && User.cookie.ToString().Contains("session"))
                {
                    User.status = "Авторизирован";
                }
                else
                {
                    User.status = "ОшАвторизации";
                    User.cookie = null;
                }
                MessageBox.Show(User.cookie.ToString());
                Globals.Acclist.ChangeAccount(User);
            }
            else
            {
                User.status = "Бан/Смс";
                User.cookie = null;
            }
        }
Esempio n. 2
0
        void parsJob(object parserz)
        {
            var         parser = (ActionPars)parserz;
            InstaGodApi Api    = new InstaGodApi();
            string      maxid  = "";
            int         i      = 0;

            Console.WriteLine("PARSER ACTIONS: " + parser.actions);
            List <string> resuultStrings = new List <string>();

            if (parser.fromTag)
            {
                while (i <= parser.actions)
                {
                    var info = Api.parsTagFeed(parser.TagOrUser, maxid, parser.user);
                    i += Convert.ToInt32(info["num_results"]);
                    parser.progress     = i;
                    parser.user.process = i;
                    Console.WriteLine(maxid);
                    Globals.Acclist.ChangeAccount(parser.user);
                    foreach (var id in info["items"])
                    {
                        resuultStrings.Add(id["id"].ToString());
                    }

                    File.WriteAllLines(parser.path, resuultStrings.ToList());
                    if (info["next_max_id"] != null)
                    {
                        maxid = info["next_max_id"].ToString();
                    }
                    else
                    {
                        break;
                    }
                }
            }
            else
            {
                List <string> likersList = new List <string>();
                UserInfo      Donor      = new UserInfo();
                Donor.login = parser.TagOrUser;
                var user_id = Api.GetInfo(Donor);

                while (i <= parser.actions)
                {
                    var info = Api.parsUserFeed(user_id["user"]["id"].ToString(), maxid, parser.user);
                    i += Convert.ToInt32(info["num_results"]);
                    foreach (var id in info["items"])
                    {
                        resuultStrings.Add(id["id"].ToString());
                    }
                    if (info["next_max_id"] != null)
                    {
                        maxid = info["next_max_id"].ToString();
                    }
                    else
                    {
                        break;
                    }
                }
                i = 0;
                foreach (var photo in resuultStrings)
                {
                    var info  = Api.GetMediaLikers(photo, parser.user);
                    int count = 0;
                    foreach (var id in info["users"])
                    {
                        likersList.Add(id["pk"].ToString());
                        count++;
                    }
                    i += count;
                    parser.progress     = i;
                    parser.user.process = i;
                    Console.WriteLine(maxid);
                    Globals.Acclist.ChangeAccount(parser.user);
                }
                File.WriteAllLines(parser.path, likersList.ToList());


                parser.user.status = "Завершенo";
                ParsList.Remove(parser);
                Globals.Acclist.ChangeAccount(parser.user);
                endJob = true;
            }
        }