Jump to content

Recommended Posts

2 giờ trước, Hùng Sơn Tinh said:

Có bạn nào từng làm lazada, sendo, tiki kiểu này chưa mọi người? m đang làm login thử mà khoai quá...

về lazada, sendo, tiki thì bạn tạo một topic khác nhé, topic này chuyên về shopee nha :167788196751800:

Chia sẻ bài đăng này


Link tới bài viết
Share on other sites

Kiểm Tra Link sản Phẩm cho Bạn nào cần. Cái tên sp mình lấy về đc mà chưa decode đc. bạn nào làm được chỉ mình luôn với nha :classic_wink:.

private string[] ShopInfo() //lấy {shopid,itemid} từ Link
        {
            string link = textBox7.Text;
            Regex reg = new Regex(@"https://shopee\Wvn/(.*?)-i.(?<ids>\d+)\W(?<idi>\d+)");
            MatchCollection mat1 = reg.Matches(link);
            Match mat = reg.Match(link);
            if (mat1.Count == 0)
            {
                MessageBox.Show("Nhập Lại Link Sản Phẩm", "Thông Báo");
            }
            else
            {
                request = new HttpRequest();
                request.Referer = "https://shopee.vn/";
                request.AddHeader("x-requested-with", "XMLHttpRequest");
                response = request.Get("https://shopee.vn/api/v2/item/get?itemid=" + mat.Groups["idi"].ToString() + "&shopid=" + mat.Groups["ids"].ToString() + "");
                content = response.ToString();
                Regex reg1 = new Regex(@"\Werror\W:null");
                MatchCollection mat2 = reg1.Matches(content);
                if (mat2.Count == 1)
                {
                    check = 1;
                    label20.Text = "TÊN SP : LINK ĐÚNG";
                    label21.Text = "Giá : Giá SP";
                }
                else
                {
                    label20.Text = "TÊN SP : LINK SAI";
                    label21.Text = "Giá : KHÔNG TỒN TẠI";
                    MessageBox.Show("Nhập Lại Link Sản Phẩm", "Thông Báo");
                }
            }
            string[] s1 = new string[2];
            s1[0] = mat.Groups["ids"].ToString();
            s1[1] = mat.Groups["idi"].ToString();
            return s1;
        }

 

Chia sẻ bài đăng này


Link tới bài viết
Share on other sites

Chị ơi, em reqeust đến sản phẩm trong shop, em muốn lấy tên nhưng chỉ trả về chuỗi như này, Giờ Em muốn đưa nó về tiếng Việt thì làm như thế nào ạ. C# nha chị :classic_wink:.

 "[ GI\u1ea2M GI\u00c1 S\u1ed0C ] L\u00f4ng Mi Gi\u1ea3 Ch\u1ed3n 3D"

****************************************************

Câu trả lời ở bài này nhé :

 

Edited by Thiên Chi Kiều Nữ

Chia sẻ bài đăng này


Link tới bài viết
Share on other sites

{"errcode":2,"message":"token not found"}

----------------------------------------------------------------
Nhắc nhở : bạn vui lòng gõ ý của bạn rõ ràng.

Edited by Thiên Chi Kiều Nữ
Cảnh cáo

Chia sẻ bài đăng này


Link tới bài viết
Share on other sites
On 2/8/2019 at 01:32, Cương Thế Nguyễn said:

Đây là Hàm xoá SP trong giỏ hàng

Nội dung ẩn

 


private void DeleteSP(string shopid, string itemid,string csrftoken)
        {           
            RequestParams reqParams = new RequestParams();
            reqParams["shopid"] = shopid;
            reqParams["itemid"] = itemid;
            request.Referer = "https://shopee.vn/";
            request.AddHeader("x-csrftoken", csrftoken);
            request.AddHeader("x-requested-with", "XMLHttpRequest");
            HttpResponse response = request.Post("https://shopee.vn/api/v0/buyer/cart/del_item/", reqParams);
            MessageBox.Show(response.ToString(), "Delete");
        }

 


************************************************************************************************

 

Update cho hàm xoá, chỉ cần truyền vào duy nhất giá trị csrf là có thể xoá đc tất cả các sản phẩm đang tồn tại trong giỏ.

Thớt có cái param của thêm sản phẩm vào giỏ và xoá địa chỉ cũ không ạ, em đang tập 2 cái đó mà khong hỉu sao convert sang c# nó ứ chịu chạy.:classic_wacko: :classic_wacko: :classic_wacko:

Nội dung ẩn

 


private void DeleteSP(string csrftoken) //Xoá 1 sản phẩm trong giỏ
        {
            HttpResponse response = request.Get("https://shopee.vn/api/v2/cart/get_items");
            string content = response.ToString();
            Regex reg = new Regex(@"\Witemid\W:(\d+)[\D]+[\w]+\W+shopid\W:(\d+)");
            MatchCollection kq1 = reg.Matches(content);
            int sosp = kq1.Count;
            
            for (int i = 0; i < sosp; i++)
            {
                response = request.Get("https://shopee.vn/api/v2/cart/get_items");
                string content1 = response.ToString();
                Regex reg0 = new Regex(@"\Witemid\W:(?<itemid>\d+)[\D]+[\w]+\W+shopid\W:(?<shopid>\d+)");
                Match kq = reg0.Match(content1);
                RequestParams reqParams = new RequestParams();
                reqParams["shopid"] = kq.Groups["shopid"].ToString();
                reqParams["itemid"] = kq.Groups["itemid"].ToString();
                request.Referer = "https://shopee.vn/";
                request.AddHeader("x-csrftoken", csrftoken);
                request.AddHeader("x-requested-with", "XMLHttpRequest");
                response = request.Post("https://shopee.vn/api/v0/buyer/cart/del_item/", reqParams);
            }
            MessageBox.Show("Đã Xoá " + sosp.ToString() + " Sản Phầm", "Delete");
        }

 

 

cái hàm xóa all sản phẩm là như thế nào vậy nhỉ, ko lẽ get giỏ hàng rồi check id shop với iditem

hàm xóa full địa chỉ với add địa chỉ mới (hàm này ta làm lâu rồi nên nhác sửa lại, còn cái chuẩn của ta thu gọn lắm.ahihi)

 

string sdt = "84977111222";

string pass = "hdsfkhadsjkfh";

string token = "";

string html = "";

token = str.GetRandomAz(32);

HttpRequest http = new HttpRequest();

void AddHeader()

{

    http.AddHeader("x-requested-with", "XMLHttpRequest");

    http.AddHeader("x-api-source", "pc");

    http.AddHeader("x-csrftoken", token);

    http.AddHeader("accept: */*");

    http.AddHeader("origin: https://shopee.vn");

}

http.SetCookie("csrftoken=" + token);

html = http.Get("https://shopee.vn/api/v0/buyer/login/").ToString();

http.AddField("login_key", sdt);

http.AddField("login_type", "phone");

http.AddField("password_hash", pass.ToMD5().ToSHA256());

http.AddField("captcha", "");

http.AddField("remember_me", "false");

AddHeader();

http.Referer = "https://shopee.vn/api/v0/buyer/login/";

html = http.Post("https://shopee.vn/api/v0/buyer/login/login_post/").ToString();

string status = "";

if (!html.Contains("\"redirect\":\"/buyer/\""))

{

    status = "đăng nhập thất bại";

    MessageBox.Show(status);



}

else { }

string ten = "Trương Vô kỵ";

string sodienthoai = "84977111222";

string sonha = "160 phùng hưng";

string xa = "Xã Bình Long";

string huyen = "Huyện Châu Phú";

string tinh = "An Giang";

string respone = http.Get("https://shopee.vn/api/v1/addresses/").ToString();

MatchCollection ids = Regex.Matches(respone, "id\":(\\d+)");

for (int i = 0; i < ids.Count; i++)

{

    string id = ids.Groups[1].Value;

    http.Referer = "https://shopee.vn/user/account/address";

    AddHeader();

    http.AddHeader(":path:/api/v0/addresses/add/");

    html = http.Post("https://shopee.vn/api/v0/addresses/" + id + "/delete/").ToString();

}

http.AddField("name", ten );

http.AddField("phone", sodienthoai );

http.AddField("country", "VN");

http.AddField("state", tinh );

http.AddField("city", huyen );

http.AddField("district", xa );

http.AddField("town", "");

http.AddField("address", sonha);

http.AddField("zipcode", "");

http.AddField("place", "DO_NOT_CHANGE__I_AM_MAGIC");

http.AddField("geoinfo", "null");

http.AddField("add_only", "false");

http.AddField("set_default", "1");

http.AddField("set_pickup", "0");

AddHeader();

http.AddHeader(":path:/api/v0/addresses/add/");

http.Referer = "https://shopee.vn/user/account/address";

html = http.Post("https://shopee.vn/api/v0/addresses/add/").ToString();

MessageBox.Show("OK");

------------------------------------------------------------------
P/s: code thì để trong thẻ code nha bạn

Edited by Thiên Chi Kiều Nữ
cho code vào thẻ code

Chia sẻ bài đăng này


Link tới bài viết
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Trả lời chủ đề này...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...