tags:

views:

217

answers:

3

Let's say that you want to create a dead simple BlogEditor and, one of your ideas, is to do what Live Writer does and ask only the URL of the persons Blog. How can you detect what type of blog is it?

Basic detection can be done with the URL itself, such ashttp://myblog.blogger.com etc. But what if it's self hosted?

I'm mostly interested on how to do this in Java, but this question could be also used as a reference for any other language.

+1  A: 

Some blogs provide a Generator meta tag - e.g. Wordpress - you could find out if there's any exceptions to this.

You'll have to be careful how you detect it though, Google surprised me with this line:

<meta content='blogger' name='generator'/>

Single quotes are blasphemy.

Ross
+2  A: 

Many (most?) blogs will have a meta tag for "generator" which will list the blog engine. For example a blogger blog will contain the following meta tag:

<meta name="generator" content="Blogger" />

My Subtext blog shows the following generator meta tag:

<meta name="Generator" content="Subtext Version 1.9.5.177" />

This meta tag would be the first place to look. For blogs that don't set this meta tag in the source, you'd have to resort to looking for patterns to determine the blog type.

Ryan Farley
+1  A: 

To determine other patterns to look for in determining the blogging engine (for those that don't have a generator meta tag), you'd basically just look through the source to determine something specific to that blog type. You'd also need to compare this across multiple blogs of that type as you want to make sure that it's not something specific to the skin or theme in use on the blog only.

Another thought would be to read the docs of the various common blogging engine to know how to discover the location of it's paths to things like MetaWebLog API, etc. IIRC, Live Writer has built-in support for the most common types, the rest are categorized "MetaWebLog API Blog" or something.

Ryan Farley