mirror of
https://silica.codes/BedrockReverse/PyFab.git
synced 2025-05-23 11:36:28 +12:00
Upload
This commit is contained in:
parent
76acbb87ad
commit
7072ca4634
2 changed files with 205 additions and 0 deletions
36
Scraper.py
Normal file
36
Scraper.py
Normal file
|
@ -0,0 +1,36 @@
|
|||
import PlayFab
|
||||
import json
|
||||
|
||||
# Login and Switch to Master Player Account
|
||||
PlayFab.GetEntityToken(PlayFab.LoginWithCustomId()['PlayFabId'], 'master_player_account')
|
||||
|
||||
MAX_SEARCH = 300
|
||||
|
||||
# Get total number of items in marketplace
|
||||
totalItems = PlayFab.Search("", "", "creationDate ASC", None, 1, 0)["Count"]
|
||||
|
||||
# Initalize some variables
|
||||
searchFilter = ""
|
||||
skip = 0
|
||||
resultsDict = {}
|
||||
|
||||
print("Total items in marketplace: "+str(totalItems))
|
||||
|
||||
# Search loop
|
||||
while len(resultsDict) < totalItems:
|
||||
searchResults = PlayFab.Search("", searchFilter, "creationDate ASC", "contents,images,title,description,keywords", MAX_SEARCH, skip)
|
||||
|
||||
for item in searchResults["Items"]:
|
||||
resultsDict[item["Id"]] = item
|
||||
|
||||
print(str(len(resultsDict))+ "/" + str(totalItems));
|
||||
|
||||
|
||||
skip += MAX_SEARCH
|
||||
|
||||
if skip > 10000:
|
||||
searchFilter = "(CreationDate ge " + searchResults["Items"][-1]["CreationDate"] +")";
|
||||
skip = 0
|
||||
|
||||
open("playfab-catalog.json", "wb").write(json.dumps(resultsDict, indent=4).encode("UTF-8"))
|
||||
print("Bubbles")
|
Loading…
Add table
Add a link
Reference in a new issue