<?xml version="1.0" encoding="utf-8" ?>

<?xml-stylesheet type="text/xsl" href="/templates/2k11/rss.xsl" media="screen" ?>
<rss version="2.0" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:admin="http://webns.net/mvcb/"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/"
   xmlns:content="http://purl.org/rss/1.0/modules/content/"
   >
<channel>
    
    <title>Daniel Lange's blog (Entries tagged as web)</title>
    <link>http://daniel-lange.com/</link>
    <description>agrep -pB IT /dev/life</description>
    <dc:language>en</dc:language>
    <generator>Serendipity 2.6.1 - http://www.s9y.org/</generator>
    <pubDate>Thu, 27 Aug 2026 17:52:05 GMT</pubDate>

    <image>
    <url>//daniel-lange.com/uploads/Avatar_Blog_144_234.png</url>
    <title>RSS: Daniel Lange's blog - agrep -pB IT /dev/life</title>
    <link>http://daniel-lange.com/</link>
    <width>144</width>
    <height>234</height>
</image>

<item>
    <title>Get Youtube Channel ID from username</title>
    <link>http://daniel-lange.com/archives/175-Get-Youtube-Channel-ID-from-username.html</link>
            <category>Internet</category>
    
    <comments>http://daniel-lange.com/archives/175-Get-Youtube-Channel-ID-from-username.html#comments</comments>
    <wfw:comment>http://daniel-lange.com/wfwcomment.php?cid=175</wfw:comment>

    <slash:comments>3</slash:comments>
    <wfw:commentRss>http://daniel-lange.com/rss.php?version=2.0&amp;type=comments&amp;cid=175</wfw:commentRss>
    

    <author>nospam@example.com (Daniel Lange)</author>
    <content:encoded>
    &lt;p&gt;Youtube has a really nice RSS feature that is extremely well hidden.&lt;/p&gt;

&lt;p&gt;If you postfix a Channel ID to&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;https://www.youtube.com/feeds/videos.xml?channel_id=&amp;lt;id goes here&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;you get a really nice Atom 1.0 (~RSS) feed for your feedreader.&lt;/p&gt;

&lt;p&gt;Unfortunately the Channel ID is hard to find while you are navigating Youtube with usernames in the URL.&lt;/p&gt;

&lt;p&gt;E.g. &lt;a href=&quot;https://www.youtube.com/c/TED&quot;&gt;https://www.youtube.com/c/TED&lt;/a&gt; is TED&#039;s channel, full of interesting and worth-to-watch content (and some assorted horse toppings, of course).&lt;/p&gt;

&lt;p&gt;But you have to read a lot of ugly HTML / JSON in that page to find and combine&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://www.youtube.com/feeds/videos.xml?channel_id=UCAuUUnT6oDeKwE6v1NGQxug&quot;&gt;https://www.youtube.com/feeds/videos.xml?channel_id=UCAuUUnT6oDeKwE6v1NGQxug&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;which is the related RSS feed.&lt;/p&gt;

&lt;p&gt;Jeff Keeling wrote a simple &lt;a href=&quot;https://jeffkeeling.github.io/youtube_rss_extractor/&quot;&gt;Youtube RSS Extractor&lt;/a&gt; that does well if you have a &lt;code&gt;../playlist?...&lt;/code&gt; or a &lt;code&gt;.../channel/...&lt;/code&gt; URL but it will (currently) fail on user name channels or Youtube landing pages.&lt;/p&gt;

&lt;p&gt;So how do we get the Channel ID for a Youtube user we are interested to follow?&lt;/p&gt;

&lt;p&gt;Youtube has a great API but that is gated by API keys even for the most simple calls (that came only with v3 of the API but the previous version is depreciated since 2015)&lt;sup id=&quot;fnref:1&quot;&gt;&lt;a href=&quot;#fn:1&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt;:&lt;/p&gt;

&lt;div class=&quot;bash geshi&quot; style=&quot;text-align: left&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;dl@laptop:~$ &lt;/span&gt;curl &lt;span style=&quot;color: #ff0000;&quot;&gt;&#039;https://www.googleapis.com/youtube/v3/channels?part=contentDetails&amp;amp;forUsername=DebConfVideos&#039;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;#160; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;error&amp;quot;&lt;/span&gt;: &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;code&amp;quot;&lt;/span&gt;: &lt;span style=&quot;color: #000000;&quot;&gt;403&lt;/span&gt;,&lt;br /&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;message&amp;quot;&lt;/span&gt;: &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;The request is missing a valid API key.&amp;quot;&lt;/span&gt;,&lt;br /&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;errors&amp;quot;&lt;/span&gt;: &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;message&amp;quot;&lt;/span&gt;: &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;The request is missing a valid API key.&amp;quot;&lt;/span&gt;,&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;domain&amp;quot;&lt;/span&gt;: &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;global&amp;quot;&lt;/span&gt;,&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;reason&amp;quot;&lt;/span&gt;: &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;forbidden&amp;quot;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#93;&lt;/span&gt;,&lt;br /&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;status&amp;quot;&lt;/span&gt;: &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;PERMISSION_DENIED&amp;quot;&lt;/span&gt;&lt;br /&gt;&amp;#160; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;

&lt;p&gt;Luckily we can throw the same (example) user name &lt;code&gt;DebConfVideos&lt;/code&gt; at &lt;code&gt;curl&lt;/code&gt; and &lt;code&gt;grep&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;bash geshi&quot; style=&quot;text-align: left&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;dl@laptop:~$ &lt;/span&gt;curl &lt;span style=&quot;color: #660033;&quot;&gt;-s&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;https://www.youtube.com/c/DebConfVideos/videos&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;grep&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-Po&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&#039;&amp;quot;channelId&amp;quot;:&amp;quot;.+?&amp;quot;&#039;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;channelId&amp;quot;&lt;/span&gt;:&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;UC7SbfAPZf8SMvAxp8t51qtQ&amp;quot;&lt;/span&gt; &lt;/div&gt;

&lt;p&gt;So &lt;a href=&quot;https://www.youtube.com/feeds/videos.xml?channel_id=UC7SbfAPZf8SMvAxp8t51qtQ&quot;&gt;https://www.youtube.com/feeds/videos.xml?channel_id=UC7SbfAPZf8SMvAxp8t51qtQ&lt;/a&gt; is the RSS feed for DebConfVideos.&lt;/p&gt;

&lt;p&gt;We can use individual Youtube video URLs as well. With the hack above, it&#039;ll work to find us the Chanel ID from a Youtube video URL:&lt;/p&gt;

&lt;p&gt;&lt;!-- s9ymdb:690 --&gt;&lt;img class=&quot;serendipity_image_center&quot; width=&quot;920&quot; height=&quot;78&quot;  src=&quot;http://daniel-lange.com/uploads/entries/220601_Google_Youtube_get_channelId_2.jpg&quot;  alt=&quot;Working around the Youtube API restrictions to still make use of their RSS feed&quot;&gt;&lt;/p&gt;

&lt;p&gt;Now, some user pages may have multiple valid RSS feeds because they contain multiple channels.&lt;/p&gt;

&lt;p&gt;Remember the TED page from above? Well run:&lt;/p&gt;

&lt;div class=&quot;bash geshi&quot; style=&quot;text-align: left&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;dl@laptop:~$ &lt;/span&gt;curl &lt;span style=&quot;color: #660033;&quot;&gt;-s&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;https://www.youtube.com/c/TED&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;grep&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-Po&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&#039;&amp;quot;channelId&amp;quot;:&amp;quot;.+?&amp;quot;&#039;&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;cut&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-d&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;\&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-f&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;4&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;while&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;read&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-r&lt;/span&gt; YTID ; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;do&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-n&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;Youtube-ID: &lt;span style=&quot;color: #007800;&quot;&gt;$YTID&lt;/span&gt; &amp;quot;&lt;/span&gt; ; curl &lt;span style=&quot;color: #660033;&quot;&gt;-s&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;https://www.youtube.com/feeds/videos.xml?channel_id=&lt;span style=&quot;color: #007800;&quot;&gt;$YTID&lt;/span&gt;&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;grep&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-m&lt;/span&gt; &lt;span style=&quot;color: #000000;&quot;&gt;1&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-P&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-o&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;(?&amp;lt;=&amp;lt;title&amp;gt;).+(?=&amp;lt;/title&amp;gt;)&amp;quot;&lt;/span&gt; ; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;done&lt;/span&gt;&lt;/div&gt;

&lt;p&gt;This will iterate through the Channel IDs found and show you the titles. That way you can assess which one you want to add to your feedreader.&lt;/p&gt;

&lt;p&gt;&lt;!-- s9ymdb:691 --&gt;&lt;img class=&quot;serendipity_image_center&quot; width=&quot;670&quot; height=&quot;246&quot;  src=&quot;http://daniel-lange.com/uploads/entries/220601_Google_Youtube_get_channelId_and_title.jpg&quot; title=&quot;Bash automation FTW!&quot; alt=&quot;screenshot of the above&quot;&gt;&lt;/p&gt;

&lt;p&gt;You probably want the last Channel ID listed above, the non-selective &quot;TED&quot; one. And that&#039;s the one from the example above.&lt;/p&gt;

&lt;h2&gt;Update&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;02.06.2022:&lt;/strong&gt;&lt;br /&gt;
smpl wrote in and has the much better solution for the most frequent use cases:&lt;/p&gt;

&lt;pre&gt;
You can also use get a feed directly with a username:
https://www.youtube.com/feeds/videos.xml?user=&amp;lt;username&amp;gt;

The one I use most is the one for playlists (if creators remember to
use them).

https://www.youtube.com/feeds/videos.xml?playlist_id=&amp;lt;playlist id&amp;gt;
&lt;/pre&gt;

&lt;p&gt;For the common case you don&#039;t even need the channel ID that way.
But it is also conveniently given in a &lt;code&gt;&amp;lt;yt:channelId&amp;gt;&lt;/code&gt; tag (or the topmost &lt;code&gt;&amp;lt;id&amp;gt;&lt;/code&gt; tag) within the Atom XML document.&lt;/p&gt;

&lt;p&gt;Thanks, smpl!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;27.08.2026:&lt;/strong&gt;&lt;br /&gt;
Of course Youtube had to break it&#039;s stuff again.&lt;/p&gt;

&lt;div class=&quot;bash geshi&quot; style=&quot;text-align: left&quot;&gt;&lt;span style=&quot;color: #666666;&quot;&gt;dl@laptop:~$ &lt;/span&gt;curl &lt;span style=&quot;color: #660033;&quot;&gt;-s&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;https://www.youtube.com/c/DebConfVideos/videos&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;grep&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-Po&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&#039;&amp;quot;og:url&amp;quot; content=&amp;quot;.+?&amp;quot;&#039;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;og:url&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #007800;&quot;&gt;content&lt;/span&gt;=&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;https://www.youtube.com/channel/UC7SbfAPZf8SMvAxp8t51qtQ&amp;quot;&lt;/span&gt;&lt;/div&gt;

&lt;p&gt;will get you the Channel ID now (with some cruft around it but you can slice that off yourself, can you? &lt;img src=&quot;http://daniel-lange.com/plugins/serendipity_event_emoticate/img/emoticons/smile.png&quot; alt=&quot;:-)&quot; class=&quot;emoticon&quot; /&gt;)&lt;/p&gt;

&lt;div class=&quot;footnotes&quot;&gt;
&lt;hr /&gt;
&lt;ol&gt;

&lt;li id=&quot;fn:1&quot;&gt;
&lt;p&gt;Actually it is even more complicated as some channels, like our DebConfVideos example, will only get you an incomplete result, cf. &lt;a href=&quot;https://stackoverflow.com/questions/37267324/how-to-get-youtube-channel-details-using-youtube-data-api-if-channel-has-custom&quot;&gt;this StackOverflow entry&lt;/a&gt;. I.e. the &lt;code&gt;forUsername&lt;/code&gt; iterator may not even work and the &quot;best practice&quot; seems to be mucking around with the &lt;code&gt;search&lt;/code&gt; call.&amp;#160;&lt;a href=&quot;#fnref:1&quot; rev=&quot;footnote&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;

&lt;/ol&gt;
&lt;/div&gt;
 
    </content:encoded>

    <pubDate>Wed, 01 Jun 2022 16:45:00 +0000</pubDate>
    <guid isPermaLink="false">http://daniel-lange.com/archives/175-guid.html</guid>
    <category>api</category>
<category>atom</category>
<category>automate</category>
<category>bash</category>
<category>channel</category>
<category>google</category>
<category>rss</category>
<category>updated</category>
<category>url</category>
<category>user</category>
<category>video</category>
<category>web</category>
<category>youtube</category>

</item>

</channel>
</rss>
