【问题标题】:Python Roblox issue with buying limited items购买有限物品的 Python Roblox 问题
【发布时间】:2020-06-26 10:27:41
【问题描述】:

所以在 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 robux 衬衫上运行 buyItem 函数时,它买了它没有问题。但是后来我想买一个限量的,它不会买。也是的,有足够的robux。帮助表示赞赏!谢谢!

【问题讨论】:

    标签: python request python-requests roblox


    【解决方案1】:

    我在 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

    【讨论】:

      猜你喜欢
      • 2020-08-09
      • 2021-09-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-06-22
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多