A sneak peek at new products and services being developed by the NPR Digital Media team

API June 25, 2009

Upcoming Changes to the API

In the next month or so, we will be making some significant changes to NPR.org. Some of these changes are visual, while others are architectural. As a result, there will likely be an impact on the API. That said, we did put in a lot of effort to make the system as backward compatible as possible to ensure that API users would be as minimally affected as possible.

I will post again to this blog soon with more details on the changes. In the meantime, here are some high-level descriptions of what to expect:

1. There will be changes to our topic structure resulting in some topics being eliminated, others being added, and others being renamed. For any changes to existing topics, there will be redirects to corresponding topics that will be maintained for a reasonable period of time to ensure backward compatibility. Our goal is to ensure that any applications that are dependent on specific topics existing will continue to work.

2. There will be some nodes and parameters added to the API output for NPRML. These will largely be to support the new features on NPR.org. They should not break any applications dependent on NPRML unless those applications require that these additional elements do not exist.

3. There will be new products and extensions added to the API. These will not adversely affect any current API calls.

As I mentioned earlier, I will publish to this blog again with more details on the changes as we draw closer. In the meantime, please provide any feedback or concerns about this in the comments section for this post.
--Daniel Jacobson

comments () | | e-mail

 
Technology June 17, 2009

Search, Matches and Self Service

If you have used our search recently, you may have noticed that we just launched a 'new' search in beta. You can either follow the link from the search page or you can try it by clicking here.

So what's the big deal you ask? Visually, we made changes to have cleaner look while getting the results more prominently positioned on the page.   Behind the scenes the technology is completely different. The new search is powered by the Google Search Appliance. While our previous search tool has similar potential ability to yield accurate results, it required a high degree of technical expertise to tune. One of the core philosophies in NPR Digital Media's technology team is that we want to be a partner, not a bottleneck to innovation. As part of this we embrace the idea we call 'Self Service' -- the antithesis to maintaining a technology fiefdom. The idea being the more we can provide empowering tools to our colleagues, the more we can accomplish as a team. Prior to the inventions of the lighter and matches, starting a fire was a cumbersome affair, typically involving a tinderbox, flint and a piece of steel. In modern day we usually take making fire for granted -- not because we all have become experts in the discipline, but rather because we have self service tools that work really well. So that is the root of our approach: implement smart, maintainable tools that are easy for people to use.

So it is this same spirit of self service that led to the selection of the search appliance. In this case there was no need to build it ourselves, as other companies had invested quite a lot in making solid search tools. While we think Google is really smart with its search algorithms, even more appealing was the ease of tuning via the appliance's interface. A colleague of ours Javaun Moradi is in charge of search (among many other things). Without making any changes to our code or critical configurations he is able to easily make changes using the GSA interface to help ensure we are indexing and surfacing the results that are desired. Using the variety of information and meta-data available about our content, rules can be defined to bias towards more relevant pages, and make sure to exclude redundant or unnecessary items from the results. Even within the first 24 hours of the tool being up in beta, he informs me that he has already made several tuning changes to help surface information about our shows while also surfacing breaking news.

Another aspect we especially like is the ability of the appliance to render its results in XML. While a suggested implementation is to use XSLT directly on the box to yield result pages, we appreciate the flexibility to make service calls to the appliance and then work with the very clean, portable XML results. Currently we are rendering out the XML results as search result pages using PHP -- which mirrors the architecture we use for the rest of the site. We expect in the future we will be able to use this to better integrate other content and features with search, and search with other features.

This leads us to why we are launching this new search in 'beta'. While we have done some tuning and configuration we are still working to get it right. By putting this tool out in a preliminary beta we can watch to see the queries it is getting and tune it to make it better. On the web, seeing how you all actually use our website is the most authoritative way to judge what is working and what isn't. Everyday is an opportunity to improve upon what we did yesterday. One example of this is that we see many searches that people mistakenly believe NPR produce, such as "This American Life" or "A Prairie Home Companion". By seeing that users are making these searches, we can make sure appropriate results are showing up. So whether you are searching for a story you heard this morning, or want to find those performances at Bob Boilen's tiny desk -- hopefully we get you what you want. We currently anticipate moving it out of 'beta' and as our primary search tool later this summer as we announce some other changes to our digital media tools and products.

Please share any observations or feedback below, or via this comment tool we setup specifically for the new search. We anticipate numerous improvements in the months ahead.

Happy Searching.

-- Zach Brand

comments () | | e-mail

 
API June 8, 2009

NPR's API Rights Management

One of the things that I am most commonly asked about regarding the NPR API is rights management. Because we are distributing content to unknown destinations, it is critical to make sure the API itself can control what gets offered and to whom. To handle these kinds of issues, we built a robust permissions and rights management system into the API. But that is not enough. Rights management starts with contracts and ensuring that the content is tagged appropriately. Without these steps, the rights management system cannot accurately withhold the content that is not allowed to be distributed. So, here is a breakdown of the steps we went through and the systems we built to handle rights in our API.

Contracts
Before launching the API, we spent a lot of time with our legal team reviewing existing contracts and our rights tagging system. Based on this review, we determined that a few changes needed to be made to the rights tagging system, but there were quite a few restrictions on what could be offered through the API. One interesting example is Fresh Air. Fresh Air is a program produced by WHYY and distributed on the radio by NPR. NPR is also responsible for displaying the content on NPR.org and is allowed to distributed Fresh Air content through limited outlets, like RSS, based on the terms of the contract. At the time of launch, however, NPR was not permitted to offer Fresh Air content through the API using the richer output formats. By the December 2008 upgrade to the API, however, the contract was renegotiated to include distribution through the API.

This highlights two points. First, at launch, we needed to incorporate a rights management system in the API that could identify specific types of content and then restrict that content from being distributed for certain types of users. The second key point is that NPR has been shifting our contract strategy to enable more content that we pick up to be distributable anywhere NPR content appears, including through the API.

Rights Tagging System
Our system for tagging assets not produced by NPR is critical for the success of rights management. That said, a sizable portion of this system involves manual effort. After all, it is the editorial process that chooses stories from external sources (e.g. AP, Reuters, etc.), images, videos and other assets. Upon selection of these assets, editorial staff then enter them into our content management system that contains appropriate fields for tagging the owner of the content.

Of course, we do have scripts that pull in some materials, like the AP Business feeds on our site. Those stories and assets that get pulled in through automated systems also get tagged by the scripts.

Finally, we also have scripts to remove content from our system based on contractual obligations. For example, if we have the rights to present an image for only 30 days, these scripts will purge the system of that image and its metadata at the appropriate time.

Rights Management System
After we determine what we are allowed to do based on the contracts, and after appropriately tagging the content itself, we were able to create a pretty flexible and powerful system for managing the distribution of the content through the API. This system has four aspects to it, including query-level filtering, story-level filtering, asset-level filtering and user permissions.

Query-level filtering enables the system to remove any story or list (ie. topic, program, series, etc.) from the system due to the permissions. It does this in two ways. First, the system will analyze the API query for any IDs that the user does not have permissions to access. If, for example, the user does not have the rights to view content from This I Believe and the user has included id=4538138 in their API query, the story-level filtering will remove the ID from the query and will proceed to execute the query without it.

Once a valid query passes through the system and figures out what stories to return, the story-level filter gets applied. This filter determines which individual stories need to be removed before returning the feed back to the user. This is done by applying the list of IDs in the filter, for the user's access level, as exclusions in the query to the API. The list of IDs in the filter include list IDs (eg. topics, programs, series, etc.), so the same rule applies to any stories that belong to any of these lists. For example, we have already established that my API key does not give me permissions to see stories that belong to This I Believe. If I request the top 10 stories that belong to the Opinion topic, and if the third story is a This I Believe story, then the system will eliminate the the third story and will add the eleventh to the results to accommodate my request for 10 stories.

Asset-level filtering is less stringent that story-level filtering in that it does not remove the story completely (as in the example above). Rather, it will display the story, but will only return those assets that the user has the rights to see. For example, if I request the top 10 stories from the People & Places topic, that result set may include a story from Fresh Air and This I Believe. In this case, let's say story number three is still a This I Believe story and story number seven is a Fresh Air story. We have already established that my API key does not allow me to see This I Believe, so the story-level filter will remove the third story and will include the eleventh in my results. Meanwhile, my API key allows me to see Fresh Air stories, just not all of them (any such restriction is no longer the case, but when we first launched the API, Fresh Air was only available through RSS). As a result, the seventh story will get through the story-level filter, but the asset-level filter will remove all assets other than the RSS information. We have other asset-level filters for audio, images, video, full text, etc.

The final element of this system, which has been mentioned throughout, is permissions. Our permission levels include Public, Partner, Station, NPR.org and Master, with increasing level of access in that order. For each level, there is a distinct list of IDs associated with each filter type (although the query and story filter lists are always the same). As a result, the same story in our system can theoretically be removed for the Public user, only have RSS content for Partner users, have everything but images for Stations, and be fully available to the NPR.org users. Meanwhile, a different story can theoretically have a completely different permission scheme enabling NPR.org users no access to it while public users can see it all.

To see how this filtering layer sits on top of our system, here is an architectural diagram:



Click here to enlarge

Ongoing Challenges
Although this system handles our cases for the most part, rights filtering is and will always be a challenge. There are certainly cases that could sneak through the system. These cases could be a result of the editorial process, the tagging tools or the code in the API. We also encounter new scenarios that sometimes require us to quickly modify the API to handle them. Despite these challenges, we have been pretty happy with this system so far.

--Daniel Jacobson

comments () | | e-mail

 
May 27, 2009

Download Your Favorite NPR Stories

Today we added a new feature to npr.org that has been at the top of the request list for many of you -- the ability to download audio for individual stories right from the story page.

On almost every story from NPR news and music you now have the ability to take the audio with you and enjoy it anywhere. While online you can download and save your favorite interviews, reports, performances and more. Then add the audio to your mp3 player, phone, laptop or netbook to take with you and listen offline wherever you go. It's one more way NPR is making it easier for you to listen and share.

To download audio from NPR, just find any story like this one from Nina Totenberg, Obama Picks Sotomayor For High Court click on the link with the red 'down' arrow and a download of the mp3 file will begin automatically.

You will find several types of stories don't have a download available. These will usually be things like exclusive music tracks, live concerts or acquired programs we don't have all the rights to. Not all our archives are available in a format that's downloadable, so you won't find links to those stories either but we'll be adding more in the future. You may also notice these mp3s don't have all the ID3 tags and information about the story you might like to find tagged in the file. This is an improvement we are working on and will be bringing to you soon to make it easier to organize all the NPR stories saved in your collection.

We hope you'll find this new feature a quick and easy way to enjoy and share your favorite NPR stories. Whether you're online or off, we want you to always be able to take NPR along with you.

Thanks for all the support and ideas, keep letting us know more ways we can help bring NPR to you wherever you are.
-- Adam J Martin

comments () | | e-mail

 
Social Media April 29, 2009

Experimenting with Facebook Connect

Earlier today, we upgraded the software we use on NPR.org for commenting and other community tools. The upgrade addresses a number of bugs in the system, but it also includes our first experiment with Facebook Connect.

For those of you who aren't familiar with it, Facebook Connect is a way of letting Facebook users participate in other websites and share their content back to their Facebook accounts. In our first experiment, we've added a "Post this comment to Facebook" option to our comments. When you post a comment on NPR.org and click that option, you'll be able to connect your NPR.org account with your Facebook account and have your NPR.org cross-posted to your Facebook news feed.

For now, that's as far as we've taken it, and it's still not perfect - we've gotten it working in Safari and Firefox, but IE users may not be able to see the "Post this comment to Facebook" checkbox just yet. I'll let you know when that's resolved. Meanwhile, exploring the possibility of expanding this feature so you can cross-post NPR stories to Facebook when you click the "recommen" button, and perhaps even use your Facebook login and password to sign into the NPR Community. We're also exploring OpenID, Open Social and other tools that would allow people to sign into NPR via other websites and share their content more easily.

Anyway, I hope you find our first experiment with Facebook Connect useful. Please let us know what you think.

-- Andy Carvin

comments () | | e-mail

 
April 27, 2009

NPR.org Nominated for 5 Webby, 2 EPpy

It has been a couple of rewarding weeks here at NPR.org.

We recently received notice that we had five Webby nominations and 2 Webby honoree mentions. Last week it was announced that we are finalist for two EPpy awards including one for the NPR API. And just to round things out, we picked up the Golden Dot Award for Vote Report.

The 2009 EPpy Awards are the 14th year of the program honoring the best Web sites in the media world, including newspapers, TV-cable, radio and magazines. The NPR API was nominated in the "Best Community Service Application in a Media-Affiliated Web Site with more than one million unique monthly visitors" category.

Additionally, NPR.org was nominated overall for "Best Radio Affiliated Web Site". Other finalist in this category include Minnesota Public Radio and American RadioWorks from American Public Media.

The Webby Awards, an international award, was established in 1996 to honor excellence on the Internet. You can vote for the people's choice Webby's here. Our 2009 nominations include:


    NPR Podcasts in the Podcasts category
    Project Song in the Music category
    NPR Music in the Music category
    NPR.org in the Radio category
    NPR iPhone Site in the News category

We also received Webby "honoree" mentions for:

    Monitor Mix in the Blog -- Culture/Personal category
    NPR Music Mobile in the Entertainment category

Finally as mentioned, last week we picked up the Golden Dot Award for the twitter Vote Report for Best Animation or Mashup.

Woot! Thanks Everyone!

-- Zach Brand

comments () | | e-mail

 
Mobile April 22, 2009

NPR on the iPhone

Ever since NPR launched an API last July, a number of developers have rushed to build free applications that make public radio content available on a variety of devices, especially the iPhone. From generic podcast players to the NPR Station Finder, these apps are all competing to offer the best experience for consuming NPR content.

These apps all have something else in common: not one of them was built or sponsored by NPR. Instead, they are the work of NPR fans who wanted to make a unique gift to the community of public radio listeners. Like the monetary gifts that thousands of listeners make to their local public radio station each year, these gifts of custom applications help to share the public radio experience with new generations of listeners.

One of my favorite applications is NPR Addict, which makes more than 13 years of NPR content available on the iPhone. Developed by Bradley Flubacher, a professional coder who moonlights as a volunteer firefighter, NPR Addict features podcasts and streams from NPR stations across the nation. Flubacher continues to update the app, in spite of his busy schedule, and every few months I notice another feature that keeps me glued to my iPhone for the weekend.

To all the Flubachers of the world, we at NPR want to say thank you. Thank you for your time, your innovative spirit, and for sharing our love of public radio.
-- Demian Perry

comments () | | e-mail

 
API April 6, 2009

New API Feature : Create Your Own XML Output

Today, we added two updates to the API, as follows:

XML Field Remap
This new functionality allows you to modify our NPRML elements to whatever you want, so your API requests can fit your existing applications without you having to change your code. The remap function allows any node or any attribute to be renamed and it can apply to any number of elements in the document. And again, this only applies to the NPRML output. To see how it works, go to the API Input Reference. In the meantime, here are some examples of how to modify the API query string to implement the remap:

- To change the list element, use "remap=list:newList", which will rename the list node to "newList".

- To change a sub-element of list, use "remap="list.title:newListTitle", which will rename the title node under list to "newListTitle".

- To change the story element, use "remap=list.story:newStory", which will rename the story node to "newStory".

- To change a sub-element of story, use "remap=list.story.title:newStoryTitle", which will rename the title node under story to "newStoryTitle".

- To change a attribute for any element in the NPRML output (even if the node itself was changed), use "remap=story~id:newStoryId", which will rename the id attribute for the story node to "newStoryId".

- To apply many of these changes in a single query, use the comma to separate the remap commands, as follows: "remap=list:newList,story:newStory,story.teaser:newTeaser,
story~id:newStoryId,list.story.text.paragraph:textParagraph".

Most Emailed Feed
We also opened up the Most Emailed list through the API. Previously, it was only available as an RSS feed, but now, it can be accessed through the API, including access to full text, audio, images, and other assets that NPR has the rights to redistribute. There are a few limitations in the feed, however, that are not present in any of our other existing options in the API. For example, this feed cannot be mashed-up with any other feeds from the API, it cannot be sorted, and the queries cannot be restricted by date or search term. As a result of these limitations, the Most Emailed feed is also not present in the Query Generator.

To acces the Most Emailed feed, add "id=100" to the API query string.
--Daniel Jacobson

comments () | | e-mail

 
API March 19, 2009

API Update : "Day to Day" and "News & Notes" To Be Retired

NPR's programs "Day to Day" and "News & Notes" will be broadcasting their final shows on Friday, March 20, 2009. Although the programs will no longer be producing new shows, the entire archive for both of these shows will still be available on NPR.org and through the API. Eventually, we will likely remove these programs from the API Query Generator, although their IDs will still be valid in the API and can be found in the API Mapping Index.

API queries that use these program IDs will not return any new content after this Friday. The IDs, however, will remain valid, so your applications should continue to work as expected.

Finally, to access the full archives of these programs in the API, you can use the functions available in the Control tab of the Query Generator. These functions include searches based on search terms and date ranges and allow for the ability to paginate through the results.

Please let us know if anything unexpected happens as a result of this change.
--Daniel Jacobson

comments () | | e-mail

 
API March 11, 2009

Seeking Feedback for SXSW API Session

As mentioned in Zach's previous post, I will be part of a panel at SXSW. The panel discussion will be on APIs, is called "Get Me Rewrite! Developing APIs and the Changing Face of News", and is on Sunday at 3:30pm. For more information on the panel, go to the SXSW page for this panel.

The panel moderator is Jacob Harris, from The New York Times. Joining the discussion will be Brad Stenger from Wired, and John Donovan from Daylife.

We will have a substantial time set aside for Q&A although prior to the Q&A we will be addressing many of the challenges in producing and maintaining APIs. That said, there are myriad things we can focus on when discussing APIs...

So, please let us know what is most on your mind. What kinds of questions do you want this panel to answer? Are you interested in technical background, business goals, legal issues, getting corporate buy-in, the marketplace for APIs, etc.? We will be using this feedback to refine our topics accordingly as we finish preparing for the session.

--Daniel Jacobson

comments () | | e-mail

 


   
   
   
null


 

About Us

Ever wanted to peer under the hood and learn about the inner workings of the NPR website? Have we got a blog for you, then. Here at Inside NPR.org, the NPR Digital Media team will keep you up-to-date on digital products and services we're developing, including social networking tools and our media player. For more info, please see our FAQ and our discussion rules.

 
 

Search Inside NPR.org

 
 

Contact us

Got a question or comment you want to send to us privately? Use our contact form.

 
 
 

Browse Topics

Services

Programs