Jump to content

Recommended Posts

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

 

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


Link tới bài viết
Share on other sites
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 :)

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


Link tới bài viết
Share on other sites
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 there

https://tea.tzuyanglin.tw/shop/bot/src/branch/master/shopee/shopee.go

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


Link tới bài viết
Share on other sites
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 ...:167788130085140: .. 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


 

 

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


Link tới bài viết
Share on other sites
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 there

https://tea.tzuyanglin.tw/shop/bot/src/branch/master/shopee/shopee.go

Đúng là đây, cảm ơn bạn rất nhiều

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


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

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ả:

spacer.png

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


Link tới bài viết
Share on other sites
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ả:

spacer.png

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 

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


Link tới bài viết
Share on other sites
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 :classic_laugh:

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...