36 lines
1.1 KiB
Python
36 lines
1.1 KiB
Python
|
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")
|