Skip to content

Commit

Permalink
Redesigned data format
Browse files Browse the repository at this point in the history
  • Loading branch information
supr3meofficial committed May 11, 2020
1 parent 37dbd9a commit 6cb996f
Show file tree
Hide file tree
Showing 34 changed files with 3,772 additions and 24,159 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@

# CHANGELOG

## v0.1.2 - 11/05/20
* Redesigned data format

## v0.1.1 - 11/05/20
* Added a changelog
* Updated data format
Expand Down
433 changes: 56 additions & 377 deletions data/chroma_2_case.json

Large diffs are not rendered by default.

489 changes: 57 additions & 432 deletions data/chroma_3_case.json

Large diffs are not rendered by default.

416 changes: 58 additions & 358 deletions data/chroma_case.json

Large diffs are not rendered by default.

499 changes: 61 additions & 438 deletions data/clutch_case.json

Large diffs are not rendered by default.

Empty file removed data/cs
Empty file.
498 changes: 61 additions & 437 deletions data/cs20_case.json

Large diffs are not rendered by default.

497 changes: 61 additions & 436 deletions data/danger_zone_case.json

Large diffs are not rendered by default.

279 changes: 53 additions & 226 deletions data/esports_2013_case.json

Large diffs are not rendered by default.

353 changes: 56 additions & 297 deletions data/esports_2013_winter_case.json

Large diffs are not rendered by default.

480 changes: 58 additions & 422 deletions data/esports_2014_summer_case.json

Large diffs are not rendered by default.

471 changes: 61 additions & 410 deletions data/falchion_case.json

Large diffs are not rendered by default.

495 changes: 60 additions & 435 deletions data/gamma_2_case.json

Large diffs are not rendered by default.

496 changes: 60 additions & 436 deletions data/gamma_case.json

Large diffs are not rendered by default.

495 changes: 61 additions & 434 deletions data/glove_case.json

Large diffs are not rendered by default.

499 changes: 61 additions & 438 deletions data/horizon_case.json

Large diffs are not rendered by default.

444 changes: 61 additions & 383 deletions data/huntsman_weapon_case.json

Large diffs are not rendered by default.

423 changes: 52 additions & 371 deletions data/operation_bravo_case.json

Large diffs are not rendered by default.

418 changes: 61 additions & 357 deletions data/operation_breakout_weapon_case.json

Large diffs are not rendered by default.

498 changes: 61 additions & 437 deletions data/operation_hydra_case.json

Large diffs are not rendered by default.

383 changes: 58 additions & 325 deletions data/operation_phoenix_weapon_case.json

Large diffs are not rendered by default.

414 changes: 59 additions & 355 deletions data/operation_vanguard_weapon_case.json

Large diffs are not rendered by default.

472 changes: 61 additions & 411 deletions data/operation_wildfire_case.json

Large diffs are not rendered by default.

14,568 changes: 2,025 additions & 12,543 deletions data/output.json

Large diffs are not rendered by default.

499 changes: 61 additions & 438 deletions data/prisma_2_case.json

Large diffs are not rendered by default.

491 changes: 58 additions & 433 deletions data/prisma_case.json

Large diffs are not rendered by default.

493 changes: 60 additions & 433 deletions data/revolver_case.json

Large diffs are not rendered by default.

474 changes: 61 additions & 413 deletions data/shadow_case.json

Large diffs are not rendered by default.

497 changes: 61 additions & 436 deletions data/shattered_web_case.json

Large diffs are not rendered by default.

499 changes: 61 additions & 438 deletions data/spectrum_2_case.json

Large diffs are not rendered by default.

497 changes: 61 additions & 436 deletions data/spectrum_case.json

Large diffs are not rendered by default.

386 changes: 60 additions & 326 deletions data/winter_offensive_weapon_case.json

Large diffs are not rendered by default.

53 changes: 17 additions & 36 deletions data/x-ray_p250_package.json
Original file line number Diff line number Diff line change
@@ -1,38 +1,19 @@
[
{
"url": "https://csgostash.com/case/292/X-Ray-P250-Package"
},
{
"image_url": "https://steamcommunity-a.akamaihd.net/economy/image/-9a81dlWLwJ2UUGcVs_nsVtzdOEdtWwKGZZLQHTxDZ7I56KU0Zwwo4NUX4oFJZEHLbXU5A1PIYQNqhpOSV-fRPasw8rsS091PDtH5O_1FAthwfTNP2kTvomzzYHdlqLxZb7XlW4IuJwk3u2S8NWl3QS1_EA6YT2iddeXdgIgIQaHHJc2aVo/256fx256f"
},
{
"Covert Skins": [],
"Classified Skins": [],
"Restricted Skins": [
{
"P250 | X-Ray": [
{
"url": "https://csgostash.com/skin/1097/P250-X-Ray"
},
{
"image": "https://steamcdn-a.akamaihd.net/apps/730/icons/econ/default_generated/weapon_p250_cu_xray_p250_light_large.4b9f603e1a1dd4de2d64e05bf21168bc8b070bf2.png"
},
{
"possible_wears": {
"fn": "https://steamcommunity-a.akamaihd.net/economy/image/-9a81dlWLwJ2UUGcVs_nsVtzdOEdtWwKGZZLQHTxDZ7I56KU0Zwwo4NUX4oFJZEHLbXH5ApeO4YmlhxYQknCRvCo04DEVlxkKgpopujwezhjxszQYzxb08zkwdC0m_7zO6_ummpD78A_3uuY89ql21HlqkI4N22ncYTBdAJrYV2CrFO_wOjn18W07p3OySA1uD5iuyiPLEDzxw/512fx384f",
"mw": "https://steamcommunity-a.akamaihd.net/economy/image/-9a81dlWLwJ2UUGcVs_nsVtzdOEdtWwKGZZLQHTxDZ7I56KU0Zwwo4NUX4oFJZEHLbXH5ApeO4YmlhxYQknCRvCo04DEVlxkKgpopujwezhjxszQYzxb08zkwdC0m_7zO6_ummpD78A_3uuY89ql21HlqkI4N22ncYTBdAJrYV2CrFO_wOjn18W07p3OySA1uD5iuyiPLEDzxw/512fx384f",
"ft": "https://steamcommunity-a.akamaihd.net/economy/image/-9a81dlWLwJ2UUGcVs_nsVtzdOEdtWwKGZZLQHTxDZ7I56KU0Zwwo4NUX4oFJZEHLbXH5ApeO4YmlhxYQknCRvCo04DEVlxkKgpopujwezhjxszQYzxb08zkwdC0mvLwOq7cqWdQ-sJ0xO-Q8Nyt2gDtqRVpYjv6IIDBcFA4Nw6Er1a4w7-51JO7ucibwCE27HE8pSGKBI8tbWI/512fx384f"
}
},
{
"desc": "A custom painted P250 showing its internals with an X-Ray"
},
{
"lore": "Custom Paint Job "
}
]
{
"url": "https://csgostash.com/case/292/X-Ray-P250-Package",
"image_url": "https://steamcommunity-a.akamaihd.net/economy/image/-9a81dlWLwJ2UUGcVs_nsVtzdOEdtWwKGZZLQHTxDZ7I56KU0Zwwo4NUX4oFJZEHLbXU5A1PIYQNqhpOSV-fRPasw8rsS091PDtH5O_1FAthwfTNP2kTvomzzYHdlqLxZb7XlW4IuJwk3u2S8NWl3QS1_EA6YT2iddeXdgIgIQaHHJc2aVo/256fx256f",
"content": {
"Restricted Skins": {
"title": {
"url": "https://csgostash.com/skin/1097/P250-X-Ray",
"image": "https://steamcdn-a.akamaihd.net/apps/730/icons/econ/default_generated/weapon_p250_cu_xray_p250_light_large.4b9f603e1a1dd4de2d64e05bf21168bc8b070bf2.png",
"possible_wears": {
"fn": "https://steamcommunity-a.akamaihd.net/economy/image/-9a81dlWLwJ2UUGcVs_nsVtzdOEdtWwKGZZLQHTxDZ7I56KU0Zwwo4NUX4oFJZEHLbXH5ApeO4YmlhxYQknCRvCo04DEVlxkKgpopujwezhjxszQYzxb08zkwdC0m_7zO6_ummpD78A_3uuY89ql21HlqkI4N22ncYTBdAJrYV2CrFO_wOjn18W07p3OySA1uD5iuyiPLEDzxw/512fx384f",
"mw": "https://steamcommunity-a.akamaihd.net/economy/image/-9a81dlWLwJ2UUGcVs_nsVtzdOEdtWwKGZZLQHTxDZ7I56KU0Zwwo4NUX4oFJZEHLbXH5ApeO4YmlhxYQknCRvCo04DEVlxkKgpopujwezhjxszQYzxb08zkwdC0m_7zO6_ummpD78A_3uuY89ql21HlqkI4N22ncYTBdAJrYV2CrFO_wOjn18W07p3OySA1uD5iuyiPLEDzxw/512fx384f",
"ft": "https://steamcommunity-a.akamaihd.net/economy/image/-9a81dlWLwJ2UUGcVs_nsVtzdOEdtWwKGZZLQHTxDZ7I56KU0Zwwo4NUX4oFJZEHLbXH5ApeO4YmlhxYQknCRvCo04DEVlxkKgpopujwezhjxszQYzxb08zkwdC0mvLwOq7cqWdQ-sJ0xO-Q8Nyt2gDtqRVpYjv6IIDBcFA4Nw6Er1a4w7-51JO7ucibwCE27HE8pSGKBI8tbWI/512fx384f"
},
"desc": "A custom painted P250 showing its internals with an X-Ray",
"lore": "Custom Paint Job "
}
],
"Mil-Spec Skins": []
}
}
]
}
19 changes: 7 additions & 12 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,7 @@ def _get_skin_wears(self, skin_page_url):
return possible_wears

def _get_case_contents(self, case_page_url):
case_content = {
"Covert Skins" : [],
"Classified Skins" : [],
"Restricted Skins" : [],
"Mil-Spec Skins" : []
}
case_content = {}
# Parse main page
page = get_parsed_page(case_page_url)
# Isolate elements related to the actual skins
Expand All @@ -84,16 +79,16 @@ def _get_case_contents(self, case_page_url):
# Description & Lore
description,lore = self._get_skin_description_and_lore(skin_url)
# Full Skin details
skin_details = {title : [{"url" : skin_url}, {"image" : image_url}, {"possible_wears" : possible_wears}, {"desc" : description}, {"lore" : lore}]}
skin_details = dict(title = dict(url=skin_url, image=image_url, possible_wears=possible_wears, desc=description, lore = lore))
# Add to case_content
if rarity == 'Covert':
case_content['Covert Skins'].append(skin_details)
case_content['Covert Skins'] = skin_details
elif rarity == 'Classified':
case_content['Classified Skins'].append(skin_details)
case_content['Classified Skins'] = skin_details
elif rarity == 'Restricted':
case_content['Restricted Skins'].append(skin_details)
case_content['Restricted Skins'] = skin_details
elif rarity == 'Mil-Spec':
case_content['Mil-Spec Skins'].append(skin_details)
case_content['Mil-Spec Skins'] = skin_details
return case_content

def _get_all_cases(self):
Expand All @@ -114,7 +109,7 @@ def _get_all_cases(self):
image = page_content_single.img['src']
print(f'Adding case: {title} [{i}/{total_cases}]')
content = self._get_case_contents(url)
csgo_cases[title] = [{"url" : url}, {"image_url" : image}, content]
csgo_cases[title] = dict(url=url, image_url=image, content=content)
print(f'Done!\n')
i += 1
time.sleep(2) # Sleep to prevent overload
Expand Down

0 comments on commit 6cb996f

Please sign in to comment.