コード例 #1
0
        public void Execute(IUBotStudio ubotStudio, Dictionary <string, string> parameters)
        {
            var inicontainer = (FBcontainer)ubotStudio.ContainerParent;
            var token        = inicontainer.Token;

            try
            {
                var facebook = new FacebookGraphApi(token.Trim());
                facebook.ProxyStr  = inicontainer.Proxy;
                facebook.FBversion = inicontainer.Version;
                //get my friends info
                var friends = facebook.GetConnections(parameters["Parent"], "friends", null);

                var table = new string[friends["data"].Count(), 2];

                var i = 0;
                foreach (var friend in friends["data"])
                {
                    table[i, 0] = friend["id"].ToString();
                    table[i, 1] = friend["name"].ToString();


                    i++;
                }
                ubotStudio.SetTable(parameters["Details"], table);
            }

            catch (Exception exp)
            {
                if (exp.GetType() == typeof(FacebookGraphApiException))
                {
                    inicontainer.Error = (exp as FacebookGraphApiException).Message;
                }
                else
                {
                    inicontainer.Error = exp.Message;
                }
            }
        }
コード例 #2
0
        public void Execute(IUBotStudio ubotStudio, Dictionary <string, string> parameters)
        {
            var inicontainer = (FBcontainer)ubotStudio.ContainerParent;
            var token        = inicontainer.Token;

            try
            {
                var facebook = new FacebookGraphApi(token.Trim());
                facebook.ProxyStr  = inicontainer.Proxy;
                facebook.FBversion = inicontainer.Version;
                //JArray data = new JArray();
                var ScrapedData = new List <string>();
                var dict        = new Dictionary <string, string>();
                dict.Add("fields", "id");
                dict.Add("limit", "100");
                var ObjectFb = facebook.GetConnections(parameters["parent user"], parameters["List"], dict);

                var Jpath = JsonPathParser(facebook.JsonText, "$..next");

                foreach (var group in ObjectFb["data"])
                {
                    ScrapedData.Add(group["id"].ToString());
                }

                var fbNext = "";
                if (Jpath.Length != 0)
                {
                    fbNext = Jpath[0];
                }

                while (fbNext != string.Empty)
                {
                    var wc    = new WebClient();
                    var reply = wc.DownloadString(fbNext.Replace(@"\", ""));
                    var jo    = JObject.Parse(reply);
                    foreach (var group in jo["data"])
                    {
                        ScrapedData.Add(group["id"].ToString());
                    }

                    var JpathW = JsonPathParser(reply, "$..next");
                    fbNext = "";
                    if (JpathW.Length != 0)
                    {
                        fbNext = JpathW[0];
                    }
                }

                _returnValue = ScrapedData;
            }
            catch (Exception exp)
            {
                if (exp.GetType() == typeof(FacebookGraphApiException))
                {
                    inicontainer.Error = (exp as FacebookGraphApiException).Message;
                }
                else
                {
                    inicontainer.Error = exp.Message;
                }
            }
        }
コード例 #3
0
        public void Execute(IUBotStudio ubotStudio, Dictionary <string, string> parameters)
        {
            var inicontainer = (FBcontainer)ubotStudio.ContainerParent;
            var token        = inicontainer.Token;

            try
            {
                var facebook = new FacebookGraphApi(token.Trim());
                facebook.ProxyStr  = inicontainer.Proxy;
                facebook.FBversion = inicontainer.Version;
                //JArray data = new JArray();
                var ScrapedData = new List <string>();
                var dict        = new Dictionary <string, string>();
                dict.Add("q", parameters["keyword"]);
                dict.Add("type", "group");
                dict.Add("limit", "100");
                var ObjectFb = facebook.GetConnections("", "search", dict);
                //_returnValue = facebook.JsonText;
                var Jpath = JsonPathParser(facebook.JsonText, "$..next");

                foreach (var group in ObjectFb["data"])
                {
                    ScrapedData.Add(group["name"] + "|" + group["id"]);
                }

                var fbNext = "";
                if (Jpath.Length != 0)
                {
                    fbNext = Jpath[0];
                }

                while (fbNext != string.Empty)
                {
                    var wc    = new WebClient();
                    var reply = wc.DownloadString(fbNext.Replace(@"\", ""));
                    var jo    = JObject.Parse(reply);
                    foreach (var group in jo["data"])
                    {
                        ScrapedData.Add(group["name"] + "|" + group["id"]);
                    }

                    var JpathW = JsonPathParser(reply, "$..next");
                    fbNext = "";
                    if (JpathW.Length != 0)
                    {
                        fbNext = JpathW[0];
                    }
                }


                var data = new string[ScrapedData.Count, 2];

                for (var i = 0; i < ScrapedData.Count; i++)
                {
                    var LocD = ScrapedData[i].Split('|');
                    data[i, 0] = LocD[0];
                    data[i, 1] = LocD[1];
                }

                ubotStudio.SetTable(parameters["Data"], data);
            }
            catch (Exception exp)
            {
                if (exp.GetType() == typeof(FacebookGraphApiException))
                {
                    inicontainer.Error = (exp as FacebookGraphApiException).Message;
                }
                else
                {
                    inicontainer.Error = exp.Message;
                }
            }
        }