Monday, July 8, 2013

Using the Video Search API; Sample Returns, Tips using "Private" Identifiers, and Basic Logic (Part 1 of 3)

The video search API is a simple way to interact with a massive collection of assets and has tremendous potential for creative developers whose goal is to deepen engagement with relevant video.

I will provide a quick overview below using my own API 'Key' and 'Secret' which will work for most applications but I urge you to contact me if you'd like to get your own key authorized and modify the player as well.

Use Case:
I will be editing a blog specializing in the curation of local police video news from local broadcasters and newspapers and I'd like an automated way to include additional relevant video on any post based on the post's parent topic.

 Before we proceed, note that I will use RSS but that XML and JSON are available simply by swapping initials in the 'format' parameter.

The request as follows contains a key (that I can authorize) and a 'secret' which is an MD5 Hash of your password.

The following request is broken down to display the key and secret, the RSS preference in format, and the ability to paginate through results of 50 videos per page. This request is asking for any video where the word "police" appears in the title, description, or tags...

The capacity for pagination is important as some requests in the 'news' vertical like "police" have over 175,000 results just in the past few years using only local broadcasters' as a filter.

To broaden the search (in cases where human-curated news / tips gathering is the goal) we can include 'transcript' in the default title/descrip/tags search:

&search_string=(police OR transcript:police)

There are methods for including (or exclusively requesting) keywords as they appear in "speech to text" version of the transcripts but I would prefer to work with you on those directly rather than publish them as this application may be more appropriate for monitoring the use of keywords only peripherally relevant to the asset as opposed to gathering relevant video.

In cases where automated publishing is the goal the net can be tightened by looking only for keywords in title:



Adding "private" identifiers such as provider type (wire, broadcaster, newspaper, radio) or provider-specific ID's.

While interacting with 600 provider-specific ID's can be of use and I can share these ID's on request, I find it's more common to limit the request to 'types' of video content providers rather than individual producers.  Whereas '4' may be wires and '3' may be cable; I am most interested in local broadcast (type ID 2)  and 'local newspapers (type ID 8).

The following request is looking for local broadcaster and newspaper content only and only where the keyword "police" is used in the title of the video's metadata:

&search_string=((provider_type_id:2 OR provider_type_id:8) AND title:(police))

I am now confident that my request for video news from trusted sources and only when 'police' is used in title is working, but after having time to review the return I note some consistent false-positives and realize 'police' may not be the only word used in relevant titles...

As an editor, I notice that almost every time "police department" is used as a phrase the content tends to deal with municipal administration and is rather boring. I tested a stem of 'police' using 'polic*' but that was a fail as 'policy' is almost wholly irrelevant.  I did notice that "sheriff" should be included and as I get familiar with sources I note that certain broadcasters refer to their police by the department initials such as "APD" in Albuquerque.

The following requests accommodates the inclusion of both "APD", the stemmed version of "sheriff", and the exclusion of "department":

=((provider_type_id:2 OR provider_type_id:8) AND title:(police OR sheriff* OR APD)) -(department)

As I am happy with my broader net, but I would now like to work on requesting video for channels for my topic pages. The use-case is that I write in the following channels and I would like to augment these pages with relevant video:

Standoff / Hostage
Dash-cam * Raw

Here are some attempts to request these topics using the API (additions in bold) and the return in the link:

=((provider_type_id:2 OR provider_type_id:8) AND title:((police OR sheriff* OR APD)) AND (swat)) -(department)

return (full request in URL):

=((provider_type_id:2 OR provider_type_id:8) AND title:((police OR sheriff* OR APD)) AND (standoff OR "stand off" OR hostage*)) -(department)

return (full request in URL):

=((provider_type_id:2 OR provider_type_id:8) AND title:((police OR sheriff* OR APD)) AND (dash OR raw)) -(department)

return (full request in URL):


Part 2: Parsing RSS for use in widgets and popular blogging platforms.

Part 3: Customizing the player environment and controlling pre-roll.

No comments:

Post a Comment