Practical - YouTube API
- YouTube API
- Your page has an entry field in which you can type a search term.
- When you click a submit button,
the Javascript on
your page searches the
British Pathé
archive
on YouTube for videos matching that term.
- You do this using the YouTube API with a
JSONP call.
- This returns a function wrapped round data.
- Your page parses the data in order to display a nice preview of the videos.
- You will need to register with YouTube to get an API key.
- The API needs to know "channel id".
To find channel id:
View Source of channel page and find:
data-channel-external-id
- To see the structure of the data returned:
- Read the YouTube docs.
- Type variable name in JS console and click through.
- Output complex objects to console.
- Check for empty list:
If no videos are returned, display an error message explaining the list is empty.
- Your page should be running at some URL.
You should keep this URL secret from other students.
And also so as not to expose your API key.
(Not a disaster, but just good practice.)