Note that there are some explanatory texts on larger screens.

plurals
  1. POGoogle Picker API: filter YouTube movies
    text
    copied!<p>Hello I've been expirimenting with the Google Picker API (http://code.google.com/apis/picker/). I've got a working demo (code below) that searches for YouTube movies.</p> <p>This current version returns all videos. I'm trying to filter the results so it'll only list search results from youtube.com. The picker API supports this. But I don't understand the API documentation.</p> <p>The documentation (http://code.google.com/apis/picker/docs/reference.html) mentions 'VideoSearchView.YOUTUBE' and describes it as "A string constant suitable for the VideoSearchView.setSite() method".</p> <p>I don't understand how to implement this filter in my code below. Any help is appreciated.</p> <pre><code>&lt;!-- Needs work; it should only display YouTube videos. http://code.google.com/apis/picker/docs/reference.html Change the key parameter for a domain+path specific API key. Get one here: http://code.google.com/apis/loader/signup.html. --&gt; &lt;script type="text/javascript" src="http://www.google.com/jsapi?key=ABQIAAAANAaPTI0Sup-knGFaDbCNHBSXhCTdTCKo5q_OHnpA1qEpBIP8mRTtPnObFFbe_J21oviL78C86yxHUA"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; google.load('picker', '1', {'language':'nl'}); function googlePicker() { /* Displays the users own YouTube movies: picker = picker.addView(google.picker.ViewId.YOUTUBE); Displays all videos: picker = picker.addView(google.picker.ViewId.VIDEO_SEARCH); Displays all videos from youtube.com: ??? Example query that returns non-YouTube results: "Mobile Healing Rooms: Following Jesus on Vimeo" */ var picker = new google.picker.PickerBuilder(); picker = picker.addView(google.picker.ViewId.VIDEO_SEARCH); picker = picker.enableFeature(google.picker.Feature.NAV_HIDDEN); picker = picker.setTitle('Selecteer een YouTube video'); picker = picker.setCallback(googlePickerCallback); picker = picker.build(); picker.setVisible(true); } function googlePickerCallback(data) { var youTubeUrl = (data.action == google.picker.Action.PICKED) ? data.docs[0].url : ''; if (youTubeUrl != '') { $('#block_youtube_url').val(youTubeUrl); } } &lt;/script&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload