9. 8. 2014

How to download all original photos from Picasa web

Simple situation: our friend family sent us URL to their photoalbum at Google Picasa and I was going to download it. Single photo can be downloaded from its detail page but AFAIK there is not direct way how to download whole album from browser. I know there is a Picasa client. Nevertheless, I don't like making my Program Files dirty of any programs which are not really necessary and rather prefer solutions where only browser is sufficient.

Since this approach was successful in case of similar Czech site rajce.net (EDIT 2020-09-12: original script got obsolete and was replaced, see following message and tweet), I tried to find similar advice. There are many cookbooks on the web but unfortunately, it would be time-consuming to check them all. I made couple of attempts and observe that either they are obsolete and don't work (as Google is probably changing it's API) or they download only small-sized image (full-sized image is available only in Flash panel where image URL cannot be easily discovered).


I came to final solution combining following 2 advices (URLs are intentionally made invalid for the sake of privacy):
  • showing RSS link as advised here produces simple page with only small-sized images with URL like https://lh3.googleusercontent.com/-W7d8yk40s8o/U5qi9sQyUKI/AAAAAAAAD6A/R4Tz5yC_03z/s288/IMG_1042.jpg
  • intercepting network communication in Firebug after clicking Download on photo detail shows that original image has very similar URL: https://lh3.googleusercontent.com/-W7d8yk40s8o/U5qi9sQyUKI/AAAAAAAAD6A/R4Tz5yC_03z/d/IMG_1042.jpg 
Hence the procedure is really simple if you have Firebug:
  1. Open album and click on RSS.
  2. Show Firebug console. 
  3. Copypaste following code into Firebug console:
    for (var i = 0; i < document.images.length; i++) document.images[i].src = document.images[i].src.replace(/\/s288\//,"/d/");
    
    This replaces images by original versions.
  4. Save complete page as foo.xht.
  5. Your images are in subdirectory foo_files. (remove unnecessary HTML, CSS, JS, title image and other stuff)

For completeness - scripts for other sites:

rajce:

$("#thumbs-container .thumb-img").each(function () {var a = $(this).css('background-image'); a = a.replace(/url\("(.*)"\)/g,'$1').replace(/\/thumb\//g,'/images/'); $(document.body).append("<img src='" + a + "' />");})
UPDATE: 
$("#thumbs-container .thumb-img").each(function () {var a = $(this).attr('src'); a = a.replace(/url\("(.*)"\)/g,'$1').replace(/\/thumb\//g,'/images/'); $(this).attr('src',a);}) 
clovekavira.cz:
Array.from(document.getElementsByClassName("grid-item")).forEach(function(element, index, array) {var img = element.firstChild.firstChild; var s = img.src.replace(/\/500x180\//,'/1920x1080/'); var nimg = document.createElement('img'); nimg.src = s; document.body.appendChild(nimg); }); document.getElementById('block-cav-content').remove();