Kqed And The Npr Api


Published on

A talk on how KQED is using the NPR API to consume and share content, given at Hacks & Hackers on 5/22/10

Published in: News & Politics
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Kqed And The Npr Api

  1. 1. KQED and the NPR API Hacks & Hackers May 22, 2010
  2. 2. What is the NPR API? <ul><li>API = Application Programming Interface </li></ul><ul><li>A structured way for (web) applications to get NPR stories in a predictable, flexible and powerful way </li></ul><ul><li>Includes audio from most NPR programs dating to 1995, and text and images </li></ul><ul><li>250,000 stories in 5,000 different aggregations </li></ul><ul><li>source – http://www.npr.org/api/ </li></ul>
  3. 3. History of the NPR API <ul><li>Launched on July 16, 2008 </li></ul><ul><ul><li>Over 250,000 stories from NPR.org </li></ul></ul><ul><ul><li>Over 400,000 audio files, totaling over 25,000 hours of programming </li></ul></ul><ul><li>Features Added in December, 2008 </li></ul><ul><ul><li>Mix Your Own Podcasts </li></ul></ul><ul><ul><li>Station Finder API </li></ul></ul><ul><ul><li>More content: Fresh Air, StoryCorps and Most Emailed stories </li></ul></ul><ul><li>Features Added in July, 2009 </li></ul><ul><ul><li>Transcript API, including over 80,000 transcripts </li></ul></ul><ul><ul><li>Added over 180,000 more MP3 files dating back to 2001 </li></ul></ul><ul><li>Features Added in March 2010 </li></ul><ul><ul><li>API Ingest including OPB, N3, KQED, WBUR and WXPN </li></ul></ul><ul><ul><li>First blogs added to the API </li></ul></ul>
  4. 4. Who can use the NPR API? <ul><li>Anyone who registers for an API Key </li></ul><ul><li>Personal, non-commercial use, or non-commercial use by a 501(c)(3) </li></ul><ul><li>See the terms of service for more details at: http://www.npr.org/api/apiterms.php </li></ul>
  5. 5. Target Audiences <ul><li>NPR </li></ul><ul><ul><li>Supports the entire infrastructure of our new site </li></ul></ul><ul><ul><li>Improvements to CMS to enable custom feeds by Editorial and Design </li></ul></ul><ul><li>Stations </li></ul><ul><ul><li>Enables us to serve content to our member stations more easily </li></ul></ul><ul><ul><li>Enables our stations to serve their communities better </li></ul></ul><ul><li>Partners </li></ul><ul><ul><li>Creates new opportunities because - easy to implement with very little integration cost </li></ul></ul><ul><ul><li>Makes existing opportunities easier to maintain and grow </li></ul></ul><ul><li>Public </li></ul><ul><ul><li>Engages the community – part of NPR’s Public Service Mission </li></ul></ul><ul><ul><li>Lots of great widgets, tools, sites built using the API </li></ul></ul>
  6. 6. The NPR API Suite <ul><li>APIs Offered </li></ul><ul><ul><li>Full Story API </li></ul></ul><ul><ul><li>Station Finder and Information API </li></ul></ul><ul><ul><li>Transcript API </li></ul></ul><ul><li>Content </li></ul><ul><ul><li>Virtually everything on NPR.org is available in the API (rights restricted) </li></ul></ul><ul><ul><li>Over 6500 categories </li></ul></ul><ul><ul><li>Content from dozens of NPR stations, including KQED </li></ul></ul><ul><li>Content Types </li></ul><ul><ul><li>Full text </li></ul></ul><ul><ul><li>Full transcripts </li></ul></ul><ul><ul><li>Audio (mp3, m3u, aac, wma, rm) </li></ul></ul><ul><ul><li>Images </li></ul></ul><ul><ul><li>Virtually all other assets and fields on NPR.org </li></ul></ul><ul><li>Output Formats </li></ul><ul><ul><li>Eight different output formats </li></ul></ul><ul><ul><ul><li>NPRML, our custom, full content XML format </li></ul></ul></ul><ul><ul><ul><li>RSS, MediaRSS and PodcastRSS </li></ul></ul></ul><ul><ul><ul><li>JSON </li></ul></ul></ul><ul><ul><ul><li>Atom </li></ul></ul></ul><ul><ul><ul><li>HTML and JavaScript Widgets </li></ul></ul></ul>
  7. 7. How does it work? <ul><li>Send a query to a URL, it returns data in a structured format </li></ul><ul><li>Default format is NPRML, a custom XML specification </li></ul><ul><li>Also supports RSS, MediaRSS, JSON, Atom </li></ul><ul><li>Easiest – HTML and Javascript widgets </li></ul>
  8. 8. Example: <ul><li>http://api.npr.org/query?id=1149&apiKey=demo </li></ul><ul><li>Returns an NPRML document with the latest stories on Afghanistan </li></ul><ul><li>See all topics: http://api.npr.org/list?id=3002 </li></ul><ul><li>Can also query by genre, program, reporter, music artist, series, blogs, columns, categories & tags </li></ul><ul><li>Query generator (demo?) </li></ul>
  9. 9. NPR API Demo – query generator
  10. 10. How KQED uses the NPR API <ul><li>We ingest all top news stories into our MySQL database and publish them automatically to our home page and news section: http://www.kqed.org and http://www.kqed.org/news/ </li></ul><ul><li>Alternative workflow – editors choose which movie reviews to publish in our Arts section: http:// www.kqed.org /arts/movies/ </li></ul><ul><li>More coming soon </li></ul>
  11. 11. KQED implementation – tech details <ul><li>Java class that uses Jaxb to de-serialize NPRML data </li></ul><ul><li>Persists to our database using Hibernate (Object-relational mapping layer) </li></ul><ul><li>Per-feed workflow changes (ie., editors can choose to auto-publish, or publish exactly what they wish) </li></ul><ul><li>All stories fully editable in our CMS (“SimpleCMS”) </li></ul>
  12. 12. KQED example output
  13. 13. New stuff – API ingest <ul><li>For member stations, the API is two-way, allowing us to publish our data to NPR’s database </li></ul><ul><li>Current feeds that are live (all wordpress blogs, via MediaRSS): </li></ul><ul><ul><li>Climate Watch </li></ul></ul><ul><ul><li>Shifting Gears </li></ul></ul><ul><ul><li>Capital Notes </li></ul></ul>
  14. 14. NPR API Growth
  15. 15. Output format distribution
  16. 16. Q&A / Demo of CMS <ul><li>Ken Murphy is the primary Java developer – [email_address] </li></ul><ul><li>Daniel Jacobson – NPR tech lead: [email_address] </li></ul><ul><li>Me: [email_address] or @kic00 on twitter </li></ul>