Skip to content

Instantly share code, notes, and snippets.

@MCOfficer
Last active October 27, 2024 18:24
Show Gist options
  • Save MCOfficer/d1000c2b70311bcc4e246375a3b18e77 to your computer and use it in GitHub Desktop.
Save MCOfficer/d1000c2b70311bcc4e246375a3b18e77 to your computer and use it in GitHub Desktop.
Bash script to download files from gofile.io
#!/bin/bash
id=`sed -E 's/.*gofile.io\/d\/(\w*?)/\1/' <<< $1`
echo "Downloading $id"
server=`curl -s https://apiv2.gofile.io/getServer?c=$id | jq -r '.data.server'`
files=`curl -s https://$server.gofile.io/getUpload?c=$id | jq '.data.files'`
for key in `jq 'keys | .[]' <<< $files`; do
file=`jq ".[$key]" <<< $files`
url=`jq -r '.link' <<< $file`
name=`jq -r '.name' <<< $file`
echo
echo "Downloading $name"
curl $url -o "$name"
done
echo
echo
echo "Note: gofile.io is entirely free with no ads,"
echo "you can support it at https://gofile.io/donate"
@DarrenPIngram
Copy link

Forgive the possibly "bone" question, but where/how do you feed in the URL(s), e.g. https://gofile.io/d/d3SYfM

@MCOfficer
Copy link
Author

As first parameter, f.e. ./download_gofile.sh https://gofile.io/d/d3SYfM.

However, it seems gofile changed their API, so until i update it this script wont work.

@DarrenPIngram
Copy link

DarrenPIngram commented Feb 26, 2022 via email

@MCOfficer
Copy link
Author

I do - If i have time and interest. I'll ping you if it happens.

@DarrenPIngram
Copy link

DarrenPIngram commented Feb 26, 2022 via email

@shawnli87
Copy link

@MCOfficer I forked your script and tweaked it to work with the new API. I also created another script based in zsh with a bit of error checking which works with password enabled files. @DarrenPIngram

@MCOfficer
Copy link
Author

@MCOfficer I forked your script and tweaked it to work with the new API. I also created another script based in zsh with a bit of error checking which works with password enabled files. @DarrenPIngram

Feel free to link it here

@shawnli87
Copy link

@MCOfficer I forked your script and tweaked it to work with the new API. I also created another script based in zsh with a bit of error checking which works with password enabled files. @DarrenPIngram

Feel free to link it here

Forked script: https://gist.github.com/shawnli87/d416b7c9030293cabfcf4c225cdc5a15
Zsh script: https://gist.github.com/shawnli87/49122dcc5cf2a65fe4580888347a7946

@DarrenPIngram
Copy link

Thank you for flagging the new version. I will give it a go. Now, if you love writing these, there's workcloud that a few people use that could be nice to have a similar tool (wink)!

@shawnli87
Copy link

Thank you for flagging the new version. I will give it a go. Now, if you love writing these, there's workcloud that a few people use that could be nice to have a similar tool (wink)!

I'm not familiar with Workload, but if you drop a link I could take at it.

@DarrenPIngram
Copy link

I'm not familiar with Workload, but if you drop a link I could take at it.
Sorry, I mangled the name from memory. Here's a link to workupload (links can have one file, or as in this case separate files or an "archive". I don't use it myself for originating, but I see many do.

https://workupload.com/archive/7V3z6mrq

@shawnli87
Copy link

I'm not familiar with Workload, but if you drop a link I could take at it.
Sorry, I mangled the name from memory. Here's a link to workupload (links can have one file, or as in this case separate files or an "archive". I don't use it myself for originating, but I see many do.

https://workupload.com/archive/7V3z6mrq

Try this out https://gist.github.com/shawnli87/f226b4f0c7b2bef2e94477ccef00b0c8

@eggplants
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment