### Install development dependencies Source: https://github.com/helyux/cs2inspect/blob/master/CONTRIBUTING.md Use these commands to set up the environment and enable pre-commit hooks. ```bash # Install dependencies pip install poetry poetry install # Enable automatic code formatting on commit pre-commit install ``` -------------------------------- ### Install cs2inspect Source: https://github.com/helyux/cs2inspect/blob/master/README.md Install the package using pip. ```bash pip install cs2inspect ``` -------------------------------- ### Enable Schema Enrichment Source: https://github.com/helyux/cs2inspect/blob/master/docs/example_usage.md Shows how to enable metadata enrichment by downloading a schema or providing a custom path. ```python import cs2inspect import json link = "steam://run/730//+csgo_econ_action_preview%200D1DC5E9CAE5BB0C150A2D860525093D043599ADABE20E4DBB0E450D5DD0076F19050C1DD43510C0C1013230710D96B0488D33ABB66F19050D1DD0351030071A3230BD25CAB0480D99D8376F19050E1DE03510C0C1013230D0F0A73348ED1813316F19050E1DE4351088E61C3230FBB9443348F58BAA306F19050F1D9C341088E61C3230014B1A33484DE99EB6650C7D05AF0C1A050D1D2230EC64104C4828251932404AB2884D5D8E880CEBE9FCE9" # Download the latest item/skin schema (one-time setup) cs2inspect.download_schema() # Parse with enrichment enabled (searches for 'cs2schema.json' by default) info = cs2inspect.parse(link, enrich=True) ``` ```python # Providing a path automatically enables enrichment info = cs2inspect.parse(link, schema="data/my_custom_schema.json") ``` -------------------------------- ### Create Simple Unmasked Inspect Links Source: https://github.com/helyux/cs2inspect/blob/master/docs/example_usage.md Builds a basic inspect link from asset, class, and owner IDs. These links do not contain detailed property data. ```python import cs2inspect link_data = { 'asset_id': '38350177019', 'class_id': '9385506221951591925', 'owner_id': '76561198066322090' } link_str = cs2inspect.link(link_data) print(link_str) # steam://rungame/730/76561202255233023/+csgo_econ_action_preview%20S76561198066322090A38350177019D9385506221951591925 ``` -------------------------------- ### Create Inspect Links Source: https://github.com/helyux/cs2inspect/blob/master/README.md Use the Builder class to construct a modern masked inspect link. ```python import cs2inspect # Create a modern 'masked' link using the Builder proto = cs2inspect.Builder( defindex=7, paintindex=941, paintseed=0, paintwear=0.15, rarity=5 ) link = cs2inspect.link(proto.build()) print(link) # steam://run/730//+csgo_econ_action_preview%2000180720AD072805389AB3E6F00340006F59908E ``` -------------------------------- ### Run project tests Source: https://github.com/helyux/cs2inspect/blob/master/CONTRIBUTING.md Execute the test suite using pytest. ```bash pytest tests/ -v ``` -------------------------------- ### Parse CS2 Links and Extract Data Source: https://github.com/helyux/cs2inspect/blob/master/docs/example_usage.md Demonstrates parsing both legacy unmasked links and modern masked links, as well as extracting raw protobuf data. ```python import cs2inspect # 1. Parse a traditional unmasked link (S A D format) unmasked_link = "steam://rungame/730/76561202255233023/+csgo_econ_action_preview%20S76561198066322090A38350177019D9385506221951591925" ids = cs2inspect.parse(unmasked_link) print(ids['owner_id']) # 76561198066322090 print(ids['asset_id']) # 38350177019 # 2. Parse a new masked CS2 link (contains full item properties) masked_link = "steam://run/730//+csgo_econ_action_preview%206A7AC7C6BEDED06B72704ACE6F426F5A635296868780692AAC6C226A3A6A02E9EAEAEA661A625E7EE646" data = cs2inspect.parse(masked_link) print(data['defindex']) # 26 (PP-Bizon) print(data['floatvalue']) # 0.05357979 # 3. Get the raw protobuf data block (Inverse of cs2inspect.link()) proto = cs2inspect.unlink(masked_link) print(proto.paintseed) # 838 ``` -------------------------------- ### cs2inspect.download_schema() Source: https://github.com/helyux/cs2inspect/blob/master/docs/example_usage.md Downloads the latest item/skin metadata schema for use with the enrichment feature. ```APIDOC ## cs2inspect.download_schema() ### Description Downloads the latest item and skin metadata schema to the local environment to support enrichment of parsed item data. ``` -------------------------------- ### Manually check and fix code style Source: https://github.com/helyux/cs2inspect/blob/master/CONTRIBUTING.md Run ruff manually to lint and format the codebase. ```bash ruff check --fix . ruff format . ``` -------------------------------- ### Create Complex Masked Inspect Links Source: https://github.com/helyux/cs2inspect/blob/master/docs/example_usage.md Uses the Builder class to generate binary-packed links with full technical properties, including stickers and charms. Supports outputting as standard links, console commands, or !gen codes. ```python import cs2inspect proto_base = cs2inspect.Builder( defindex=7, paintindex=941, paintseed=2, paintwear=0.22540508, rarity=5, ) # Add attachments (Stickers and Charms) proto_base.stickers.append({'slot': 2, 'sticker_id': 7203, 'wear': 0}) proto_base.keychains.append({ 'slot': 0, 'sticker_id': 36, 'offset_x': 4.515, 'offset_y': 0.591, 'offset_z': 8.906 }) # Build the protobuf and generate the link try: protobuf = proto_base.build() link_str = cs2inspect.link(protobuf) print(link_str) except Exception as e: print(f"Build failed: {e}") # Get a command for the in-game console console_str = cs2inspect.link_console(protobuf) print(console_str) # Generate a !gen code gen_str = cs2inspect.gen(protobuf, prefix="!g") print(gen_str) # !g 7 941 2 0.22540508 0 0 0 0 7203 0 0 0 0 0 36 0 ``` -------------------------------- ### cs2inspect.parse(link, enrich=False, schema=None) Source: https://github.com/helyux/cs2inspect/blob/master/docs/example_usage.md Parses a Steam CS2 item link (unmasked or masked) and returns a dictionary of item properties. Enrichment can be enabled by setting enrich=True or providing a path to a schema file. ```APIDOC ## cs2inspect.parse(link, enrich=False, schema=None) ### Description Parses a provided Steam item link string. Returns a dictionary containing item details such as asset IDs, defindex, and float values. ### Parameters - **link** (str) - Required - The steam:// link to parse. - **enrich** (bool) - Optional - Whether to resolve numeric IDs to human-readable names using a local schema file. Defaults to False. - **schema** (str) - Optional - Path to a custom JSON schema file. Providing this automatically enables enrichment. ### Returns - **dict** - A dictionary containing the parsed item data. ``` -------------------------------- ### Enrich Schema Data Source: https://github.com/helyux/cs2inspect/blob/master/README.md Download external schema files to resolve numeric IDs into human-readable names. ```python import cs2inspect # Resolve IDs to names using an external schema cs2inspect.download_schema() info = cs2inspect.parse(link, enrich=True) print(info['full_item_name']) # StatTrak™ PP-Bizon | High Roller (Factory New) ``` -------------------------------- ### Parse Inspect Links Source: https://github.com/helyux/cs2inspect/blob/master/README.md Decode a masked inspect link into a dictionary containing item attributes. ```python import cs2inspect # Parse a modern 'masked' inspect link link = "steam://run/730//+csgo_econ_action_preview%206A7AC7C6BEDED06B72704ACE6F426F5A635296868780692AAC6C226A3A6A02E9EAEAEA661A625E7EE646" data = cs2inspect.parse(link) print(data['defindex']) # 26 (PP-Bizon) print(data['floatvalue']) # 0.05357979 ``` -------------------------------- ### CS2 Item Inspection JSON Schema Source: https://github.com/helyux/cs2inspect/blob/master/docs/example_usage.md Represents the structure of item data including stickers, keychains, and weapon attributes. ```json { "name": "Sticker | Team Spirit (Gold) | Copenhagen 2024", "imageurl": "https://community.akamai.steamstatic.com/economy/image/i0CoZ81Ui0m-9KwlBY1L_18myuGuq1wfhWSaZgMttyVfPaERSR0Wqmu7LAocGJai0ki7VeTHjMmxPSnHtwI655f9-GbgThH10MGw-HIKv6T6baFucfPFC2KUkO905uRvGnrllkp-5TjQzo6qJH6XPFM-SswnKK8h7Zw", "collection_name": "Copenhagen 2024 Legends Sticker Capsule", "wear": 0.5699999928474426, "offset_x": 0.1969793736934662, "offset_y": 0.08180040121078491 }, { "slot": 2, "sticker_id": 7313, "codename": "cph2024_team_gl_gold", "material": "econ/stickers/cph2024/gl_gold", "name": "Sticker | GamerLegion (Gold) | Copenhagen 2024", "imageurl": "https://community.akamai.steamstatic.com/economy/image/i0CoZ81Ui0m-9KwlBY1L_18myuGuq1wfhWSaZgMttyVfPaERSR0Wqmu7LAocGJai0ki7VeTHjMmxPSnHtwI684vL7VbrRVP1x5K1rHoOu6P-PPY6JfHKXTLEmOovs-M4S3HjkElz5DuBydmsJXuVcEZ-XYJJFe58", "collection_name": "Copenhagen 2024 Challengers Sticker Capsule", "wear": 0.5699999928474426, "offset_x": 0.14772814512252808, "offset_y": -0.004513293504714966 } ], "keychains": [ { "slot": 0, "sticker_id": 47, "codename": "kc_missinglink_lilhothead", "material": "econ/keychains/missinglink_community_01/kc_missinglink_lilhothead", "name": "Charm | Magmatude", "imageurl": "https://community.akamai.steamstatic.com/economy/image/i0CoZ81Ui0m-9KwlBY1L_18myuGuq1wfhWSaZgMttyVfPaERSR0Wqmu7LAocGI6zwki4Uf_a0IWsPGiE7Fhy-I764WbkThD8i5jp6Ttkv6PhY6dSLfmAHW6exuJ_vupWQyC_nRIzuziEnsGgJymSZwd0CZpyQu5buxO9wNbmPrzm5wCLg95Fmyz_3y1Nuydq4OZXT-N7raqdv_up", "collection_name": "Missing Link Community Charm Collection", "wear": 0.0, "offset_x": 9.838349342346191, "offset_y": 0.5787375569343567, "offset_z": 4.179599285125732, "pattern": 17027 } ], "floatvalue": 0.11404433846473694, "wear_name": "Minimal Wear", "rarity_name": "Restricted", "origin_name": "Found in Crate", "quality_name": "StatTrak™", "weapon_type": "AK-47", "item_name": "Slate", "imageurl": "https://community.akamai.steamstatic.com/economy/image/i0CoZ81Ui0m-9KwlBY1L_18myuGuq1wfhWSaZgMttyVfPaERSR0Wqmu7LAocGIGz3UqlXOLrxM-vMGmW8VNxu5Dx60noTyLwlcK3wiVI0POlPPNSMOKcCGKD0ud5vuBlcCW6khUz_W3Sytb4cCqTOFUpWJtzTOUD5hPsw9a0Yrnrs1SK3ooXzy6shilM5311o7FVYrIufmI", "min": 0, "max": 1, "collection_name": "The Snakebite Collection", "full_item_name": "StatTrak™ AK-47 | Slate (Minimal Wear)" } ``` -------------------------------- ### cs2inspect.unlink(link) Source: https://github.com/helyux/cs2inspect/blob/master/docs/example_usage.md Extracts the raw protobuf data block from a masked CS2 item link. ```APIDOC ## cs2inspect.unlink(link) ### Description Decodes the masked link to retrieve the underlying raw protobuf data structure. ### Parameters - **link** (str) - Required - The masked steam:// link. ### Returns - **object** - The raw protobuf data object. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.