Search This Site

Custom Search

Thursday, June 3, 2010

[bloggerDev] Re: Obtaining URLs of Blogger entries

Thanks! It did work.

soujiro0725


On 5月31日, 午前3:48, "Aline M." <aline.maco...@gmail.com> wrote:
> simple :-)
>
> entry.getEditLink().getHref()
>
> 2010/5/20 soujiro0725 <soujiro0...@gmail.com>
>
>
>
> > Hi, I'm trying to obtain URLs of blog entries from Blogger using
> > Blogger API with Java libraries.
> > I was not sure how, so I used "getEditLink()" as shown below.  But
> > what I got was...
>
> > -----------------------------------------
> > the title of an entry
> >        com.google.gdata.data.Link@8f4fb3
> > ...
> > -----------------------------------------
>
> > what is this?
> > How can I get URLs?
>
> > Thanks in advance.  The code is below.
>
> > --------------------------------------------------------------------
> > import com.google.gdata.client.*;
> > import com.google.gdata.data.*;
> > import com.google.gdata.util.*;
> > import java.io.IOException;
> > import java.net.URL;
>
> > public class TestBloggerFeedOutput {
>
> >        public static void main(String[] args) {
>
> >                String blogId = "xxxxx";
> >                try {
> >                        GoogleService myService = new
> > GoogleService("blogger", "list-blog-
> > entries");
> >                        printAllPosts(myService, blogId);
> >                } catch (ServiceException e) {
> >                        System.out.println(e.getMessage());
> >                } catch (IOException e) {
> >                        System.out.println(e.getMessage());
> >                }
> >        }
> >        public static void printAllPosts(GoogleService myService, String
> > blogId) throws ServiceException, IOException {
>
> >                final URL feedUrl = new URL("http://www.blogger.com/feeds/"
> > + blogId
> > + "/posts/default");
> >                Feed resultFeed = myService.getFeed(feedUrl, Feed.class);
> >                System.out.println(resultFeed.getTitle().getPlainText());
> >                for (int i = 0; i < resultFeed.getEntries().size(); i++) {
> >                        Entry entry = resultFeed.getEntries().get(i);
> >                        System.out.println("\t" +
> > entry.getTitle().getPlainText());
>
> >                        System.out.println("\t" + entry.getEditLink());
> >            //<--
> > HERE!!!
> >                }
> >                System.out.println();
> >        }
>
> > }
> > //-----------------the code ends
> > here------------------------------------------------------------
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Blogger Developer Group" group.
> > To post to this group, send email to bloggerdev@googlegroups.com.
> > To unsubscribe from this group, send email to
> > bloggerdev+unsubscribe@googlegroups.com<bloggerdev%2Bunsubscribe@googlegrou ps.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/bloggerdev?hl=en.

--
You received this message because you are subscribed to the Google Groups "Blogger Developer Group" group.
To post to this group, send email to bloggerdev@googlegroups.com.
To unsubscribe from this group, send email to bloggerdev+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/bloggerdev?hl=en.

No comments:

Post a Comment