Cooking With Daylife

Daylife makes its technology platform available to developers, editors, publishers, and readers who want to dig their hands into the news and make new stuff.

The Daylife Cookbook is a set of recipes you can use to jumpstart your news fiddling. It's a motley collection of ideas, samples, step-by-steps, case studies, and so forth, that you should feel free to borrow or steal from as you build your own applications on top of the DayPI.

We've broken the cookbook up into several sections, listed below.

Showcase; USA Today's Cruise log Sample code and tutorials Lazyweb Idea Sample

Showcase profiles live examples of how the DayPI is being used in the field

Sample Code and Tutorials walk you through how to build a complete implementation, sometimes with code sample and sometimes without.

Lazyweb Ideas are notions and sketches that illustrate possible applications of the DayPI, that you could build if you wanted, or that we might build if we weren't so lazy.

The recipes contained in the cookbook are updated all the time, with new additions and tweaks to old recipes in response to user comments coming every week. You can keep up with the new additions to the cookbook by watching our front page or by subscribing to our sitewide RSS.

You can also navigate the cookbook by tag (see the tag cloud to the left and note the tags at the base of each recipe).

Dig in!

Newsfeeds on OpenCongress.org

OpenCongress.org is an open-source public resource website for tracking the U.S. Congress. Our site aggregates official government data alongside news coverage, blog posts, and user comments to give users the real story of what's happening in Congress.

We use the Daylife API to automatically bring in relevant news articles for bills, Senators, and Representatives, for example ::

http://www.opencongress.org/bill/110-h1424/news
http://www.opencongress.org/person/news/400629_barack_obama
http://www.opencongress.org/person/news/400311_ronald_paul




The Daylife API ensures that our users have access to a comprehensive list of news results from across the web for every term on our site. The API itself was easy to work with and the staff was helpful at every step of the way. OpenCongress is proud to link back to Daylife as one of our core data providers.

 

News, by Colour


I had a play around with the API and put together a really simple breakdown of news stories grouped by different colours - topics, articles and quotes relating to 'Red', 'Blue', 'Green' etc. It's at http://colours.isitbedtime.com.
 

 

It's written using PHP, and I put together my own wrapper built on top of the Zend Framework's Rest_Client with SimpleXML wrapping the responses. A combination of the Daylife API's simplicity and the Zend Framework code made accessing the data really easy, and what's returned is structured in a way that makes it really easy to make use of. I've made use of the Articles, Topics and Quotes searches and I pull in the thumbnail images for related topics.

In terms of the app itself, I was trying out different search terms to see what kinds of results were returned when using keywords that aren't the subject of the article but are just mentioned in it. I found quite quickly that for the most part colours did this. Some are better than others in showing this; Brown is really bad for it, as all the articles related to people with the surname Brown but the other colours show it pretty well.

One thing that could be improved, either in my code or preferably (because I'm lazy, and it's not a trivial problem to solve) in the API, would be some way to help eliminate stories that are duplicates - not that they're the exact same story, but that are covering the same thing. A lot of the time different perspectives are a good thing, but in the context of what I've done it's not desirable - newly discovered purple tomatoes being able to cure Cancer is dominating that topic at the moment, for example!

 

Build vertical/micro sites

By vineet

The Daylife Team often works with publishers to build new verticals within existing sites, or add more pages to existing sections that are being managed by a small professional editorial staff. That's a big part of the value that Daylife brings: we let publishers create automatic inventory that they can use to drive ads, to enrich readers' experiences, and to supercharge the shrinking newsroom.

There are several more examples of the output of such efforts here Cookbook.: USA Today used the Daylife APIs to enhance their flights and cruise blogs with more and more topic pages about the cruise and airline industry. The team at Turner built four tightly focused sites using the API for NBA, PGA, NASCAR and MLB.

The Sacramento Bee has recently launched a celebrity section on their site using the Daylife API. The section provides a celebrity landing page with news stories, photos and related topics of the day. Readers can then follow links to topic pages for celebrities in news and find the most recent stories, photos, related topics, as well as quotes said by the featured celebrity and background information from wikipedia.

After the jump, some tips on generating a landing page for a Daylife-powered microsite...

i8news

Another app name starts with "i"? Yes, but also no, it's not any iPod "i" alike. It's because i8news reads like "i ate news" (inspired by my colleague's AIM handle i8code).

So the app involves some action with eating/nibble, check out the url here: http://i8news.appspot.com/static/nibble.html (apparently inspired by the famous Nibble game).

And the food comes from Daylife Search Quotes API (search_getQuotesBy). You will get a quote, and you need to reach the correct choice by practicing arrow keys.



So it's really simple as it is. It can go more advanced and with more features, because of the tools it has used:

  • GWT : for writing the javascript
  • Google App Enginge: supporting the backend
  • daypi: the python client from daylife used to do the actual api call (need a little modification to run in the Google App Engine)


Build a topic page

By vineet

Problem

You want to build a page about someone like Barack Obama or Steve Jobs or some organization like Google or NBA.

Topics are pre-defined people, organizations, places, diseases, issues, events and products in the daylife eco-system.

Things you can put on a topic page:

 

 

Read more below to see the code (in PHP) that builds this page.

Olympics 2008 @ USA Today

By vineet

Olympics.USAToday.com is showing coverage from sources all around the world for Olympics 2008 using the Daylife APIs. This portal has a page for every sport at the Olympics, and, in addition to its own coverage, USA Today is showing stories published by other sources on these pages.

 

 

 

NASCAR Drivers on TNT.tv

By vineet

TNT.tv launches a NASCAR drivers portal using the Daylife APIs. The portal shows stories, connections, quotes and photos for each driver.

 

 

The portal uses the Topic APIs like topic_getRelatedStories, topic_getRelatedTopics, topic_getRelatedQuotes and topic_getRelatedImages to get data about each player.

Daylife News + Dipity Timelines = NewsLine

In the world of 24-hour news channels, shrinking coverage and the rise of truthiness, Dipity aims to take the DayLife API and provide a broader context for the issues you care about. Leveraging the DayLife world and organized by Dipity on a map, timeline, list or flipbook.

Newsline gives you more than just the current hottest story, it gives you a comprehensive view of an issue with images, video and stories from trusted sources.

 

Want to compare the war in Iraq to the war in Afghanistan? Use Newsline to compare emerging stories and watch as existing stories evolve side by side. Got a blog post you're working on? Take your search from Newsline, select the view you want and drop it into your blog. Presto! you've now got something that's always pulling the most relevant news for the topic you care about and if you want you can add other sources to the mix as well.

NewsLine. Get the whole picture.

Mashup: Wordle!

By vineet

Wordle is a toy (nifty tool) for generating “word clouds” from text that you provide. The clouds give greater prominence to words that appear more frequently in the source text. You can tweak your clouds with different fonts, layouts, and color schemes.

Wordle also lets you create these "word clouds" using a RSS feed. Sumit Kataria has written a PHP script to generate RSS feeds from DayPIs for any search term you have. Just a perfect fit to use with Wordle!

Here is a RSS feed for Barack Obama - http://develop.daylife.com/demos/feed.php?query=%22Barack%20Obama%22

Feed it to Wordle on http://wordle.net/create and here is what you get

Another RSS feed for "Global Warming" OR "Climate Change" - http://develop.daylife.com/demos/feed.php?query=%22Global%20Warming%22%2...

And here is its Wordle! -