Open ynorouzz opened 6 years ago
Your URL for getting activities for D2 looks correct. You might try adding mode, count and page parameters to it, like so (but it should work without them):
... + "/Stats/Activities/?mode=AllPvP&count=50&page=0"
Are you sure the membership ID and character ID point to a valid character that does have activities?
As for PostGameCarnageReport you need to use activityDetails.instanceId, not activityHash.
I changed the script as follows that works for D2 (for a new player), but not D1. In D1, script can not find ActivityHistory of the given players.
def extract_PGCR(memId, chId, memType, dataPath, fname, destinyVersion):
#1 GetActivityHistory
if destinyVersion == 2:
hist_url = "https://www.bungie.net/Platform/Destiny2/"+str(memType)+"/Account/"+str(memId)+"/Character/"+str(chId)+"/Stats/Activities/"
elif destinyVersion == 1:
hist_url = "https://www.bungie.net/d1/platform/Destiny/Stats/ActivityHistory/"+str(memType)+"/"+str(memId)+"/"+str(chId)+"/"
his_res = requests.get(hist_url, headers=HEADERS).json()
data = []
# 2 GetPostGameCarnageReport
# /Destiny2/Stats/PostGameCarnageReport/{activityId}/
if his_res['Response']:
for act in his_res['Response']['activities']:
if destinyVersion == 2:
hist_url = "https://www.bungie.net/Platform/Destiny2/Stats/PostGameCarnageReport/"+act['activityDetails']['instanceId']+"/"
elif destinyVersion ==1:
hist_url = "https://www.bungie.net/d1/platform/Destiny/Stats/PostGameCarnageReport/"+act['activityDetails']['instanceId']+"/"
his_res = requests.get(hist_url, headers=HEADERS).json()
data.append(his_res)
with open(dataPath+fname+'_PGCR.json', 'w') as fp:
json.dump(data, fp)
return data
Hi @ynorouzz,
For your Destiny 1 call to the ActivityHistory end point you will need to add the 'mode' parameter which looks to be missing from your code snippet and a required parameter.
Based on the ActivityHistory link I provided above the values for mode can be as follows:
None, Story, Strike, Raid, AllPvP, Patrol, AllPvE, PvPIntroduction, ThreeVsThree, Control, Lockdown, Team, FreeForAll, Nightfall, Heroic, AllStrikes, IronBanner, AllArena, Arena, ArenaChallenge, TrialsOfOsiris, Elimination, Rift, Mayhem, ZoneControl, Racing, Supremacy, PrivateMatchesAll
So if you wanted to get all activities your 'hist_url' should look like the following:
hist_url = "https://www.bungie.net/d1/platform/Destiny/Stats/ActivityHistory/"+str(memType)+"/"+str(memId)+"/"+str(chId)+"/?mode=none"
Example:
https://www.bungie.net/d1/Platform/Destiny/Stats/ActivityHistory/1/4611686018429681104/2305843009217260609/?mode=none
Regards, @xlxCLUxlx
Hi @xlxCLUxlx ,
Excellent. Thank you for your comments.
Best regards
To get PostGameCarnageReport , I need activityId. For D2 I used the following method:
but the response is empty. For D1 I used the following script:
and it shows activities, but when I use activityHash to get PostGameCarnageReport, the response only includes entities, not teams.