title: API - Any Way to validate Playlist IDs?
body: <p>Here's my problem. The website I am working on has a slew of different products that could possibly have a link to a YouTube Video or Playlist. I have been requested to embed that link on the page instead of sending the end-user away from the page to view the video/playlist. Easy enough.</p>
  <p>I'm using a JSTL fn.substring and fn.substringAfter to isolate the VideoID and PlaylistID of each URL that is imported into the page</p>
  <pre><code>&lt;c:if test=&quot;${hyperlink.type.name eq 'YouTubeLinking'}&quot;&gt;
  &lt;c:set var=&quot;videoSub&quot; value=&quot;${fn:substringAfter(hyperlink.link, 'watch?v=')}&quot;/&gt;
  &lt;c:set var=&quot;videoID&quot; value=&quot;${fn:substring(videoSub, 0, 11)}&quot;/&gt;
  &lt;c:set var=&quot;playlistSub&quot; value=&quot;${fn:substringAfter(hyperlink.link, 'list=')}&quot;/&gt;
  &lt;c:set var=&quot;playlistID&quot; value=&quot;${fn:substring(playlistSub, 0, 34)}&quot;/&gt;
  </code></pre>
  <p>I am then using a simple IF conditional to look at the PlaylistID, and if it its empty, then just employ the single video embed.</p>
  <pre><code>&lt;c:if test=&quot;${empty playlistID}&quot;&gt;
  &lt;iframe width=&quot;540&quot; height=&quot;304&quot; src=&quot;https://www.youtube.com/embed/&lt;c:out value=&quot;${videoID}&quot;/&gt;?rel=0&quot; frameborder=&quot;0&quot; allow=&quot;autoplay; encrypted-media&quot; allowfullscreen&gt;&lt;/iframe&gt;
  &lt;/c:if&gt;
  &lt;c:if test=&quot;${not empty playlistID}&quot;&gt;
  &lt;iframe width=&quot;540&quot; height=&quot;304&quot; src=&quot;https://www.youtube.com/embed/videoseries?list=&lt;c:out value=&quot;${playlistID}&quot;/&gt;&quot; frameborder=&quot;0&quot; allow=&quot;autoplay; encrypted-media&quot; allowfullscreen&gt;&lt;/iframe&gt;
  &lt;/c:if&gt;
  </code></pre>
  <p>The problem is... A lot of these Playlists are no longer valid, meaning the playlist has been deleted. We're talking thousands of products that could potentially link to hundreds of playlists.</p>
  <p>Is there anyway that I can use the YouTube API to check to see if the PlayListID is valid (will not return a 400 error), and if it is not valid, then just employ the single video embed markup?</p>