<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Sam Wootton</title>
    <description>The latest articles on DEV Community by Sam Wootton (@samwootton).</description>
    <link>https://dev.to/samwootton</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4257897%2Fc7bcb63b-1aca-4c61-8a3f-b15b822dbf7a.png</url>
      <title>DEV Community: Sam Wootton</title>
      <link>https://dev.to/samwootton</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/samwootton"/>
    <language>en</language>
    <item>
      <title>5 YouTube Data API traps I hit building a playlist manager</title>
      <dc:creator>Sam Wootton</dc:creator>
      <pubDate>Sun, 22 Nov 2026 09:42:25 +0000</pubDate>
      <link>https://dev.to/samwootton/5-youtube-data-api-traps-i-hit-building-a-playlist-manager-3hc3</link>
      <guid>https://dev.to/samwootton/5-youtube-data-api-traps-i-hit-building-a-playlist-manager-3hc3</guid>
      <description>&lt;p&gt;I built TidyList, a web app for cleaning up big YouTube playlists, on the YouTube Data API v3. Most of it behaved as documented. These five didn't, and each one cost me.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Paging never ends
&lt;/h2&gt;

&lt;p&gt;You page through a playlist with &lt;code&gt;nextPageToken&lt;/code&gt;, and the docs suggest you stop when it's missing. On a 3,404-video playlist, YouTube got past the last page and kept going: every response came back with &lt;code&gt;items: []&lt;/code&gt; and a &lt;code&gt;nextPageToken&lt;/code&gt; equal to the one I'd just sent. Forever. My loop ran past 500 pages before I noticed, at one unit of my daily API quota per page.&lt;/p&gt;

&lt;p&gt;The fix is to keep every token you've requested and stop as soon as one repeats. While you're there, leave &lt;code&gt;pageToken&lt;/code&gt; out completely on the first request. Sending it as an empty string gave me 404s on some playlists.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Liked videos is just "LL"
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;channels.list?part=contentDetails&amp;amp;mine=true&lt;/code&gt; gives you &lt;code&gt;relatedPlaylists&lt;/code&gt;, with your uploads and your likes. Uploads comes back as &lt;code&gt;UU&lt;/code&gt; plus your channel ID, so it's tempting to build the likes ID the same way. Don't. Likes is the literal string &lt;code&gt;"LL"&lt;/code&gt;. Build it yourself and you get a playlist that doesn't exist.&lt;/p&gt;

&lt;p&gt;Use whatever the response gives you, and never construct an ID.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Updating a playlist wipes it
&lt;/h2&gt;

&lt;p&gt;I wanted users to rename a playlist, so I sent &lt;code&gt;playlists.update&lt;/code&gt; with the new title and description. It worked, and it quietly cleared the playlist's tags and default language too. &lt;code&gt;playlists.update&lt;/code&gt; replaces the whole snippet, so anything you leave out is deleted.&lt;/p&gt;

&lt;p&gt;Send the snippet you loaded, with only the fields you mean to change replaced. And if you're only changing visibility, &lt;code&gt;part=status&lt;/code&gt; on its own is refused with &lt;code&gt;400 unexpectedPart&lt;/code&gt;. You still have to send the snippet, because its title is required.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Inserting at the top reverses your list
&lt;/h2&gt;

&lt;p&gt;This one I did to myself. I insert videos at &lt;code&gt;position: 0&lt;/code&gt;, so new additions land at the top of the target playlist. Copy ten videos one at a time in order and they arrive upside down.&lt;/p&gt;

&lt;p&gt;The fix is to walk the set last-first. Each insert pushes the previous one down, and the playlist ends up in the original order.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. &lt;code&gt;channelTitle&lt;/code&gt; is the wrong channel
&lt;/h2&gt;

&lt;p&gt;On a &lt;code&gt;playlistItem&lt;/code&gt;, &lt;code&gt;snippet.channelTitle&lt;/code&gt; looks like the channel that made the video. It isn't. It's the channel that added the video to the playlist, which on your own playlists is you. Every video in my app showed my own name as the creator.&lt;/p&gt;

&lt;p&gt;The uploader is &lt;code&gt;snippet.videoOwnerChannelTitle&lt;/code&gt;. It's missing for private and deleted videos, because YouTube strips the owner fields from those.&lt;/p&gt;




&lt;p&gt;If your playlists are full of deleted, private and duplicate videos, that's what I built TidyList to fix: &lt;a href="https://tidylist.video/help" rel="noopener noreferrer"&gt;https://tidylist.video/help&lt;/a&gt;&lt;/p&gt;

</description>
      <category>youtube</category>
      <category>api</category>
      <category>webdev</category>
      <category>angular</category>
    </item>
  </channel>
</rss>
