Python Roblox问题,购买了有限的物品

问题描述 投票:0回答:1

所以在roblox中,我试图向其api发送请求以购买商品。这是代码:

def buyItem(self,itemid, cookie, price=None):
        info = self.getItemInfo(itemid)
        url="https://economy.roblox.com/v1/purchases/products/{}".format(info["ProductId"])
        print(url)
        cookies = {
            '.ROBLOSECURITY': cookie
        }
        headers = {
            'X-CSRF-TOKEN': self.setXsrfToken(cookie)
        }
        data={
            'expectedCurrency': 1, 'expectedPrice': info["PriceInRobux"] if price == None else price, 'expectedSellerId': info["Creator"]["Id"]
            }
        r = self.s.post(url, data=data, cookies=cookies, headers=headers)
        return r
def getItemInfo(self,itemid):
        return self.s.get("https://api.roblox.com/marketplace/productinfo?assetId="+str(itemid)).json()
def setXsrfToken(self, cookie):
        cookies = {
            '.ROBLOSECURITY': cookie
        }
        r = self.s.get("https://roblox.com/home", cookies=cookies)
        tok = r.text[r.text.find("Roblox.XsrfToken.setToken('") + 27::]
        tok = tok[:tok.find("');"):]
        return tok

[当我尝试在5尺码的衬衣上运行buyItem函数时,它毫无问题地购买了它。但是后来我试图买一个有限的,它不会买。同样是的,有足够的机器人。感谢帮助!谢谢!

python request python-requests roblox
1个回答
0
投票

我在github上寻找它,发现了类似的东西。我认为它将为您提供帮助。对不起,很长的回复)我认为还需要其他参数,请参见第370行。post(“https://web.roblox.com/api/item.ashx?rqtype=purchase&productID={}&expectedCurrency = 1&expectedPrice = {}&expectedSellerID = {}&userAssetID = {}”。format(self.getItemInfo(aid)['ProductId'],seller ['Price'],seller ['SellerId' ],seller ['UserAssetId']),headers = {“ X-CSRF-TOKEN”:self.token})

https://github.com/judge2020/LimitedSniper/blob/master/roblopy.py

© www.soinside.com 2019 - 2024. All rights reserved.