<?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 url)</title>
    <link>https://daniel-lange.com/</link>
    <description>agrep -pB IT /dev/life</description>
    <dc:language>en</dc:language>
    <generator>Serendipity 2.6.0 - http://www.s9y.org/</generator>
    <pubDate>Thu, 02 Jun 2022 16:38:50 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>https://daniel-lange.com/</link>
    <width>144</width>
    <height>234</height>
</image>

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

    <slash:comments>3</slash:comments>
    <wfw:commentRss>https://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;https://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;https://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;02.06.2022:
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;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">https://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>
<item>
    <title>Seredipity default event_s9ymarkup plugin breaking URLs that contain underscores</title>
    <link>https://daniel-lange.com/archives/28-Seredipity-default-event_s9ymarkup-plugin-breaking-URLs-that-contain-underscores.html</link>
            <category>Serendipity</category>
    
    <comments>https://daniel-lange.com/archives/28-Seredipity-default-event_s9ymarkup-plugin-breaking-URLs-that-contain-underscores.html#comments</comments>
    <wfw:comment>https://daniel-lange.com/wfwcomment.php?cid=28</wfw:comment>

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

    <author>nospam@example.com (Daniel Lange)</author>
    <content:encoded>
    &lt;p&gt;
The default Serendipity mark-up plugin (event_s9ymarkup) currently breaks URLs that contain underscores.&lt;/p&gt;

&lt;p&gt;So
&lt;/p&gt;

&lt;blockquote&gt;http://en.wikipedia.org/wiki/Statler_%26_Waldorf&lt;/blockquote&gt;

&lt;p&gt;will end up&lt;/p&gt;

&lt;blockquote&gt;http://en.wikipedia.org/wiki/Statler&amp;lt;/u&amp;gt;%26_Waldorf&lt;/blockquote&gt;

&lt;p /&gt;

&lt;p&gt;
because of a faulty regex.

Garvin Hicking does not really want to fix this. (See &lt;a target=&quot;_blank&quot; title=&quot;Serendipity Forums: serendipity_event_s9ymarkup adds &lt;/u&gt; to URLs breaking&quot; href=&quot;http://board.s9y.org/viewtopic.php?p=72455&quot;&gt;this&lt;/a&gt; s9y support forum article for arguments pro/contra fixing it). So if you encounter this problem, your options are:
&lt;/p&gt;

&lt;ul&gt;&lt;li&gt;replace _ in URLs with %5F (aka manually urlencode it)&lt;/li&gt;&lt;li&gt;remove the plugin or disable it
&lt;/li&gt;&lt;li&gt;patch the plugin&lt;/li&gt;&lt;/ul&gt;

&lt;p&gt;Patching is basically changing&lt;/p&gt;

&lt;p&gt;&lt;font face=&quot;courier new,courier,monospace&quot;&gt;plugins/serendipity_event_s9ymarkup/serendipity_event_s9ymarkup.php&lt;/font&gt;:&lt;br /&gt;&lt;/p&gt;

&lt;blockquote&gt;$text = preg_replace(&#039;/\b_([\S ]+?)_\b/&#039;,&#039;&amp;lt;u&amp;gt;\1&amp;lt;/u&amp;gt;&#039;,$text);&lt;/blockquote&gt;

&lt;p&gt;to&lt;/p&gt;

&lt;blockquote&gt;$text = preg_replace(&#039;/\ _([\S ]+?)_\ /&#039;,&#039; &amp;lt;u&amp;gt;\1&amp;lt;/u&amp;gt; &#039;,$text);&lt;/blockquote&gt;

&lt;p&gt;If you want to be writing things like &amp;quot;Haha[&lt;em&gt;lol&lt;/em&gt;]&amp;quot; (which I have no real use for ...), extend the &amp;quot;\ &amp;quot; with whatever you&#039;d like to be o.k. to delimit &lt;em&gt;bolded&lt;/em&gt; words beyond blanks. It should only be symbols that are not valid in URLs (so none of &amp;quot;$-_.+!*&#039;(),&amp;quot; which are all valid in URLs according to &lt;a title=&quot;RFC 1738 - Uniform Resource Locators (URL)&quot; target=&quot;_blank&quot; href=&quot;http://www.ietf.org/rfc/rfc1738.txt&quot;&gt;RFC 1738&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;You may also want to consider replacing one underscore (&amp;quot;_&amp;quot;) with two or more (&amp;quot;__&amp;quot;) to make the detection, that you actually wanted to write bold text, more reliable.&lt;/p&gt;
 
    </content:encoded>

    <pubDate>Fri, 11 Apr 2008 11:30:00 +0000</pubDate>
    <guid isPermaLink="false">https://daniel-lange.com/archives/28-guid.html</guid>
    <category>bug</category>
<category>html</category>
<category>plugin</category>
<category>serendipity</category>
<category>underscore</category>
<category>url</category>

</item>

</channel>
</rss>
