Search This Site

Custom Search

Friday, June 4, 2010

Re: [bloggerDev] Obtaining ALL entry URLs

You should use URL parameters like 'start-index' and 'max-results' to retrieve all the posts. See the Blogger API document at http://code.google.com/apis/blogger/docs/2.0/developers_guide_protocol.html

Thanks,
Jinwoo

On Thu, Jun 3, 2010 at 8:04 PM, soujiro0725 <soujiro0725@gmail.com> wrote:
hi.  I am trying to obtain URLs of ALL blog entries using Ruby.
But Ruby itself does not seem important here, though the code is given
below.

The feed URL of a blog looks like...

http://soichi-memos.blogspot.com/feeds/posts/default

or

http://www.blogger.com/feeds/8431963099352886303/posts/default

but the attempt to get URLs of entries gives only a portion of the
entire blog. (in this case only 25 of them)
Accessing these feed URLs gives XMLs containing only 25 entries, so I
am guessing that the problem is the setting of Blogger...?
But I am not sure.

Could anyone help me obtain ALL URLs of the blog?


#-------Ruby code starts here-----------------------------
require "rubygems"
require "open-uri"
require "nokogiri"

blog_feed = 'http://soichi-memos.blogspot.com/feeds/posts/default'

file = "list_url.txt"
filename = File.open(file, "w")

xml = Nokogiri::XML(open(blog_feed))

xml.search("link").each do |tag|
 if tag.get_attribute("rel") == "alternate" then
   url = tag.get_attribute('href')
   filename.write(url)
   filename.write("\n")
 end
end

filename.close
#-------------Ruby 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.
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