The Accidental Rubyist

invalid byte sequence in UTF-8

Really getting started with the New Blogger Beta using Java

with 2 comments

So yesterday I found that 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 -P=john341
-t='I really do!'

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.


Written by totalrecall

March 4, 2007 at 3:24 am

Posted in life

2 Responses

Subscribe to comments with RSS.

  1. hello there and thank you for your information –
    I have definitely picked up something new from right here.
    I did however expertise a few technical issues using this website,
    since I experienced to reload the website many times previous to I could get it to load properly.

    I had been wondering if your web host is OK? Not that I am complaining, but sluggish loading instances times will
    often affect your placement in google and could damage your high-quality score if advertising and marketing with Adwords.
    Well I’m adding this RSS to my email and can look out for much more of your respective exciting content. Make sure you update this again very soon.

    Moveable Feast

    August 2, 2013 at 9:30 pm

  2. When all else fails, you can always call your favorite shop
    and ask what pizza deals they are offering. Just try imagining a
    car with a Dominos sign placed on its roof gunning it through
    red lights, probably not the kind of advertisement the company had been looking for.
    There is the Neapolitan pizza usually called the pizza


    August 3, 2013 at 5:12 pm

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: