Thiên Chi Kiều Nữ 959 Đã viết 1/08/2019 Chào các bạn, hiện tại thị trường tools về facebook khá là đau đầu do con AI dở hơi của facebook liên tục cho ăn checkpoint và die hàng loạt clone :v kể cả cuộc chiến Ad Breaks dính lứu tới Việt Nam đều có phần hãm . Thế nên Mỵ sẽ chuyển qua request một số trang khác thử sức xem như thế nào :") Ở topic này mỵ và mọi người sẽ chia sẻ code về request shopee.vn nhé. ================================================================== Code if-none-match- : ================================================================== Update code (01/03/2020) : Hướng dẫn request thanh toán cho shopee (checkout for shopee) ================================================================== Code : đăng nhập shopee.vn Nội dung ẩn Bạn cần Reaction hoặc trả lời chủ đề này để thấy nội dung bị ẩn. Hàm trên là khởi nguồn của mọi việc, đăng nhập xong, lấy được cookie thì mình làm gì tiếp mới làm được Chú ý : các request sau này các bạn nhớ addheader đầy đủ nhé :). Sau khi login bạn mới có thể sử dụng code sau nhé. Code add địa chỉ của shop nhé : Nội dung ẩn Bạn cần Reaction hoặc trả lời chủ đề này để thấy nội dung bị ẩn. Chia sẻ code đăng ký shopee :v mỵ mới làm 1/2 còn 1/2 nữa..hoàn thành sau :D .. Nội dung ẩn Bạn cần Reaction hoặc trả lời chủ đề này để thấy nội dung bị ẩn. API tìm kiếm sản phẩm :v Sau khi đăng nhập, request GET với link này là có kết qủa nhé string Keyword = "Bao cao su"; string SoLuongTimKiem = "50"; string LinkTK = "https://shopee.vn/api/v2/search_items/?by=relevancy&keyword="+Keyword+"&limit="+SoLuongTimKiem+"&newest=0&order=desc&page_type=search" * Update code 01/05/2020 : Update code đẩy sản phẩm Code đẩy sản phẩm cám ơn bạn @songhanpoo cho mượn nick để test code : string ID_San_Pham = "7330304651"; // bạn tự thay id sản phẩm của bạn string SPC_CDS = "1"; // bạn tự thay SPC_CDS của bạn HttpRequest request = new HttpRequest() { UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.122 Safari/537.36", Cookies = new CookieStorage(), }; ....Chạy code đăng nhập......Đăng nhập xong chạy tiếp code dưới request.Cookies.Add(new System.Net.Cookie("SPC_CDS", SPC_CDS, "/", "shopee.vn")); string DataPost = @"{""id"":"+ ID_San_Pham + @"}"; request.Referer = "https://banhang.shopee.vn/portal/product/list/all"; HttpResponse response = request.Post("https://banhang.shopee.vn/api/v3/product/boost_product/?version=3.1.0&SPC_CDS="+ SPC_CDS + "&SPC_CDS_VER=2", DataPost, "application/json;charset=UTF-8"); string KetQua = response.ToString(); * Update code 07/05/2020 : Lấy danh sách tin nhắn chưa đọc từ chat của shopee . Code của bạn @Đoàn Minh Tâm 228 6 3 68 Trích dẫn Chia sẻ bài đăng này Link tới bài viết Share on other sites
Cương Thế Nguyễn 127 Đã viết 1/08/2019 Đây là Hàm xoá SP trong giỏ hàng : Nội dung ẩn Bạn cần Reaction hoặc trả lời chủ đề này để thấy nội dung bị ẩn. ************************************************************************************************ 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. Nội dung ẩn Bạn cần Reaction hoặc trả lời chủ đề này để thấy nội dung bị ẩn. 102 2 1 1 20 Trích dẫn Chia sẻ bài đăng này Link tới bài viết Share on other sites
Thiên Chi Kiều Nữ 959 Đã viết 2/08/2019 Thêm sản phẩm vào giỏ hàng : Nội dung ẩn Bạn cần Reaction hoặc trả lời chủ đề này để thấy nội dung bị ẩn. 91 2 1 17 Trích dẫn Chia sẻ bài đăng này Link tới bài viết Share on other sites
Hùng Sơn Tinh 0 Đã viết 2/08/2019 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á... Trích dẫn Chia sẻ bài đăng này Link tới bài viết Share on other sites
Cương Thế Nguyễn 127 Đã viết 2/08/2019 bắn tym Trích dẫn Chia sẻ bài đăng này Link tới bài viết Share on other sites
Thiên Chi Kiều Nữ 959 Đã viết 2/08/2019 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 Trích dẫn Chia sẻ bài đăng này Link tới bài viết Share on other sites
emga9xkc 0 Đã viết 2/08/2019 cảm ơn bác hí hí Trích dẫn Chia sẻ bài đăng này Link tới bài viết Share on other sites
Cương Thế Nguyễn 127 Đã viết 3/08/2019 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 . 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; } 1 Trích dẫn Chia sẻ bài đăng này Link tới bài viết Share on other sites
caubeiuzk 24 Đã viết 4/08/2019 hi Trích dẫn Chia sẻ bài đăng này Link tới bài viết Share on other sites
Cương Thế Nguyễn 127 Đã viết 4/08/2019 (edited) 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ị . "[ 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 21/08/2019 by Thiên Chi Kiều Nữ Trích dẫn Chia sẻ bài đăng này Link tới bài viết Share on other sites
Đại Thanh 0 Đã viết 12/08/2019 (edited) {"errcode":2,"message":"token not found"} ----------------------------------------------------------------Nhắc nhở : bạn vui lòng gõ ý của bạn rõ ràng. Edited 13/08/2019 by Thiên Chi Kiều Nữ Cảnh cáo Trích dẫn Chia sẻ bài đăng này Link tới bài viết Share on other sites
anhtuan242 1 Đã viết 18/08/2019 Có bác nào làm về đăng ký shopee chưa chia sẻ em chút, e cảm ơn :))) Trích dẫn Chia sẻ bài đăng này Link tới bài viết Share on other sites
pvhnamdinh 0 Đã viết 31/08/2019 Thank chủ thread ạ Trích dẫn Chia sẻ bài đăng này Link tới bài viết Share on other sites
caubeiuzk 24 Đã viết 2/09/2019 (edited) 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. 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 3/09/2019 by Thiên Chi Kiều Nữ cho code vào thẻ code 6 1 Trích dẫn Chia sẻ bài đăng này Link tới bài viết Share on other sites
LacHong 0 Đã viết 3/09/2019 cảm ơn Trích dẫn Chia sẻ bài đăng này Link tới bài viết Share on other sites