Thiên Chi Kiều Nữ 597 Đã viết Ngày 28 tháng 3 9 giờ trước, Olala said: Mod có thể biếu diễn vài chiêu bên C lấy như thế nào được ko Mod :( Đây nhé bạn @Olala code lấy item info bằng php ( code php nên mỵ up qua bên đó ) test . bạn thay itemid với shopid vào nhé :) . Trích dẫn https://teamcodedao.com/shopee/get_item_info.php?itemid=2901487126&shopid=182641997 Trích dẫn Chia sẻ bài đăng này Link tới bài viết Share on other sites
Olala 1 Đã viết Ngày 28 tháng 3 57 phút trước, Thiên Chi Kiều Nữ said: Đây nhé bạn @Olala code lấy item info bằng php ( code php nên mỵ up qua bên đó ) test . bạn thay itemid với shopid vào nhé :) . Cảm ơn mod rất nhiều :) Trích dẫn Chia sẻ bài đăng này Link tới bài viết Share on other sites
Legiuner 3 Đã viết Ngày 29 tháng 3 On 22/3/2021 at 10:27, Legiuner said: just use md5 to generate header if-none-match- :-) 'generally : params = 'itemid=xxxxx&shopid=yyyyy' '#sometimes params in json string or empty string '#first text = md5(params) '#second ... to be continued :-) ......................................... ps. I got this code in golang language (just googling) I am not familiar with golang so I test the code with golang online (https://play.golang.org/) sorry for late #generally : params = 'itemid=xxxxx&shopid=yyyyy' #sometimes params in json string or empty string #first text = md5(params) #second... text2 = '55b03' + text + '55b03' ifNoneMatch = '55b03' + md5(text2) reference : https://tea.tzuyanglin.tw/ (golang version) (now 404 page not found) ------------------------------------------------------------- for golang : package main import ( "fmt"; "crypto/md5"; "encoding/hex" ) func main() { var params,ifNoneMatch string; params = "itemid=xxxxx&shopid=yyyyy"; ifNoneMatch = encryptParams(params); fmt.Println(ifNoneMatch); } func encryptParams(params string) string { hashMD51 := md5.New() hashMD51.Write([]byte(params)) result := hashMD51.Sum(nil) text := "55b03" + hex.EncodeToString(result) + "55b03" hashMD52 := md5.New() hashMD52.Write([]byte(text)) result = hashMD52.Sum(nil) return "55b03-" + hex.EncodeToString(result) } please play this on https://play.golang.org/ ------------------------------------------------------------- for python : import hashlib def get_header_shopee(params): hashObj = hashlib.md5(params.encode("utf-8")).hexdigest() text = "55b03" + hashObj + "55b03" hashObj = hashlib.md5(text.encode("utf-8")).hexdigest() #print(hashObj) return '55b03-'+hashObj ------------------------------------------------------------- for vb.net : Imports System.Security.Cryptography Imports System.Text Shared Function GetHash_If_None_Match(theInput As String) As String Dim dbytes As Byte() Dim sBuilder As New System.Text.StringBuilder() Dim firstHash As String = "" Dim str_If_None_Match As String = "" Using hasher As MD5 = MD5.Create() ' create hash object '111111111111111111111111111111111111111111111111111111111111111 ' Convert to byte array and get hash dbytes = hasher.ComputeHash(Encoding.UTF8.GetBytes(theInput)) ' sb to create string from bytes sBuilder = New System.Text.StringBuilder() ' convert byte data to hex string For n As Integer = 0 To dbytes.Length - 1 sBuilder.Append(dbytes(n).ToString("x2")) Next n '111111111111111111111111111111111111111111111111111111111111111 firstHash = sBuilder.ToString() firstHash = "55b03" & firstHash & "55b03" '22222222222222222222222222222222222222222222222222222222222 dbytes = hasher.ComputeHash(Encoding.UTF8.GetBytes(firstHash)) sBuilder = New System.Text.StringBuilder() For n As Integer = 0 To dbytes.Length - 1 sBuilder.Append(dbytes(n).ToString("x2")) Next n '22222222222222222222222222222222222222222222222222222222222 str_If_None_Match = "55b03-" & sBuilder.ToString() Return str_If_None_Match End Using End Function ------------------------------------------------------------- I don't know for C#, you have to convert yourself thank you teamcodedao for the knowledge that I get from you sorry for my poor english sorry the reference is still therehttps://tea.tzuyanglin.tw/shop/bot/src/branch/master/shopee/shopee.go 2 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ữ 597 Đã viết Ngày 29 tháng 3 1 giờ trước, Legiuner said: sorry for late #generally : params = 'itemid=xxxxx&shopid=yyyyy' #sometimes params in json string or empty string #first text = md5(params) #second... text2 = '55b03' + text + '55b03' ifNoneMatch = '55b03' + md5(text2) reference : https://tea.tzuyanglin.tw/ (golang version) (now 404 page not found) ------------------------------------------------------------- for golang : package main import ( "fmt"; "crypto/md5"; "encoding/hex" ) func main() { var params,ifNoneMatch string; params = "itemid=xxxxx&shopid=yyyyy"; ifNoneMatch = encryptParams(params); fmt.Println(ifNoneMatch); } func encryptParams(params string) string { hashMD51 := md5.New() hashMD51.Write([]byte(params)) result := hashMD51.Sum(nil) text := "55b03" + hex.EncodeToString(result) + "55b03" hashMD52 := md5.New() hashMD52.Write([]byte(text)) result = hashMD52.Sum(nil) return "55b03-" + hex.EncodeToString(result) } please play this on https://play.golang.org/ ------------------------------------------------------------- for python : import hashlib def get_header_shopee(params): hashObj = hashlib.md5(params.encode("utf-8")).hexdigest() text = "55b03" + hashObj + "55b03" hashObj = hashlib.md5(text.encode("utf-8")).hexdigest() #print(hashObj) return '55b03-'+hashObj ------------------------------------------------------------- for vb.net : Imports System.Security.Cryptography Imports System.Text Shared Function GetHash_If_None_Match(theInput As String) As String Dim dbytes As Byte() Dim sBuilder As New System.Text.StringBuilder() Dim firstHash As String = "" Dim str_If_None_Match As String = "" Using hasher As MD5 = MD5.Create() ' create hash object '111111111111111111111111111111111111111111111111111111111111111 ' Convert to byte array and get hash dbytes = hasher.ComputeHash(Encoding.UTF8.GetBytes(theInput)) ' sb to create string from bytes sBuilder = New System.Text.StringBuilder() ' convert byte data to hex string For n As Integer = 0 To dbytes.Length - 1 sBuilder.Append(dbytes(n).ToString("x2")) Next n '111111111111111111111111111111111111111111111111111111111111111 firstHash = sBuilder.ToString() firstHash = "55b03" & firstHash & "55b03" '22222222222222222222222222222222222222222222222222222222222 dbytes = hasher.ComputeHash(Encoding.UTF8.GetBytes(firstHash)) sBuilder = New System.Text.StringBuilder() For n As Integer = 0 To dbytes.Length - 1 sBuilder.Append(dbytes(n).ToString("x2")) Next n '22222222222222222222222222222222222222222222222222222222222 str_If_None_Match = "55b03-" & sBuilder.ToString() Return str_If_None_Match End Using End Function ------------------------------------------------------------- I don't know for C#, you have to convert yourself thank you teamcodedao for the knowledge that I get from you sorry for my poor english oh yeah.. thank you.. so easy ... .. finally we have calculator if-none-match- :v ..let me update c# function .. here is code c# (using func creatmd5 in topic #1) string Param = "itemid=5672688695&shopid=53339108"; string Param_Md5 = CreateMD5(Item_Param).ToLower(); string text_Hash = "55b03"+Param_Md5+"55b03"; string if_none_match_ = CreateMD5(text_Hash).ToLower(); //func CreateMD5 is in topic #1 Trích dẫn Chia sẻ bài đăng này Link tới bài viết Share on other sites
Olala 1 Đã viết Ngày 30 tháng 3 11 giờ trước, Legiuner said: sorry for late #generally : params = 'itemid=xxxxx&shopid=yyyyy' #sometimes params in json string or empty string #first text = md5(params) #second... text2 = '55b03' + text + '55b03' ifNoneMatch = '55b03' + md5(text2) reference : https://tea.tzuyanglin.tw/ (golang version) (now 404 page not found) ------------------------------------------------------------- for golang : package main import ( "fmt"; "crypto/md5"; "encoding/hex" ) func main() { var params,ifNoneMatch string; params = "itemid=xxxxx&shopid=yyyyy"; ifNoneMatch = encryptParams(params); fmt.Println(ifNoneMatch); } func encryptParams(params string) string { hashMD51 := md5.New() hashMD51.Write([]byte(params)) result := hashMD51.Sum(nil) text := "55b03" + hex.EncodeToString(result) + "55b03" hashMD52 := md5.New() hashMD52.Write([]byte(text)) result = hashMD52.Sum(nil) return "55b03-" + hex.EncodeToString(result) } please play this on https://play.golang.org/ ------------------------------------------------------------- for python : import hashlib def get_header_shopee(params): hashObj = hashlib.md5(params.encode("utf-8")).hexdigest() text = "55b03" + hashObj + "55b03" hashObj = hashlib.md5(text.encode("utf-8")).hexdigest() #print(hashObj) return '55b03-'+hashObj ------------------------------------------------------------- for vb.net : Imports System.Security.Cryptography Imports System.Text Shared Function GetHash_If_None_Match(theInput As String) As String Dim dbytes As Byte() Dim sBuilder As New System.Text.StringBuilder() Dim firstHash As String = "" Dim str_If_None_Match As String = "" Using hasher As MD5 = MD5.Create() ' create hash object '111111111111111111111111111111111111111111111111111111111111111 ' Convert to byte array and get hash dbytes = hasher.ComputeHash(Encoding.UTF8.GetBytes(theInput)) ' sb to create string from bytes sBuilder = New System.Text.StringBuilder() ' convert byte data to hex string For n As Integer = 0 To dbytes.Length - 1 sBuilder.Append(dbytes(n).ToString("x2")) Next n '111111111111111111111111111111111111111111111111111111111111111 firstHash = sBuilder.ToString() firstHash = "55b03" & firstHash & "55b03" '22222222222222222222222222222222222222222222222222222222222 dbytes = hasher.ComputeHash(Encoding.UTF8.GetBytes(firstHash)) sBuilder = New System.Text.StringBuilder() For n As Integer = 0 To dbytes.Length - 1 sBuilder.Append(dbytes(n).ToString("x2")) Next n '22222222222222222222222222222222222222222222222222222222222 str_If_None_Match = "55b03-" & sBuilder.ToString() Return str_If_None_Match End Using End Function ------------------------------------------------------------- I don't know for C#, you have to convert yourself thank you teamcodedao for the knowledge that I get from you sorry for my poor english sorry the reference is still therehttps://tea.tzuyanglin.tw/shop/bot/src/branch/master/shopee/shopee.go Đúng là đây, cảm ơn bạn rất nhiều Trích dẫn Chia sẻ bài đăng này Link tới bài viết Share on other sites
Rizki 0 Đã viết Ngày 3 tháng 4 Thanks Trích dẫn Chia sẻ bài đăng này Link tới bài viết Share on other sites
itmanvn 1 Đã viết Ngày 5 tháng 4 Mình vừa test thử trên nodejs dùng node-libcurl thì ko cần khai báo header gì vẫn load full info, khi test trên postman cũng vậy, không hiểu sao các bạn lại bàn về if-none-match- const { Curl } = require('node-libcurl'); const curl = new Curl(); curl.setOpt('URL', 'https://shopee.vn/api/v2/item/get?itemid=6067536801&shopid=165026318'); curl.setOpt('FOLLOWLOCATION', true); curl.setOpt(Curl.option.HTTPHEADER, ['User-Agent: PostmanRuntime/7.26.5']); curl.on('end', function (statusCode, data, headers) { console.info(statusCode); console.info('---'); console.info(data); console.info('---'); console.info(this.getInfo( 'TOTAL_TIME')); var obj = JSON.parse(data); console.log( { Item: obj.item.itemid, Name: obj.item.name, Brand: obj.item.brand, Price: obj.item.price_before_discount, SalePrice: obj.item.price, Sold: obj.item.historical_sold, Image: obj.item.image, Location: obj.item.shop_location, Cat1: obj.item.categories[0].display_name, Cat2: obj.item.categories[1].display_name, Cat3: obj.item.categories[2].display_name, Description: obj.item.description }); this.close(); }); curl.on('error', curl.close.bind(curl)); curl.perform(); kết quả: 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ữ 597 Đã viết Ngày 5 tháng 4 5 giờ trước, itmanvn said: Mình vừa test thử trên nodejs dùng node-libcurl thì ko cần khai báo header gì vẫn load full info, khi test trên postman cũng vậy, không hiểu sao các bạn lại bàn về if-none-match- const { Curl } = require('node-libcurl'); const curl = new Curl(); curl.setOpt('URL', 'https://shopee.vn/api/v2/item/get?itemid=6067536801&shopid=165026318'); curl.setOpt('FOLLOWLOCATION', true); curl.setOpt(Curl.option.HTTPHEADER, ['User-Agent: PostmanRuntime/7.26.5']); curl.on('end', function (statusCode, data, headers) { console.info(statusCode); console.info('---'); console.info(data); console.info('---'); console.info(this.getInfo( 'TOTAL_TIME')); var obj = JSON.parse(data); console.log( { Item: obj.item.itemid, Name: obj.item.name, Brand: obj.item.brand, Price: obj.item.price_before_discount, SalePrice: obj.item.price, Sold: obj.item.historical_sold, Image: obj.item.image, Location: obj.item.shop_location, Cat1: obj.item.categories[0].display_name, Cat2: obj.item.categories[1].display_name, Cat3: obj.item.categories[2].display_name, Description: obj.item.description }); this.close(); }); curl.on('error', curl.close.bind(curl)); curl.perform(); kết quả: mỵ cũng không cần.. nhưng hình như mọi ng request số lượng lớn, đến 1 lúc nó ko ra đúng thông tin cần nữa thì phải bạn à :v Trích dẫn Chia sẻ bài đăng này Link tới bài viết Share on other sites
itmanvn 1 Đã viết Ngày 6 tháng 4 15 giờ trước, Thiên Chi Kiều Nữ said: mỵ cũng không cần.. nhưng hình như mọi ng request số lượng lớn, đến 1 lúc nó ko ra đúng thông tin cần nữa thì phải bạn à :v Thường mỗi lần mình request khoảng 5000 sp 1 Trích dẫn Chia sẻ bài đăng này Link tới bài viết Share on other sites
Caboingua 0 Đã viết Ngày 7 tháng 4 Thả tim <3 Trích dẫn Chia sẻ bài đăng này Link tới bài viết Share on other sites
dthe84 0 Đã viết Ngày 8 tháng 4 Chia sẻ tuyệt vời, cám ơn các bạn Trích dẫn Chia sẻ bài đăng này Link tới bài viết Share on other sites
Nguyen Linh 0 Đã viết Thứ bảy at 15:32 chấm Trích dẫn Chia sẻ bài đăng này Link tới bài viết Share on other sites