Пример #1
0
        public void Remove(ref HttpRequest request)
        {
            string htmlPageCart = request.Get("https://cart.lazada.vn/cart").ToString();

            HTML = htmlPageCart;
            HTML = Regex.Unescape(HTML);
            string stringJson = Regex.Match(HTML, "window.__initData__ = [^;]+").Value.Replace("window.__initData__ = ", "");

            JProducts = JObject.Parse(stringJson);

            var valueLinkage   = ValueLinkage();
            var valueHierarchy = ValueHierarchy();

            List <string> listItemID = ListItemID(JProducts);

            foreach (var itemID in listItemID)
            {
                var config = new ConfigXNet();
                config.AddHeaderXCSRFToken(ref request);

                var jProduct  = new JObject();
                var valueData = ValueData(itemID);
                jProduct.Add("operator", itemID);
                jProduct.Add("data", valueData);
                jProduct.Add("linkage", valueLinkage);
                jProduct.Add("hierarchy", valueHierarchy);
                var contentPost = jProduct.ToString();

                string html = request.Post("https://cart.lazada.vn/cart/api/async", contentPost, "application/json").ToString();
            }
        }
Пример #2
0
        void InteractProducts(ref HttpRequest request, Account account)
        {
            string linkref = _listLinkRef[_random.Next(0, (_listLinkRef.Count - 1))];
            bool   random  = false;

            lock (_randomAccountObj)
            {
                //Debug.WriteLine(_randomAccount, "Số account");
                if (_randomAccount == 0)
                {
                    random         = true;
                    _randomAccount = _random.Next(_randomAccountMin + 1, _randomAccountMax + 1);
                }
            }

            foreach (var item in _listLinkProducts)
            {
                request.Referer = linkref;
                Thread.Sleep(_random.Next(_timeSleepMin, _timeSleepMax + 1) * 1000);
                string linkProduct = item;
                if (linkProduct.Contains("?"))
                {
                    linkProduct = linkProduct.Split('?')[0];
                }
                var product  = new Product(linkProduct);
                var interact = new InteractProduct(product);
                interact.ViewProduct(ref request, linkProduct);
                interact.AddToWishList(ref request);
            }


            if (random)
            {
                //Debug.WriteLine(account.Email, "Add to cart");
                foreach (var item in _listLinkProducts)
                {
                    request.Referer = linkref;
                    Thread.Sleep(_random.Next(_timeSleepMin, _timeSleepMax + 1) * 1000);
                    var    config      = new ConfigXNet();
                    string linkProduct = item;
                    if (linkProduct.Contains("?"))
                    {
                        linkProduct = linkProduct.Split('?')[0];
                    }
                    var product  = new Product(linkProduct);
                    var interact = new InteractProduct(product);
                    config.AddHeaderXCSRFToken(ref request);
                    interact.AddToCart(ref request);
                }
            }
        }
Пример #3
0
        public bool IsSuccessful(ref HttpRequest request, Account account)
        {
            var config = new ConfigXNet();

            config.ConfigDefault(ref request);
            string html = request.Get("https://member.lazada.vn/user/login").ToString();

            config.AddHeaderXCSRFToken(ref request);
            string contentPost = "{\"email\":\"" + account.Email + "\",\"password\":\"" + account.Password + "\"}";

            html = request.Post("https://member.lazada.vn/user/api/login", contentPost, "application/json").ToString();
            if (html.Contains("\"success\":true"))
            {
                return(true);
            }
            return(false);
        }
Пример #4
0
        public bool AddToWishList(ref HttpRequest request)
        {
            string contentPost = "{}";
            var    configXNet  = new ConfigXNet();

            //request.Proxy = HttpProxyClient.Parse("127.0.0.1:8888");
            configXNet.AddHeaderXCSRFToken(ref request);
            //request.AddHeader("Accept", "application/json, text/plain, */*");
            //request.AddHeader("Accept Encoding", "gzip, deflate, br");
            //request.AddHeader(HttpHeader.AcceptLanguage, "vi,en-US;q=0.7,en;q=0.3");
            //request.AddHeader("X-Requested-With", "XMLHttpRequest");

            string link = "https://my.lazada.vn/wishlist/api/addItem?itemId=" + Product.ItemID + "&skuId=" + Product.SKUID;
            string html = request.Post("https://my.lazada.vn/wishlist/api/addItem?itemId=" + Product.ItemID + "&skuId=" + Product.SKUID, contentPost, "application/json;charset=utf-8").ToString();

            if (html.Contains("\"success\":true"))
            {
                return(true);
            }
            return(false);
        }
Пример #5
0
        public bool IsSuccessful(ref HttpRequest request, Account account)
        {
            var config = new ConfigXNet();

            config.ConfigDefault(ref request);
            if (EmailWasUsed(ref request, account.Email))
            {
                Debug.WriteLine(account.Email, "Trùng");
                return(false);
            }
            Thread.Sleep(3000);
            config.AddHeaderXCSRFToken(ref request);
            string contentPost = "{\"email\":\"" + account.Email + "\",\"password\":\"" + account.Password + "\",\"re-password\":\"" + account.Password + "\",\"name\":\"" + account.FullName + "\",\"enableNewsletter\":true,\"month\":\"" + account.Month + "\",\"day\":" + account.Day + ",\"year\":" + account.Year + ",\"birthday\":\"" + account.BirthDay + "\",\"gender\":\"" + account.Gender + "\",\"loading\":\"false\"}";
            //request.Proxy = HttpProxyClient.Parse("127.0.0.1:8888");
            string html = request.Post("https://member.lazada.vn/user/api/register", contentPost, "application/json").ToString();

            if (html.Contains("\"success\":true"))
            {
                return(true);
            }
            return(false);
        }