Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- import sys
- import os
- import urllib.request
- import json
- from urllib.parse import quote
- URL='http://steamcommunity.com/inventory/'
- PRICES_URL='http://steamcommunity.com/market/priceoverview/?currency=3&appid='
- INV='76561197983160958'
- APPID='578080'
- LANG='2?l=english'
- # DEfault 5000
- COUNT='5000'
- items = { }
- #URL zum Inventory
- inventory_url = urllib.request.urlopen(URL + '/' + INV + '/' + APPID + '/' + LANG + '/' + COUNT)
- inventory_url_data = inventory_url.read()
- encoding = inventory_url.info().get_content_charset('utf-8')
- inventory_json = json.loads(inventory_url_data.decode(encoding))
- total_inventory_count = inventory_json['total_inventory_count']
- print ( "Du hast %s Items am Start" % (total_inventory_count))
- #len (inventory_json["descriptions"])
- i = 0
- while i < (len (inventory_json["descriptions"])):
- count = [ ]
- items.update(inventory_json["descriptions"][i])
- itemname = items["market_hash_name"]
- print ( itemname )
- encoded_itemname = quote(itemname)
- try:
- prices_url = urllib.request.urlopen(PRICES_URL + APPID + '&market_hash_name=' + encoded_itemname)
- prices_url_data = prices_url.read()
- encoding = prices_url.info().get_content_charset('utf-8')
- prices_json = json.loads(prices_url_data.decode(encoding))
- # print ( prices_json["median_price"] )
- except urllib.error.HTTPError:
- pass
- classid = items["classid"]
- #print ( classid )
- a = 0
- while a < (len(inventory_json["assets"])):
- if (inventory_json["assets"][a]["classid"] == classid):
- count.append(classid)
- #print ( classid )
- a += 1
- else:
- a += 1
- try:
- print ( prices_json["median_price"] )
- del prices_json
- except NameError:
- pass
- print (len(count))
- i += 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement