예제 #1
0
        protected override bool ExecuteEngine(WinkModel model)
        {
            try
            {
                if (model.UrlParameters == null)
                {
                    return(false);
                }

                var fbDtsg = ParseResponsePageHelper.GetInputValueById(RequestsHelper.Get(Urls.HomePage.GetDiscription(), model.Cookie, model.Proxy, model.UserAgent), "fb_dtsg");

                var parametersDictionary = model.UrlParameters.ToDictionary(pair => (WinkEnum)pair.Key, pair => pair.Value);

                parametersDictionary[WinkEnum.PokeTarget] = model.FriendFacebookId.ToString("G");
                parametersDictionary[WinkEnum.User]       = model.AccountFacebookId.ToString("G");
                parametersDictionary[WinkEnum.FbDtsg]     = fbDtsg;

                var parameters = CreateParametersString(parametersDictionary);

                RequestsHelper.Post(Urls.Wink.GetDiscription() + "?poke_target=" + model.FriendFacebookId + "&dpr=1", parameters, model.Cookie, model.Proxy, model.UserAgent);

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
예제 #2
0
        protected override bool ExecuteEngine(AddToGroupModel model)
        {
            try
            {
                if (model.UrlParameters == null)
                {
                    return(false);
                }

                var fbDtsg  = ParseResponsePageHelper.GetInputValueById(RequestsHelper.Get(Urls.HomePage.GetDiscription(), model.Cookie, model.Proxy, model.UserAgent), "fb_dtsg");
                var groupId = ParseResponsePageHelper.GetGroupId(RequestsHelper.Get(model.FacebookGroupUrl, model.Cookie, model.Proxy, model.UserAgent));

                var parametersDictionary = model.UrlParameters.ToDictionary(pair => (AddFriendsToGroupEnum)pair.Key, pair => pair.Value);

                parametersDictionary[AddFriendsToGroupEnum.User]        = model.FacebookId.ToString(CultureInfo.InvariantCulture);
                parametersDictionary[AddFriendsToGroupEnum.FbDtsg]      = fbDtsg;
                parametersDictionary[AddFriendsToGroupEnum.Members]     = CreateString(model.FriendsList)[0];
                parametersDictionary[AddFriendsToGroupEnum.TextMembers] = CreateString(model.FriendsList)[1];

                var parameters = CreateParametersString(parametersDictionary);

                RequestsHelper.Post(string.Format(Urls.AddFriendToGroup.GetDiscription(), groupId), parameters, model.Cookie, model.Proxy, model.UserAgent);

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
        protected override List <GetСorrespondenceByFriendIdResponseModel> ExecuteEngine(GetСorrespondenceByFriendIdModel model)
        {
            var messagesList = new List <GetСorrespondenceByFriendIdResponseModel>();

            if (model.UrlParameters == null)
            {
                return(null);
            }

            var fbDtsg = ParseResponsePageHelper.GetInputValueById(RequestsHelper.Get(Urls.HomePage.GetDiscription(), model.Cookie, model.Proxy, model.UserAgent), "fb_dtsg");

            var parametersDictionary = model.UrlParameters.ToDictionary(pair => (GetCorrespondenceEnum)pair.Key, pair => pair.Value);

            parametersDictionary[GetCorrespondenceEnum.User]   = model.AccountFacebookId.ToString();
            parametersDictionary[GetCorrespondenceEnum.FbDtsg] = fbDtsg;

            var parameters = CreateParametersString(parametersDictionary);

            var stringResponse = RequestsHelper.Post(Urls.GetСorrespondenceByFriendId.GetDiscription() + "?user_id=" + model.FriendId + "&dpr=1", parameters, model.Cookie, model.Proxy, model.UserAgent).Remove(0, 9);

            var data    = (JObject)JsonConvert.DeserializeObject(stringResponse);
            var threads = data["payload"]["threads"];

            foreach (var thread in threads)
            {
                messagesList.Add(new GetСorrespondenceByFriendIdResponseModel()
                {
                });
            }

            return(messagesList);
        }
예제 #4
0
        protected override bool ExecuteEngine(ConfirmFriendshipModel model)
        {
            try
            {
                if (model.UrlParameters == null)
                {
                    return(false);
                }

                var fbDtsg = ParseResponsePageHelper.GetInputValueById(RequestsHelper.Get(Urls.HomePage.GetDiscription(), model.Cookie, model.Proxy, model.UserAgent), "fb_dtsg");

                var parametersDictionary = model.UrlParameters.ToDictionary(pair => (ConfirmFriendshipEnum)pair.Key, pair => pair.Value);

                parametersDictionary[ConfirmFriendshipEnum.ViewerId] = model.AccountFacebookId.ToString();
                parametersDictionary[ConfirmFriendshipEnum.User]     = model.AccountFacebookId.ToString();
                parametersDictionary[ConfirmFriendshipEnum.Id]       = model.FriendFacebookId.ToString("G");
                parametersDictionary[ConfirmFriendshipEnum.FbDtsg]   = fbDtsg;

                var parameters = CreateParametersString(parametersDictionary);

                RequestsHelper.Post(Urls.ConfirmFriendship.GetDiscription(), parameters, model.Cookie, model.Proxy, model.UserAgent);

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
        protected override bool ExecuteEngine(CancelFriendshipRequestModel model)
        {
            try
            {
                if (model.UrlParameters == null)
                {
                    return(false);
                }

                var fbDtsg = ParseResponsePageHelper.GetInputValueById(RequestsHelper.Get(Urls.HomePage.GetDiscription(), model.Cookie, model.Proxy, model.UserAgent), "fb_dtsg");

                var parametersDictionary = model.UrlParameters.ToDictionary(pair => (CancelFriendshipRequestEnum)pair.Key, pair => pair.Value);

                parametersDictionary[CancelFriendshipRequestEnum.Confirm]     = model.FriendFacebookId.ToString("G");
                parametersDictionary[CancelFriendshipRequestEnum.RequestId]   = model.FriendFacebookId.ToString("G");
                parametersDictionary[CancelFriendshipRequestEnum.ListItemId]  = string.Format("{0}_1_req", model.FriendFacebookId.ToString("G"));
                parametersDictionary[CancelFriendshipRequestEnum.StatusDivId] = string.Format("{0}_1_req_status", model.FriendFacebookId.ToString("G"));
                parametersDictionary[CancelFriendshipRequestEnum.User]        = model.AccountFacebookId.ToString("G");
                parametersDictionary[CancelFriendshipRequestEnum.FbDtsg]      = fbDtsg;

                var parameters = CreateParametersString(parametersDictionary);

                RequestsHelper.Post(Urls.CancelFriendshipRequest.GetDiscription(), parameters, model.Cookie, model.Proxy, model.UserAgent);

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
예제 #6
0
        protected override GetNewNoticesResponseModel ExecuteEngine(GetNewNoticesModel model)
        {
            var newFriends  = int.Parse(ParseResponsePageHelper.GetSpanValueById(model.ResponsePage, "requestsCountValue"));
            var newMessages = int.Parse(ParseResponsePageHelper.GetSpanValueById(model.ResponsePage, "mercurymessagesCountValue"));
            var newNotices  = int.Parse(ParseResponsePageHelper.GetSpanValueById(model.ResponsePage, "notificationsCountValue"));

            return(new GetNewNoticesResponseModel()
            {
                NumberNewFriends = newFriends,
                NumberNewMessages = newMessages,
                NumberNewNotifications = newNotices
            });
        }
예제 #7
0
        protected override GetFriendsResponseModel ExecuteEngine(GetFriendsByCriteriesModel model)
        {
            if (model.UrlParameters == null)
            {
                return null;
            }

            var fbDtsg = ParseResponsePageHelper.GetInputValueById(RequestsHelper.Get(Urls.HomePage.GetDiscription(), model.Cookie, model.Proxy, model.UserAgent), "fb_dtsg");

            var parametersDictionary = model.UrlParameters.ToDictionary(pair => (GetFriendsByCriteriesEnum)pair.Key, pair => pair.Value);

            parametersDictionary[GetFriendsByCriteriesEnum.User] = model.AccountId.ToString("G");
            parametersDictionary[GetFriendsByCriteriesEnum.FbDtsg] = fbDtsg;
            parametersDictionary[GetFriendsByCriteriesEnum.HomeTownIdsZero] = "115085015172389";

            var parameters = CreateParametersString(parametersDictionary);

            var stringResponse = RequestsHelper.Post(Urls.GetFriendsByCriteries.GetDiscription(), parameters, model.Cookie, model.Proxy, model.UserAgent).Remove(0, 9);

            return GetFriendsData(stringResponse);
        }
        protected override VoidModel ExecuteEngine(ChangeMessageStatusModel model)
        {
            if (model.UrlParameters == null)
            {
                return(null);
            }

            var fbDtsg = ParseResponsePageHelper.GetInputValueById(RequestsHelper.Get(Urls.HomePage.GetDiscription(), model.Cookie, model.Proxy, model.UserAgent), "fb_dtsg");

            var parametersDictionary = model.UrlParameters.ToDictionary(pair => (ChangeStatusForMesagesEnum)pair.Key, pair => pair.Value);

            parametersDictionary[ChangeStatusForMesagesEnum.Ids]     = model.FriendFacebookId.ToString("G") + "]=true";
            parametersDictionary[ChangeStatusForMesagesEnum.User]    = model.AccountId.ToString(CultureInfo.InvariantCulture);
            parametersDictionary[ChangeStatusForMesagesEnum.FbDtsg]  = fbDtsg;
            parametersDictionary[ChangeStatusForMesagesEnum.Ttstamp] = "2658169757012152707310256495865817278110491018710365111116";

            var parameters = CreateParametersString(parametersDictionary);

            RequestsHelper.Post(Urls.ChangeReadStatus.GetDiscription(), parameters, model.Cookie, model.Proxy, model.UserAgent).Remove(0, 9);

            return(new VoidModel());
        }
예제 #9
0
        protected override bool ExecuteEngine(SendMessageModel model)
        {
            try
            {
                if (model.UrlParameters == null)
                {
                    return(false);
                }

                var messageId = GenerateMessageId();

                var fbDtsg =
                    ParseResponsePageHelper.GetInputValueById(
                        RequestsHelper.Get(Urls.HomePage.GetDiscription(), model.Cookie, model.Proxy, model.UserAgent), "fb_dtsg");

                var parametersDictionary = model.UrlParameters.ToDictionary(pair => (SendMessageEnum)pair.Key,
                                                                            pair => pair.Value);

                parametersDictionary[SendMessageEnum.Body]               = model.Message;
                parametersDictionary[SendMessageEnum.MessageId]          = messageId;
                parametersDictionary[SendMessageEnum.OfflineThreadingId] = messageId;
                parametersDictionary[SendMessageEnum.OtherUserFbid]      = model.FriendId.ToString("G");
                parametersDictionary[SendMessageEnum.SpecificToListOne]  = model.FriendId.ToString("G");
                parametersDictionary[SendMessageEnum.SpecificToListTwo]  = model.AccountId.ToString();
                parametersDictionary[SendMessageEnum.UserId]             = model.AccountId.ToString();
                parametersDictionary[SendMessageEnum.Timestamp]          = DateTime.Now.Ticks.ToString();
                parametersDictionary[SendMessageEnum.FbDtsg]             = fbDtsg;

                var parameters = CreateParametersString(parametersDictionary);

                RequestsHelper.Post(Urls.SendMessage.GetDiscription(), parameters, model.Cookie, model.Proxy, model.UserAgent);

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
예제 #10
0
        protected override List <GetMessagesResponseModel> ExecuteEngine(GetMessagesModel model)
        {
            var messagesList = new List <GetMessagesResponseModel>();

            if (model.UrlParameters == null)
            {
                return(null);
            }

            var fbDtsg = ParseResponsePageHelper.GetInputValueById(RequestsHelper.Get(Urls.HomePage.GetDiscription(), model.Cookie, model.Proxy, model.UserAgent), "fb_dtsg");

            var parametersDictionary = model.UrlParameters.ToDictionary(pair => (GetMessagesEnum)pair.Key, pair => pair.Value);

            parametersDictionary[GetMessagesEnum.User]   = model.AccountId.ToString();
            parametersDictionary[GetMessagesEnum.FbDtsg] = fbDtsg;

            var parameters = CreateParametersString(parametersDictionary);

            var stringResponse = RequestsHelper.Post(Urls.NewMessages.GetDiscription(), parameters, model.Cookie, model.Proxy, model.UserAgent).Remove(0, 9);

            var data    = (JObject)JsonConvert.DeserializeObject(stringResponse);
            var threads = data["payload"]["threads"];

            foreach (var thread in threads)
            {
                messagesList.Add(new GetMessagesResponseModel()
                {
                    FriendId            = thread["thread_fbid"].Value <long>(),
                    CountAllMessages    = thread["message_count"].Value <int>(),
                    CountUnreadMessages = thread["unread_count"].Value <int>(),
                    LastMessage         = thread["snippet"].Value <string>(),
                    UnreadMessage       = thread["unread_count"].Value <int>() != 0
                });
            }

            return(messagesList);
        }
예제 #11
0
        protected override bool ExecuteEngine(SendRequestFriendshipModel model)
        {
            try
            {
                if (model.AddFriendUrlParameters == null && model.AddFriendExtraUrlParameters == null)
                {
                    return(false);
                }

                var fbDtsg = ParseResponsePageHelper.GetInputValueById(RequestsHelper.Get(Urls.HomePage.GetDiscription(), model.Cookie, model.Proxy, model.UserAgent), "fb_dtsg");

                var parametersAddFriendDictionary = model.AddFriendUrlParameters.ToDictionary(pair => (AddFriendEnum)pair.Key, pair => pair.Value);

                parametersAddFriendDictionary[AddFriendEnum.ToFriend] = model.FriendFacebookId.ToString("G");
                parametersAddFriendDictionary[AddFriendEnum.User]     = model.AccountFacebookId.ToString();
                parametersAddFriendDictionary[AddFriendEnum.FbDtsg]   = fbDtsg;

                var parametersAddFriendExtraDictionary = model.AddFriendExtraUrlParameters.ToDictionary(pair => (AddFriendExtraEnum)pair.Key, pair => pair.Value);

                parametersAddFriendExtraDictionary[AddFriendExtraEnum.User]   = model.AccountFacebookId.ToString();
                parametersAddFriendExtraDictionary[AddFriendExtraEnum.FbDtsg] = fbDtsg;

                var addFriendParameters      = CreateParametersString(parametersAddFriendDictionary);
                var addFriendExtraParameters = CreateParametersString(parametersAddFriendExtraDictionary);

                RequestsHelper.Post(Urls.AddFriend.GetDiscription(), addFriendParameters, model.Cookie, model.Proxy, model.UserAgent);

                RequestsHelper.Post(Urls.AddFriendExtra + "?friendid=" + model.FriendFacebookId + "&dpr=1", addFriendExtraParameters, model.Cookie, model.Proxy, model.UserAgent);

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
예제 #12
0
        protected override List <FacebookMessageModel> ExecuteEngine(GetMessangerMessagesModel model)
        {
            var messagesList = new List <FacebookMessageModel>();

            if (model.UrlParameters == null)
            {
                return(null);
            }

            var fbDtsg = ParseResponsePageHelper.GetInputValueById(RequestsHelper.Get(Urls.HomePage.GetDiscription(), model.Cookie, model.Proxy, model.UserAgent), "fb_dtsg");

            var parametersDictionary = model.UrlParameters.ToDictionary(pair => (GetUnreadMessagesEnum)pair.Key, pair => pair.Value);

            parametersDictionary[GetUnreadMessagesEnum.User]   = model.AccountId.ToString(CultureInfo.InvariantCulture);
            parametersDictionary[GetUnreadMessagesEnum.FbDtsg] = fbDtsg;

            var parameters = CreateParametersString(parametersDictionary);

            var stringResponse = RequestsHelper.Post(Urls.NewMessages.GetDiscription(), parameters, model.Cookie, model.Proxy, model.UserAgent).Remove(0, 9);

            var data = (JObject)JsonConvert.DeserializeObject(stringResponse);

            var threads  = data["payload"]["threads"];
            var threads2 = data["payload"]["participants"];

            int count = 0;

            foreach (var thread in threads)
            {
                if (count >= model.NumbersOfDialogues)
                {
                    break;
                }

                var countMessages       = thread["message_count"].Value <long>();
                var countUnreadMessages = thread["unread_count"].Value <long>();
                var text = thread["snippet"].Value <string>();

                if (countMessages == 1 && countUnreadMessages == 0 && text.Equals(string.Empty))
                {
                    var     facebookId    = thread["thread_fbid"].Value <long>();
                    JObject friendThread2 = null;

                    foreach (var thread2 in threads2)
                    {
                        if (thread2["fbid"].Value <long>().Equals(facebookId))
                        {
                            friendThread2 = (JObject)thread2;
                        }
                    }

                    messagesList.Add(new FacebookMessageModel
                    {
                        AccountId           = model.AccountId,
                        FriendFacebookId    = facebookId,
                        CountAllMessages    = thread["message_count"].Value <int>(),
                        CountUnreadMessages = thread["unread_count"].Value <int>(),
                        Gender      = friendThread2["gender"].Value <int>() == 1 ? GenderEnum.Female : GenderEnum.Male,
                        Href        = friendThread2["href"].Value <string>(),
                        Name        = friendThread2["name"].Value <string>(),
                        LastMessage = thread["snippet"].Value <string>(),
                        LastUnreadMessageDateTime =
                            GetDateTime(Convert.ToInt64(thread["last_message_timestamp"].Value <string>())),
                        UnreadMessage = thread["unread_count"].Value <int>() != 0
                    });
                    count++;
                }
            }

            return(messagesList);
        }