-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsteamscraper.py
More file actions
executable file
·31 lines (25 loc) · 922 Bytes
/
steamscraper.py
File metadata and controls
executable file
·31 lines (25 loc) · 922 Bytes
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
#! /usr/bin/env python2
import argparse
import urllib
import os
from steamapiwrapper.SteamGames import Games
appid = -1
def main():
steamapi = Games()
_parse_args()
for game in steamapi.get_info_for(appid, "us"):
if not os.path.exists(game.name):
os.makedirs(game.name)
for screenshot in game.raw_json['screenshots']:
_download_image(screenshot['path_full'], os.path.join(game.name, str(screenshot['id'])))
_download_image(game.header_image, game.name)
def _download_image(url, name):
urllib.urlretrieve(url, name + ".jpg")
def _parse_args():
global appid
parser = argparse.ArgumentParser(description="Grabs Steam screenshots for a specific game")
parser.add_argument("appid", type=int, nargs=1, help="Steam appid to grab default screenshots for")
args = parser.parse_args()
appid = args.appid
if __name__ == "__main__":
main()