boing
This commit is contained in:
parent
bf532102f2
commit
14a8b9acba
1 changed files with 5 additions and 2 deletions
7
index.js
7
index.js
|
@ -24,14 +24,14 @@ var startTime = Date.now()
|
||||||
var prevGame = ""
|
var prevGame = ""
|
||||||
|
|
||||||
function update() {
|
function update() {
|
||||||
fetch(`https://steamcommunity.com/miniprofile/${steamID}?origin=https%3A%2F%2Fsteamcommunity.com`)
|
fetch(`https://steamcommunity.com/miniprofile/${steamID}`)
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
return data.text()
|
return data.text()
|
||||||
})
|
})
|
||||||
.then((html) => {
|
.then((html) => {
|
||||||
var json = {
|
var json = {
|
||||||
"name": "nothing",
|
"name": "nothing",
|
||||||
"presence": ""
|
"presence": "Offline"
|
||||||
}
|
}
|
||||||
|
|
||||||
if (html.includes("game_name")) {
|
if (html.includes("game_name")) {
|
||||||
|
@ -42,6 +42,9 @@ function update() {
|
||||||
if (html.includes("presence")) {
|
if (html.includes("presence")) {
|
||||||
var blah = html.substring(html.indexOf('presence">') + 10, html.length)
|
var blah = html.substring(html.indexOf('presence">') + 10, html.length)
|
||||||
json["presence"] = blah.substring(0, blah.indexOf("</span>"))
|
json["presence"] = blah.substring(0, blah.indexOf("</span>"))
|
||||||
|
} else if (html.includes("friend_status_online") && json.name != "nothing") {
|
||||||
|
var blah = html.substring(html.indexOf('status_online">') + 15, html.length)
|
||||||
|
json["presence"] = blah.substring(0, blah.indexOf("</span>"))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prevGame != json.name) {
|
if (prevGame != json.name) {
|
||||||
|
|
Loading…
Reference in a new issue