O'Reilly NetworkO'Reilly.com
BooksAll ArticlesSafari BookshelfO'Reilly GearFree NewslettersSearch
RSS DevCenter Tech Jobs | Forum

O'Reilly Network RSS DevCenter


TOPICS

Web Design and Development
Classification
Community
Getting Started
ICE
OCS
RDF
RSS
ScriptingNews
Weblogs












Meerkat: An Open Service API
Pages: 1, 2, 3, 4, 5

Meerkat: An Open Service API
Contents



• Introduction to Open Services

• The Meerkat API

• Meerkat Flavours

• Recipes: Passing Parameters to Meerkat

• Examples and Resources

Meerkat flavours

Meerkat flavours are predefined, yet customizable, templates defining how Meerkat displays RSS stories. Specify your flavour of choice on the URL-line using the _fl={flavour} argument. The current menu of flavours consists of:

For even more customization, be sure to visit the Recipes section of this article. When using those recipes, the ? symbols below indicate that display settings affect whether or not these attributes are displayed. Unless specifically turned off, these attributes will be displayed by default. Those without the ? (Title and Link) cannot be turned off.

Screen shot of Meerkat's default flavour.

Meerkat's default flavour (click for larger view).

Meerkat
URL: http://meerkat.oreillynet.com/
Stories: 50 per screen
Attributes: Action, Title, Link, Description, Source, Category, Date
Meerkat's default flavour, providing a comprehensive interface for your RSS-reading convenience. Note: no _fl argument is needed for the default flavour.



Screen shot of the Tofeerkat flavour.

Tofeerkat flavour (click for larger view).

Tofeerkat
URL: http://meerkat.oreillynet.com/?_fl=tofeerkat
Stories: 50 per screen
Attributes: Action, Title, Link, Description, Source, Category, Date
For those who prefer something a little lighter, the Tofeerkat interface is a compact version of the default, optimized for those who take full advantage of the power of Meerkat's Profiles.



Screen shot of the Minimal flavour.

Minimal flavour (click for larger view).

Minimal
URL: http://meerkat.oreillynet.com/?_fl=minimal
Stories: 15
Attributes: Title, Link, Description?, Source?, Category?, Date?
Designed for the minimalist, Meerkat's Minimal flavour is ideal for Lynx browsers, handhelds using AvantGo or the like, and wireless micro-browsers.



Screen shot of the RSS 0.91 flavour.

RSS 0.91 flavour (click for larger view)

RSS 1.0
URL: http://meerkat.oreillynet.com/?_fl=rss10
Stories: 15
Default Attributes: Title, Link, Description?, Dublin Core Metadata?
Coming full-circle, returns 15 stories as RSS 1.0, ready for incorporation into your web site or insertion into a database. Similar to the RSS 0.91 flavour below, Meerkat's RSS 1.0 includes Dublin Core Metadata via the RSS 1.0 Dublin Core module and will continue to evolve, supporting any other standard modules as they become available.

RSS 0.91
URL: http://meerkat.oreillynet.com/?_fl=rss
Stories: 15
Default Attributes: Title, Link, Description?
Meerkat's RSS 0.91 flavour returns 15 stories as well-formed RSS 0.91.



Screen shot of the XML flavour

XML flavour (click for larger view).

XML
URL: http://meerkat.oreillynet.com/?_fl=xml
Stories: 15
Attributes: Title, Link, Description?, Source?, Category?, Date?
Modeled loosely on RSS/0.91 format, the XML flavour gives you more of the information Meerkat collects for each story: source, category, and date. The rather simplistic DTD (Document Type Description), meerkat_xml_flavour.dtd is available for your perusal.



Screen shot of the .js flavour.

JavaScript flavour (click for larger view).

JavaScript Source (.js)
URL: http://meerkat.oreillynet.com/?_fl=js
Stories: 15
Attributes: Title, Link, Description?, Source?, Category?, Date?
Meerkat's JavaScript Source (.js) flavour is probably the most exciting to Web designers with little or no programming experience. If you know basic HTML, you can insert Meerkat stories right into your web site with a copy and a paste.



Simply insert the following line into your HTML document where you'd like the stories to appear:

<script 
language="JavaScript" 
src="http://meerkat.oreillynet.com/?_fl=js">
</script>

JavaScript-enabled Web browsers, upon encountering this tag, will grab the stories from Meerkat and insert them right into the page.

But wait, there's more! Meerkat's JavaScript Source flavour even has stylesheet support, so you can even customize the appearance of the various story elements using standard CSS (cascading style sheets). The following CSS classes correspond to the elements of each story:

Story ElementCSS Class
TitlemeerkatTitle
Description/BlurbmeerkatDescription
CategorymeerkatCategory
ChannelmeerkatChannel
DatemeerkatDate

For example, the following sample HTML code snippet:

<html>
<head>

 <style>
  .meerkatTitle       { font-family: sans-serif; 
                        font-size: 11pt; 
                        font-weight: bold; 
                        color: black;            }
  .meerkatDescription { font-family: sans-serif; 
                        font-size: 10pt; 
                        color: black;            }
  .meerkatCategory    { font-family: sans-serif; 
                        font-size: 9pt; 
                        font-weight: bold; 
                        font-style: italic; 
                        color: brown;            }
  .meerkatChannel     { font-family: sans-serif; 
                        font-size: 9pt; 
                        font-style: italic; 
                        color: brown;            }
  .meerkatDate        { font-family: sans-serif; 
                        font-size: 9pt; 
                        color: green;            }
 </style>
</head>

<body>
 <table border='0' bgcolor='#eeeeee' cellpadding='10'>
  <tr>
   <td>
    <p><center>
    <u><b>MEERKAT TODAY</b></u>
    </center></p>
    <script language="JavaScript" 
      src="http://meerkat.oreillynet.com/?_fl=js">
    </script>
  </td>
 </tr>
</table>
</body>

</html>

...produces a page similar to this:

Screen shot of .js flavour using CSS.

JavaScript flavour using CSS (click for larger view).

PHP Serialized String
URL: http://meerkat.oreillynet.com/?_fl=php
Stories: 15
Attributes: Title, Link, Description?, Source?, Category?, Date?
PHP programmer? Not much in the way of XML/RSS experience? Never fear -- you're only a few lines of code away from a serialized string chock full of Meerkat stories.

<?php

  $url = "http://meerkat.oreillynet.com/?_fl=php";
  if ( $cereal = @implode( "", file($url) ) )
   $stories = unserialize( $cereal );
  else
   print "Couldn't make cereal!\n";

?>

This simple block of code yields an array (actually an array of arrays of arrays ;-) as if constructed thusly:

$stories = array(
  0 => array(
    'title' => "Meerkats not Mere Cats!",
    'link' => "http://meerkat.oreillynet.com/not.html",
    'description' => "Scientists prove ...",
    'category' => "Biology: Mammals",
    'channel' => "Meerkat Today!",
    'date' => "2000-05-01 20:00:17"
  ),
  1 => 
    ...
  ),
  ...
);

Printing the second story's title is as simple as: echo $stories[1]['title'];

Sherlock Plugin
URL: n/a Stories: 100 Maximum
Constraints: 7 Days Worth of Stories, Macintosh Only
Attributes: Title, Link, Description, Source, Category, Date
The Meerkat Sherlock Plugin affords Macintosh users the ability to search the stories picked up by Meerkat from the comfort of Macintosh's Sherlock interface. For more information and to download the plugin, click here.

Here are a few screenshots to whet your appetite (or maybe make you supremely jealous if you're not a Mac user ; ).

Screen shot of Sherlock folder. Screen shot of Sherlock searching. Screen shot of Sherlock results.

Screen shots of the Sherlock Plugin (click for larger view).


N3 (experimental)
URL: http://meerkat.oreillynet.com/?_fl=n3
Stories: 15
Default Attributes: Title, Link, Description?, Dublin Core Metadata?
An experimental implementation of Tim Berners-Lee's Notation 3 RDF-alike. "This is not designed as an alternative to RDF's XML syntax which has the fundamental advantage that it is in XML. This is an academic excercise in language designed for a human-readable and scribblable language."



 

Pages: 1, 2, 3, 4, 5

Next Pagearrow





Sponsored by:

Get Red Hat training and certification.

Contact UsMedia KitPrivacy PolicyPress NewsJobs @ O'Reilly
Copyright © 2000-2006 O’Reilly Media, Inc. All Rights Reserved.
All trademarks and registered trademarks appearing on the O'Reilly Network are the property of their respective owners.
For problems or assistance with this site, email