Shopee API v4 server refused to respond

3.8k Views Asked by At

I am learning web crawler

I use postman as a tool

Currently practicing on the shopee website

I try to intercept "add to cart" and "checkout" posts

and send the complete duplicate post in one go

At first it was smooth

Every request I make will be responded by the server

But the next day the server suddenly stopped responding to my post

return data

{
    "tracking_id": "cc86ce23-1e8f-49f1-b304-752fb6cc7ead",
    "action_type": 2,
    "error": 90309999,
    "is_customized": false
}

I try to manually checkout again and fetch the post

The code has not been updated or changed

within tens of seconds after manual checkout

The post I send can be responded to by the server

But after dozens of seconds, the server will no longer respond to this post

I compared the difference between "can be responded to" and "can not be responded to" post

I found "cannot be responded to" post, his cookie has been changed

but i don't know how to solve this problem

The "Add to Cart" post is now valid

However, the "checkout" post is only valid within tens of seconds after the manual order is placed

I cleared the cookies and even changed to a new computer and ip, but I can't solve this problem

How can I solve this problem?

3

There are 3 best solutions below

0
On

curl 7.86.0 with set af-ac as null seems no longer work for single product detail scraper. But scraper products search page still working so far.

1
On

Most sites have updated the conditions for checking headers. According to XHR breakpoint '/search_ items?‘ You can see the contents of the check.
’X-Sap-Access-S': It is encrypted from md5 and encoded with base64.Intuition tells me it's like a timestamp, I'm not sure.
’X-Sap-Access-T ': It is an int (time. time()) timestamp. I have verified it.
‘X-Sap-Access-F’:
‘af-ac-enc-dat’:
These two are difficult. I don't know how they were generated...

headers = {
‘X-Sap-Access-F’: "3.0.0.6.0|13|2.4.12_5.1.0_0_187|d7fdb0e639214ead93fc55232d583a5672d3fc79a4974e|10900|1100",    
‘X-Sap-Access-S’: "MUZALjKcrgAuyFpkJuSsYBpwPHzjuPHbPVu1IfSJeJA=",    
‘X-Sap-Access-T’: "1667569629",    
‘af-ac-enc-dat’: "AAcyLjQuMS0yAAABhELlOE8AAAtvAkAAAAAAAAAAAOYyhFAbVQMMpIKa2+dGIBkKaWUVkWOzjLDykZY2dhCO2aemlognVlm0dDMGivrgRXrrMUseuXD/py3eUhWKg7iganQiVFma6ooH+ehDhBTg74+38rWtzNgtemYl8gaHOc5BdJupajpcNcL9Yg+yzg0eZ4Bzj+zJuu1NkJs+QlLrpYU6CYdLxz8yJkk2EqrDfkG48jSZUbatRPTf42k24UXHBZsir4fwWxQLVKw5gDu5CyybpSVWFCd7OLsY30Hj1OjSKZvDNTpkAhYqvdOyLCTGr41kHyFGV3ZaoQ01NX1u6R9AnBG6X9s1ynZK6vnTBgzBIOKTNFS4j1VT8sOl1BEtObri8ZUW3OTOHeCO4vGDCq4gRJFmvwSm1BNdccjxAekgEx3xwroP6ZL6LO5bh9QSxuKGYkUmR84CcHLB6dmMPnXDUGkagca9MFiK8RmRsrN2vcLDNTpkAhYqvdOyLCTGr41kjULvHyB47grB1wJBPIqJXX85i0ATioYJG+gPR+8Iz8TP3jANhks7Nl1goVRGmInlF+8hpeeDkMDl0WXkPHJxWfUHoucLt/ap9WR6Bk8psQ0JvTBAKC2yDgEHlbMyYBASMCWwUsMjN91gY0M/3PoYDZwkdZaPXbTOQWIv6XoNZwJXoG/G+6MnZ1XOfnl6yuBbpKOPnEICh33J8hrs9Z7IhC8PysgyvIxGQ0MuU2DTK0+RY7OMsPKRljZ2EI7Zp6aWkWOzjLDykZY2dhCO2aemlkmIKiMicLiHq6lIrEXcEhaLGHvdZJ2TwxpZ36RHEhSc"    }    
2
On

You can add a requests header, like this headers key af-ac-enc-dat value null, this works for me.