From Jujunie Wiki
Jump to: navigation, search

I created this fast-and-ugly little java program to get images from Picassa

import org.xml.sax.*;
import org.xml.sax.helpers.*;

public class PicassaRSS2File extends DefaultHandler{

   private int index = 0;

   public static void main(String[] args) throws Exception {
       XMLReader saxReader = XMLReaderFactory.createXMLReader();
       saxReader.setContentHandler(new PicassaRSS2File());
   public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException {
       if (localName == "enclosure") {
           System.out.println("wget -O img" + this.index + ".jpg \"" + atts.getValue("url") + "\"");

Usage (the URL is the RSS feed's one):

java -cp . PicassaRSS2File "https://picasaweb.google.com/data/feed/base/user/xxx..." > go.sh
chmod +x go.sh

Perhaps I'll enhance it to directly download the images using Commons VFS