-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
44 lines (35 loc) · 1.74 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
from json_factory import json_factory
import requests
from bs4 import BeautifulSoup
base_url = 'https://www.bungie.net'
maybe = json_factory('The Last Word', export_json=False, is_name=True)
manifest_url = 'https://www.bungie.net/Platform/Destiny2/Manifest/'
manifest_response = requests.get(manifest_url)
manifest = manifest_response.json()
#print(manifest['Response']['jsonWorldComponentContentPaths']['en'].keys())
damage_types = manifest['Response']['jsonWorldComponentContentPaths']['en']['DestinyDamageTypeDefinition']
response = requests.get(f"{base_url}{damage_types}")
hashes = response.json().keys()
damage_types_dict = {}
'''
for id in hashes:
damage_types_dict[id] = response.json()[id]['displayProperties']['name']
'''
# DestinyDamageTypeDefinition -> self explanatory
# DestinyInventoryItemDefinition -> literally every item. enter the hash to find a list of item stuff.
# DestinyItemTierTypeDefinition -> this is the rarity of the item.
# we will look into this later.
test = manifest['Response']['jsonWorldComponentContentPaths']['en']['DestinySandboxPerkDefinition']
html = requests.get('https://www.light.gg/db/items/hover/839105230', verify=False)
soup = BeautifulSoup(html.text, 'html.parser')
h2 = soup.find('h2').text.strip()
print(h2)
exit()
inventory_item = manifest['Response']['jsonWorldComponentContentPaths']['en']['DestinyInventoryItemLiteDefinition']
response = requests.get(f"{base_url}{inventory_item}")
hashes = response.json().keys()
print(response.json()['2715240478']['displayProperties']['name'])
inventory_item = manifest['Response']['jsonWorldComponentContentPaths']['en']['DestinySandboxPerkDefinition']
response = requests.get(f"{base_url}{inventory_item}")
hashes = response.json().keys()
#print(response.json()['3300816228'])