-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsteamgames.html
More file actions
76 lines (72 loc) · 1.97 KB
/
steamgames.html
File metadata and controls
76 lines (72 loc) · 1.97 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<style>
a.export, a.export:visited {
text-decoration: none;
color:#000;
background-color:#ddd;
border: 1px solid #ccc;
padding:8px;
}
dl {
border: 3px double #ccc;
padding: 0.5em;
}
dt {
float: left;
clear: left;
width: 140px;
text-align: right;
font-weight: bold;
color: green;
}
dt:after {
content: ":";
}
dd {
margin: 0 0 0 150px;
padding: 0 0 0.5em 0;
}
</style>
<dl>
<dt>
Steam ID
</dt>
<dd>
<input type='text' style='width: 300px' id='steamid' value='' /></dd>
<dt>
WebAPI Key
</dt>
<dd>
<input type='text' style='width: 300px' id='webkey' value='' />
</dd>
</dl>
<P>
<a href='#' class='export'>Export</a>
</P>
<script src='http://code.jquery.com/jquery-2.1.1.min.js' type='text/javascript'></script>
<script type='text/javascript'>
$(document).ready(function () {
function exportSteamToCSV(filename) {
var url = "http://api.steampowered.com/IPlayerService/GetOwnedGames/v0001/?key=" + $('#webkey').val() + "&steamid=" + $('#steamid').val() + "&format=json&include_appinfo=1";
$.get(url, function(data) {
colDelim = '","';
rowDelim = '"\r\n"';
csv = '"Name","Playtime","Store' + rowDelim;
$.each(data.response.games, function(index, value) {
url = "http://store.steampowered.com/app/" + value.appid;
csv += value.name + colDelim + value.playtime_forever + colDelim + url + rowDelim;
});
csv += '"';
csvData = 'data:application/csv;charset=utf-8,' + encodeURIComponent(csv);
var link = document.createElement("a");
link.download = filename;
link.href = csvData;
link.target = "_blank";
link.click();
});
};
$(".export").on('click', function (event) {
// CSV
exportSteamToCSV.apply(this, ['steamgames.csv']);
});
});
</script>