While I don't really believe all the "LJ is going to close" drama brought about by yesterday's sudden layoffs (I do feel for those laid off with such lack of notice or severance, though - my thoughts go out to you all!) (if you have no idea what I'm talking about, check out this post, which lays it out quite well), I did realize it would definitely be prudent to back up my LJ and Scrapbook files, which I have been quite remiss in doing to date. LJ entry backup is quite well documented at these links:
However, Scrapbook backup is poorly documented (if at all, really). The best resource I've come across is this entry in
lj_dev, which has solutions that basically don't work. So I took it upon myself to fix this situation. :)
The basic problem with the Perl client is that it was never updated to deal with LJ's split-authentication system after there were some security problems that prompted changes a long while back. Thanks to the wonders of the WWW::Mechanize Perl module, I believe I've fixed that client so that it works perfectly fine, and so, I present to you:
- Tim's updated version of fotoup.pl
- MD5 checksum: abeedb22e0937ab0f4d9da62347993e3
- SHA1 checksum: 188f0506ed8be5dbb4b7ed833dfa6a2599bffeba
I will try to keep this entry up-to-date with the latest checksums if I make any further changes - if you download a version with any other checksums, it may not be the most up-to-date. This client is intended for people who are somewhat technical, and have Perl installed on their systems. You'll probably also need to be able to install Perl modules. I apologize, I don't have time to write up detailed instructions on any of that right now. Once you have those bits done, though, all you need to do is create a ".fotoup.conf" file with your configuration in it. The minimum configuration looks like:
server: pics.livejournal.com username: your LJ username password: your LJ password backupdir: a directory on your system that you want to back up to
That file should be in your UNIX home directory. If you're on Windows, I'm not sure on the correct location, sorry. Now just run "./fotoup.pl --backup", and wait. You should get output that looks something like this:
$ ./fotoup.pl --backup To upload: 0 from data, 0 from receipt Fetching export.xml from server... Total pictures: 3563 Already backed up: 0 Pictures to backup: 3563 Bytes to fetch over network: 4889620910 Fetching image 1/3563 ... 0.1% Fetching image 2/3563 ... 0.1% Fetching image 3/3563 ... 0.2% Fetching image 4/3563 ... 0.3% Fetching image 5/3563 ... 0.3% ...
Sometimes you will see an "MD5 of downloaded file doesn't match, retrying." error - don't panic, the server just probably had a hiccup - the script will automatically retry once before failing fatally. If it does fail again, you can re-start and you won't lose all the files you already downloaded - just run the exact same command again. It'll then look something like this:
$ ./fotoup.pl --backup To upload: 0 from data, 0 from receipt Fetching export.xml from server... Total pictures: 3563 Already backed up: 5 Pictures to backup: 3558 Bytes to fetch over network: 4874557302 Fetching image 1/3558 ... 0.1% Fetching image 2/3558 ... 0.1% Fetching image 3/3558 ... 0.2% Fetching image 4/3558 ... 0.2% Fetching image 5/3558 ... 0.2% ...
Note the "Already backed up" number. I added the re-try functionality because I was seeing this error quite often, hopefully it won't occur twice in a row very often, so you shouldn't have to restart repeatedly, but you might want to keep an eye on things anyway, and re-start if necessary.
I'm sorry these instructions aren't more non-geek-friendly. Please feel free to play around and write up better instructions if you'd like. If you want to link to the updated version of the client, please consider linking to this entry so ensure that the MD5/SHA1 checksums are included as well. Feel free to put links to your instructions in the comments here as well, so that others can also benefit from them. Thanks!
Edit 2009-01-08 08:37 EST: Updated fotoup.pl on the server, new MD5/SHA1 sums: abeedb22e0937ab0f4d9da62347993e3/188f050
- Mood:
accomplished

Comments
Fetching image 13/2782 ... MD5 of downloaded file doesn't match, retrying.
Fetching image 13/2782 ... 0.7%
... (continues with more files)
or something like this:
Fetching image 13/2782 ... MD5 of downloaded file doesn't match, retrying.
Fetching image 13/2782 ... MD5 of downloaded file doesn't match.
(script stops running)
(Obviously the numbers would be different, but hopefully you get the idea.)
BTW I am running XP with active perl.
Edited at 2009-01-08 04:11 am (UTC)
Bytes to fetch over network: 98117639
Fetching image 1/639 ... Error GETing http://pics.livejournal.com/bychoice/pi
Now, it is true that this file doesn't exist. Any chance we can get some code to skip over errors or otherwise deal with them? I don't see any way to get around this on my end. Help would be appreciated.
I get the MD5 error immediately and every time. I'm inclined to fire up Linux and try it there and/or wait until the backup panic of '09 dies down a bit.
EDIT: It turns out that if I just print out the second MD5 check instead of dieing, the files are all downloaded OK. I'm not a good enough perl hacker to see why the hash check is actually failing though.
Edited at 2009-01-07 11:07 pm (UTC)
$md5 contained 8b3e2ec3465e9ea696e8a5d9ecb171a2
$p->{'md5'} and the actual downloaded file's MD5 was cb07cff00b99073c8c038b5f219f74d5
perl -v says the active state version is the one in use.
(I got the same md5 issue after renaming the cygwin dir just now)
All three of the photos I downloaded failed the MD5 check.
cb07cff00b99073c8c038b5f219f74d5
http://pics.livejournal.com/leprosy/p
fe499e186e4ef9b5b0bfe0fbb3214bda
http://pics.livejournal.com/leprosy/p
3da731b9b2875af3e7bea014954bc385
http://pics.livejournal.com/leprosy/p
It's actually not a big deal for me, but we're looking into your code to give some nervous deadjournal users an easier way to get their stuff backed up.
Great work,
$ bin/fotoup.pl-krellis --backup
Can't locate WWW/Mechanize.pm in @INC (@INC contains: /Library/Perl/Updates/5.8.8 /System/Library/Perl/5.8.8/darwin-thread-m
BEGIN failed--compilation aborted at bin/fotoup.pl-krellis line 22.
# sudo -H /usr/bin/cpan -i WWW::Mechanize
cpan comes with the XCode development package.