orhun / CoolModFiles

A web player that plays some cool MOD files randomly 🎶
https://CoolModFiles.com
GNU General Public License v3.0
131 stars 12 forks source link

Download all favorited mods at once #26

Closed WKFO closed 2 years ago

WKFO commented 2 years ago

Preferably via a button in the expanding "Favorite Mods" section.

orhun commented 2 years ago

I think there isn't an easy way of doing this in the browser since "downloading" basically means redirecting to https://api.modarchive.org/downloads.php?moduleid=<id>. One possible solution is spawning a million tabs to download each liked mod but that's suboptimal. In this case I'd suggest downloading coolmods.json by clicking on the "Favorite Mods" text and then downloading the files by running a command like this:

cat coolmods.json | jq '.[].id' | xargs -I {} curl -O -J "https://api.modarchive.org/downloads.php?moduleid={}"

@bufgix any thoughts?

bufgix commented 2 years ago

I think we can download with fetch without open new tabs. if we don't get stuck with CORS errors, we can do this.

orhun commented 2 years ago

I think we can download with fetch without open new tabs. if we don't get stuck with CORS errors, we can do this.

Cool! I have never heard of fetch before. Can you implement this?

bufgix commented 2 years ago

I think we can download with fetch without open new tabs. if we don't get stuck with CORS errors, we can do this.

Cool! I have never heard of fetch before. Can you implement this?

Sure