Really getting started with the New Blogger Beta using Java
So yesterday I found that mtsend.py does not publish with Googles New Blogger. Why I need that facility is not that ECTO has anything lacking, but I DO have some diaries to load which have several hundred pages.
I have uploaded them as bare HTML’s through FTP, but would like to publish them on Blogger. So I needed a command line tool for that.
And so i went to Blogger Data API Developer’s Guide. The Java client was not downloading despite many attempts, and i wanted to avoid the blessed thing, anyway. They have some suggestions for doing it directly through HTTP POSTS and i really really struggled for hours with that with NO idea about these ways. I used CURL for that.
I managed to get authorized, and get an AUTH ID back, but when i would try to post nothing would happen. I closed shop at 3 am. Today morning i got the Java client downloaded but I don’t think they have any programs you can just start using straight off the bat.
So finally by evening, i have a bunch of Java programs ready to:
- Get a listing of blogs given a user and password
- To get a Feed of a blog given the Blog URL
- To post to a blog either a file, or data from the command line
- To update an entry given an EDIT URL and a file or data on command line
- To delete an entry given an EDIT URL
The post program sends only one post, but it is written such that the class can be instantiated once by another program, and then many entries sent in a loop. I will come around to that soon, because authentication is quite slow, thus calling the POST program in a loop for a large number of iterations can be painfully slow.
Unlike WP which uses a serial number starting from 1 for each post, Blogger uses the Edit-Link or Edit URL which is not so friendly.
The command to post looks like this:
java BloggerPost -Ufirstname.lastname@example.org -P=john341 -b="http://i-love-ruby.blogspot.com/feeds/posts/default" -t='I really do!' -f=test.html
The output of commands is in the same format as Movable Type/WP requires, so one should be able to with ease, push these posts to WP. I will soon write it the other way, so Java reads a MT format and posts to the New Blogger.
Yes, i could read from a config file, but each task in Java is so painful. In ruby, i would have slurped up the file in a mo using YAML, but I don’t want to have users download JYAML for just reading a user and pass up.
I shall now get back to working with
curl. If i am able to get something done, I may continue with that and abandon the Java work. If i still fail, I will work more on the Java programs.