Created
September 27, 2021 21:26
-
-
Save kjhf/ffb2bbe15ebdf2d73435d9e47b752214 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Go to https://steamcommunity.com/profiles/76561198009621091/inventory/#250820 which is the inventory for SteamVR for me | |
# Open the inspect (Ctrl-shift-C) | |
# This will also resize the window to display everything | |
# Copy the inventory_page HTML element | |
# There should be as many hits for "itemHolder" as there are items in this inventory. If not, make sure the JS has fully rendered | |
# Paste in the line when prompted by the scratch. | |
import re | |
from collections import Counter | |
if __name__ == '__main__': | |
html = input("Feed me HTML.") | |
assert "inventory_page" in html, "inventory_page not found, not copied from parent element." | |
items_count = html.count("itemHolder") | |
assert items_count, "No items found when counting itemHolder." | |
sources = re.finditer(r"src=\"(\S+)\"", html, re.RegexFlag.DOTALL | re.RegexFlag.MULTILINE) | |
sources = [source.group(1) for source in sources] | |
counter = Counter(list(sources)) | |
dupes = [el for el in counter.most_common() if el[1] > 1] | |
print(f"{len(dupes)} dupes found:") | |
for dupe in dupes: | |
print(f"{dupe[0]} appears {dupe[1]} times.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment