Пример #1
0
        public User[] GetGroupMembers(string uid)
        {
            GetHeader header = new GetHeader()
                               .setHost("web.lobi.co")
                               .setConnection(true)
                               .setAccept("application/json, text/plain, */*")
                               .setUserAgent("Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36")
                               .setAcceptLanguage("ja,en-US;q=0.8,en;q=0.6");

            List <User> result = new List <User>();
            string      next   = "0";
            int         limit  = 10000;

            while (limit-- > 0)
            {
                Group g = JsonConvert.DeserializeObject <Group>(this.NetworkAPI.get("https://web.lobi.co/api/group/" + uid + "?members_cursor=" + next, header));
                result.AddRange(g.members);
                if (g.members_next_cursor == 0)
                {
                    break;
                }
                next = g.members_next_cursor.ToString();
            }

            return(result.ToArray());
        }
Пример #2
0
        public PublicGroups[] GetPublicGroupList()
        {
            GetHeader header = new GetHeader()
                               .setHost("web.lobi.co")
                               .setConnection(true)
                               .setAccept("application/json, text/plain, */*")
                               .setUserAgent("Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36")
                               .setAcceptLanguage("ja,en-US;q=0.8,en;q=0.6");

            List <PublicGroups> result = new List <PublicGroups>();

            int index = 1;

            while (true)
            {
                PublicGroups[] pg = JsonConvert.DeserializeObject <PublicGroups[]>(this.NetworkAPI.get("https://web.lobi.co/api/public_groups?count=1000&page=" + index.ToString() + "&with_archived=1", header));
                index++;
                if (pg[0].items.Length == 0)
                {
                    break;
                }
                result.AddRange(pg);
            }

            return(result.ToArray());
        }
Пример #3
0
        public bool TwitterLogin(string mail, string password)
        {
            GetHeader header1 = new GetHeader()
                                .setHost("lobi.co")
                                .setConnection(true)
                                .setAccept("text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8")
                                .setUserAgent("Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36")
                                .setAcceptLanguage("ja,en-US;q=0.8,en;q=0.6");

            string source               = this.NetworkAPI.get("https://lobi.co/signup/twitter", header1);
            string authenticity_token   = Pattern.get_string(source, Pattern.authenticity_token, "\"");
            string redirect_after_login = Pattern.get_string(source, Pattern.redirect_after_login, "\"");
            string oauth_token          = Pattern.get_string(source, Pattern.oauth_token, "\"");

            string     post_data = string.Format("authenticity_token={0}&redirect_after_login={1}&oauth_token={2}&session%5Busername_or_email%5D={3}&session%5Bpassword%5D={4}", authenticity_token, WebUtility.UrlEncode(redirect_after_login), oauth_token, mail, password);
            PostHeader header2   = new PostHeader()
                                   .setHost("api.twitter.com")
                                   .setConnection(true)
                                   .setAccept("text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8")
                                   .setUserAgent("Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36")
                                   .setAcceptLanguage("ja,en-US;q=0.8,en;q=0.6")
                                   .setOrigin("https://api.twitter.com");

            string source2 = this.NetworkAPI.post_x_www_form_urlencoded("https://api.twitter.com/oauth/authorize", post_data, header2);

            if (source2.IndexOf("Twitterにログイン") > -1)
            {
                return(false);
            }

            return(this.NetworkAPI.get(Pattern.get_string(source2, Pattern.twitter_redirect_to_lobi, "\""), header1).IndexOf("ログインに失敗しました") == -1);
        }
Пример #4
0
        public Me GetMe()
        {
            GetHeader header = new GetHeader()
                               .setHost("web.lobi.co")
                               .setConnection(true)
                               .setAccept("application/json, text/plain, */*")
                               .setUserAgent("Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36")
                               .setAcceptLanguage("ja,en-US;q=0.8,en;q=0.6");

            return(JsonConvert.DeserializeObject <Me>(this.NetworkAPI.get("https://web.lobi.co/api/me?fields=premium", header)));
        }
Пример #5
0
        public Pokes GetPokes(string group_id, string chat_id)
        {
            GetHeader header = new GetHeader()
                               .setHost("web.lobi.co")
                               .setConnection(true)
                               .setAccept("application/json, text/plain, */*")
                               .setUserAgent("Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36")
                               .setAcceptLanguage("ja,en-US;q=0.8,en;q=0.6");

            return(JsonConvert.DeserializeObject <Pokes>(this.NetworkAPI.get("https://web.lobi.co/api/group/" + group_id + "/chats/pokes?id=" + chat_id, header)));
        }
Пример #6
0
        public Chat[] GetThreads(string uid, int count = 20)
        {
            GetHeader header = new GetHeader()
                               .setHost("web.lobi.co")
                               .setConnection(true)
                               .setAccept("application/json, text/plain, */*")
                               .setUserAgent("Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36")
                               .setAcceptLanguage("ja,en-US;q=0.8,en;q=0.6");

            return(JsonConvert.DeserializeObject <Chat[]>(this.NetworkAPI.get("https://web.lobi.co/api/group/" + uid + "/chats?count=" + count.ToString(), header)));
        }
Пример #7
0
        public Group GetGroup(string uid)
        {
            GetHeader header = new GetHeader()
                               .setHost("web.lobi.co")
                               .setConnection(true)
                               .setAccept("application/json, text/plain, */*")
                               .setUserAgent("Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36")
                               .setAcceptLanguage("ja,en-US;q=0.8,en;q=0.6");

            return(JsonConvert.DeserializeObject <Group>(this.NetworkAPI.get("https://web.lobi.co/api/group/" + uid + "?error_flavor=json2&fields=group_bookmark_info%2Capp_events_info", header)));
        }
Пример #8
0
        public Notifications GetNotifications()
        {
            GetHeader header = new GetHeader()
                               .setHost("web.lobi.co")
                               .setConnection(true)
                               .setAccept("application/json, text/plain, */*")
                               .setUserAgent("Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36")
                               .setAcceptLanguage("ja,en-US;q=0.8,en;q=0.6");

            return(JsonConvert.DeserializeObject <Notifications>(this.NetworkAPI.get("https://web.lobi.co/api/info/notifications?platform=any&last_cursor=0", header)));
        }
Пример #9
0
        public int GetGroupMembersCount(string uid)
        {
            GetHeader header = new GetHeader()
                               .setHost("web.lobi.co")
                               .setConnection(true)
                               .setAccept("application/json, text/plain, */*")
                               .setUserAgent("Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36")
                               .setAcceptLanguage("ja,en-US;q=0.8,en;q=0.6");

            int?result = JsonConvert.DeserializeObject <Group>(this.NetworkAPI.get("https://web.lobi.co/api/group/" + uid, header)).members_count;

            return(result == null ? 0 : (int)result);
        }
Пример #10
0
        public string get(string url, GetHeader header)
        {
            HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);

            req.Method = "GET";
            if (header.Host != "")
            {
                req.Host = header.Host;
            }
            req.KeepAlive = header.Connection;
            if (header.Accept != "")
            {
                req.Accept = header.Accept;
            }
            if (header.UserAgent != "")
            {
                req.UserAgent = header.UserAgent;
            }
            if (header.Referer != "")
            {
                req.Referer = header.Referer;
            }
            if (header.AcceptEncoding != "")
            {
                req.Headers.Add("Accept-Encoding", header.AcceptEncoding);
            }
            if (header.AcceptLanguage != "")
            {
                req.Headers.Add("Accept-Language", header.AcceptLanguage);
            }
            req.CookieContainer = this.cookie;

            string result = "";

            using (HttpWebResponse res = (HttpWebResponse)req.GetResponse())
            {
                using (StreamReader reader = new StreamReader(res.GetResponseStream(), Encoding.UTF8))
                    result = reader.ReadToEnd();
            }

            return(result);
        }
Пример #11
0
        public bool Login(string mail, string password)
        {
            GetHeader header1 = new GetHeader()
                                .setHost("lobi.co")
                                .setConnection(true)
                                .setAccept("text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8")
                                .setUserAgent("Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36")
                                .setAcceptLanguage("ja,en-US;q=0.8,en;q=0.6");

            string source     = this.NetworkAPI.get("https://lobi.co/signin", header1);
            string csrf_token = Pattern.get_string(source, Pattern.csrf_token, "\"");

            string     post_data = string.Format("csrf_token={0}&email={1}&password={2}", csrf_token, mail, password);
            PostHeader header2   = new PostHeader()
                                   .setHost("lobi.co")
                                   .setConnection(true)
                                   .setAccept("text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8")
                                   .setUserAgent("Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36")
                                   .setAcceptLanguage("ja,en-US;q=0.8,en;q=0.6")
                                   .setOrigin("https://lobi.co")
                                   .setReferer("https://lobi.co/signin");

            return(this.NetworkAPI.post_x_www_form_urlencoded("https://lobi.co/signin", post_data, header2).IndexOf("ログインに失敗しました") == -1);
        }