Skip to content
This repository was archived by the owner on May 30, 2022. It is now read-only.

Commit d596304

Browse files
authored
Merge pull request #3 from nguyenvancaokyfpt/main
fix the api endpoint
2 parents 0a1c116 + 37e06f8 commit d596304

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
⚠️ 6/11/2021 - doesn't work any more. This repo is no longer maintained, see this [issue](https://github.com/SegoCode/swd/issues/2)
2-
31
# swd
42
<img src="https://raw.githubusercontent.com/SegoCode/swd/main/media/demo1.1.gif">
53

swd.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const INFO = 1
2121
const WARNING = 2
2222
const ERR = 3
2323

24-
const ENDPOINT string = "https://node02.steamworkshopdownloader.io/prod//api/"
24+
const ENDPOINT string = "https://node05.steamworkshopdownloader.io/prod//api/"
2525

2626
func logger(text string, errorlevel int) {
2727

@@ -103,7 +103,7 @@ func main() {
103103
request := gorequest.New()
104104
resp, body, _ := request.Post(ENDPOINT+"download/request").
105105
Set("Content-Type", "application/json").
106-
Send(`{"publishedFileId":` + idUrl + `, "collectionId":0, "extract":true, "hidden":false, "direct":false, "autodownload":true}`).
106+
Send(`{"publishedFileId":` + idUrl + `, "collectionId":null, "hidden":false, "downloadFormat":"raw", "autodownload":true}`).
107107
End()
108108

109109
if resp.StatusCode != 200 {
@@ -115,7 +115,8 @@ func main() {
115115
// Download request //
116116
uid := gjson.Get(body, "uuid").String()
117117
var readyFile = false
118-
118+
var storageNode = ""
119+
var storagepath = ""
119120
for i := 0; i < 10; i++ { // Try 10 times for 2 seconds of waiting, total 20 seconds of preparation maximum
120121
_, body, _ := request.Post(ENDPOINT+"download/status").
121122
Set("Content-Type", "application/json").
@@ -126,6 +127,8 @@ func main() {
126127

127128
if strings.Contains(body, "prepared") {
128129
readyFile = true
130+
storageNode = gjson.Get(body, uid+".storageNode").String()
131+
storagepath = gjson.Get(body, uid+".storagePath").String()
129132
logger("INITIATING DOWNLOADING. . . ", INFO)
130133
break
131134
}
@@ -135,7 +138,7 @@ func main() {
135138
// File ready, start download //
136139
if readyFile {
137140
dir, _ := os.Getwd()
138-
err := DownloadFile(ENDPOINT+"download/transmit?uuid="+uid, dir+string(os.PathSeparator)+idUrl+".zip")
141+
err := DownloadFile("https://"+storageNode+"/prod//storage/"+storagepath+"?uuid="+uid, dir+string(os.PathSeparator)+idUrl+".zip")
139142

140143
if err != nil {
141144
panic(err)

0 commit comments

Comments
 (0)