开发者

How to get Blogger post comments for URL using API or anything else?

I have been looking for a way to get the comments from a Blogger blog if I have a regular URL. I know you can get the blogID by scraping the html, which is somewhat unpleasant but has a few standard ways to get it. The problem is that I have not been able to find a way to get the comments for a specific post if I have only the post URL and the blogID. The postID cannot be reliably scraped from the HTML as far as I can tell, and it seems like the postID is required to get the comments for a single post.

Also, the get most recent posts for a blogID API call is only helpful if the post is one of the most recent 10 or 15, so if it is a slightly older post, I pro开发者_如何学Cbably cannot use that option. Does anyone know of a decent method to do this? I am mostly looking for a java solution, but if there is a solution in a different language I would gladly port it to java.


I just wanted to document my findings given that this question seems to be asked often and rarely answered.

Basically, to get the comments for a single blogger URL you would need the postID. If you have the postID, you can go through the Blogger API. If you only have the URL of the post, there seems to be only one somewhat reliable option, looking for the default post comments feed. To find this you need to look for an html tag of the form

In particular, the java regex that works for this is:

Pattern p = Pattern.compile("http://.*/feeds/[0-9]+/comments/default");

If this link tag does not exist, then the blog likely has a third-party commenting system installed like Disqus, Echo or IntenseDebate.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜