It seems that you're using an outdated browser. Some things may not work as they should (or don't work at all).
We suggest you upgrade newer and better browser like: Chrome, Firefox, Internet Explorer or Opera

×
gog-backup performs an unattended batch download of everything you've purchased from GOG.com, both game installers and available extras. When you make an additional purchase, just run it again to download only the new files necessary to make your backup complete.

Features include:
- Perform multiple transfers in parallel
- Resume partial downloads (including those of other tools)
- Verify games using GOG.com's XML metadata
- Verify extras using .ZIP internal checksums
- Repair corrupted installers, re-downloading only affected chunks
- Configurable download directory hierarchy
- Download cover art and thumbnails (optional)
- Has documentation

gog-backup is open source, written in Python, and licensed under GPLv3+. I use it on Linux, but it doesn't contain any platform-specific code or assumptions and should run on any O/S. Its only external dependency (besides Python) is html5lib, a pure-Python module you can just drop in the same directory as the script.

It's not the only unofficial downloader; you can find a comparison of it and the others I know about here.
feel free to add yours to this list:
http://gogwiki.com/index.php?title=Download_Clients
Does it redownload installers if GOG has updated them? (Since the checksum for the local file would no longer be valid)

EDIT: wait, reading comprehension fail
avatar
epowers: - Repair corrupted installers, re-downloading only affected chunks
Post edited January 07, 2012 by Miaghstir
Seems pretty nice....

As a feature request if you have time (if not I'll code something with a pull request in a few weeks) could an option for downloading only a given game (as an argument etc) be added?
Pretty awesome.

Way better than mine (which is reliant on a local DB for integrity checks and doesn't download from GOG).

2 suggestions though:

1) Make a music uploaded that unzips the soundtrack in the right directory (I can provide code for it if you like, there is a tricky part when unzipping zip files containing accents)

2) If you have access to a Windows machine, use py2exe to compile a Windows binary. Many Windows users don't have Python and shouldn't have to care about it.
Post edited January 07, 2012 by Magnitus
avatar
epowers: <snip>
I'm failing to fetch a manifest.
H:\GOG>C:\Python27\python.exe gog-backup manifest
> https://www.gog.com/en/myaccount/list [200]
Traceback (most recent call last):
File "gog-backup.py", line 485, in <module>
sys.exit(main(sys.argv[1:]))
File "gog-backup.py", line 467, in main
globals()['cmd_' + args[0]](*args[1:])
File "gog-backup.py", line 239, in cmd_manifest
g.key = gamecard.attrib['href'].split('/')[-1]
AttributeError: 'NoneType' object has no attribute 'attrib'
I'm just n00bing my way around, so I don't know whether I did something wrong.
Post edited January 07, 2012 by LBartley
I'm getting the same error as LBartley. Had to rename gog-backup to gog-backup.py in order to do anything but it doesn't see to be able to find anything, though it is able to log in without any errors. I added htmllib5's /src folder into the same directory but didn't run its "setup.py install" command. All that does is put the contents of /src into /build though, so I don't think I need to do that.
It's working great on my end. You have to rename the script to add the extension of course. Also download html5lib, open the archive and extract directory "html5lib" from "html5lib-0.90\src" in the gog-backup directory.
Don't keep the "src" in the path.

Is it possible to add an optional path for the extras though? I keep all the extras in an additional directory inside the root of each game to be a little bit tidier. I tried to make this change myself, but I have no experience whatsoever in python and, although the code is clear and well written, I get lost trying to figure out the syntax.

In any case, thank you very much for the effort.
Using Windows Vista 32-bit. I'm logged in and the manifest is running.

I get this error:
> http://www.gog.com/en/download/file/empire_earth_gold_edition/517 [206]
> Traceback (most recent call last):
File "gog-backup.py", line 485, in <module>
sys.exit(main(sys.argv[1:]))
File "gog-backup.py", line 467, in main
globals()['cmd_' + args[0]](*args[1:])
File "gog-backup.py", line 270, in cmd_manifest
with request(f.href, range=(0, 0)) as page:
File "gog-backup.py", line 89, in request
print '>', url,
File "C:\Python27\lib\encodings\cp437.py", line 12, in encode
return codecs.charmap_encode(input,errors,encoding_map)
UnicodeEncodeError: 'charmap' codec can't encode character u'\u2019' in position 40: character maps to <undefined>

Update #1: Neither 'compare' nor 'fetch' nor 'update' recognize games in my account page that are not on my computer. The program thinks that I have downloaded everything when I definitely have not.

Update #2: Installing Python 2.6.4 didn't solve the problem. It still fails at the same place with the same error message. It looks your Unicode handling needs some work, or the standard Python libraries have a problem with U-2019, whatever character that is.
Post edited February 04, 2012 by HGiles
All, I've pushed fixes for several bugs up to GitHub (some manifest corner cases and Windows fixes). Please consider upgrading.
avatar
CptPicardi: I'm getting the same error as LBartley.
...
I added htmllib5's /src folder into the same directory but didn't run its "setup.py install" command.
With LBartley's help, I've fixed his initial problem (he now has a different one related to UTF-8), so you may find the latest version fixes that.

Yep; running setup.py isn't necessary.
avatar
AndyBuzz: It's working great on my end.
...
Is it possible to add an optional path for the extras though? I keep all the extras in an additional directory inside the root of each game to be a little bit tidier.
Great! I'm glad to hear it's working well for you.

I should be able to add that feature pretty easily; I'll see what I can do. If you want to get a working familiarity with Python, may I recommend the Tutorial section of the documentation? I found it was actually pretty good back when I was first learning.
Post edited February 06, 2012 by epowers
avatar
HGiles: UnicodeEncodeError: 'charmap' codec can't encode character u'\u2019' in position 40: character maps to <undefined>
Yeah; LBartley ran into the same issue once I fixed his first one. Upgrade gog-backup to the lastest version on the master branch, then run it manually from a command prompt using the following two commands:

set PYTHONIOENCODING=ascii:backslashreplace
\Python27\python.exe gog-backup manifest
(Replace Python27 with your Python installation path.)

Please let me know if this works--it didn't for him, but his failure was in the HTML scraping code, not the "progress" messages, so I'm hoping it will for you. (I'll provide a proper fix later.)
avatar
HGiles: Update #1: Neither 'compare' nor 'fetch' nor 'update' recognize games in my account page that are not on my computer.
Those commands work off the cached manifest information, and the above exception would prevent a successful manifest update. Does that explanation agree with the behaviour you see?
avatar
HGiles: It looks your Unicode handling needs some work, or the standard Python libraries have a problem with U-2019, whatever character that is.
Yeah, UTF-8 is causing me lots of problems on Windows. U-2019 is the right-single-quote character ('), apparently.

It should be easy to fix if I can just reproduce the failure--and I'm having much more trouble with that than you'd expect.
This looks like a great downloader. I'll try it out next time I buy a game. I love the way you documented it so well.

I honestly had no idea about GOG's metadata xml files - I've been wanting such a thing for ages. How long have those existed?
avatar
Barefoot_Monkey: How long have those existed?
Since the new downloader was released I believe. Or just before at least, since the infrastructure needed to be in place before the release. I believe the old AIR downloader worked quite differently and didn't use them.
avatar
epowers: ..snip..

Yeah, UTF-8 is causing me lots of problems on Windows. U-2019 is the right-single-quote character ('), apparently.

It should be easy to fix if I can just reproduce the failure--and I'm having much more trouble with that than you'd expect.
Followed your instructions, it doesn't seem to have helped. I call a manifest and get the below error. Similar error in a slightly different place, so it did do something.

> http://www.gog.com/en/download/file/sanitarium/652 [206]
> Traceback (most recent call last):
File "gog-backup.py", line 495, in <module>
sys.exit(main(sys.argv[1:]))
File "gog-backup.py", line 477, in main
globals()['cmd_' + args[0]](*args[1:])
File "gog-backup.py", line 280, in cmd_manifest
with request(f.href, range=(0, 0)) as page:
File "gog-backup.py", line 91, in request
print '>', url,
File "C:\Python27\lib\encodings\cp437.py", line 12, in encode
return codecs.charmap_encode(input,errors,encoding_map)
UnicodeEncodeError: 'charmap' codec can't encode character u'\u2019' in position 40: character maps to <undefined>

Yeah, cross-platform coding is a lot harder than most people expect, even in languages that are technically cross-platform. That's one reason I like Visual Studio, which makes it a lot easier to compile cross-platform. There's even an open-source MSBuild add-in to compile Android native code in VS 2010, which makes me want to actually learn C++. Now if only Visual Studio worked with Python... :)
Just the update itself solved my problem. Thanks for letting me know there was even an update available or I'd never know! Currently downloading all my extras!