some more improvements - www.codemadness.org - www.codemadness.org saait content files (HTM) git clone git://git.codemadness.org/www.codemadness.org (DIR) Log (DIR) Files (DIR) Refs (DIR) README (DIR) LICENSE --- (DIR) commit fb03273317a40856b975a50e0daac30f74bf287c (DIR) parent 174feb76c952a617db8c3c74442eb00395e27aae (HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org> Date: Wed, 10 May 2023 20:06:44 +0200 some more improvements Diffstat: M output/atom.xml | 12 ++++++++++++ M output/atom_content.xml | 122 +++++++++++++++++++++++++++++++ M output/index | 1 + M output/index.html | 1 + M output/rss.xml | 8 ++++++++ M output/rss_content.xml | 117 +++++++++++++++++++++++++++++++ M output/sitemap.xml | 4 ++++ M output/twtxt.txt | 1 + M output/urllist.txt | 1 + M pages/youtube-feed-improved.md | 10 +++++++--- 10 files changed, 274 insertions(+), 3 deletions(-) --- (DIR) diff --git a/output/atom.xml b/output/atom.xml @@ -7,6 +7,18 @@ <id>https://www.codemadness.org/atom.xml</id> <link rel="self" type="application/atom+xml" href="https://www.codemadness.org/atom.xml" /> <entry> + <title>Improved Youtube RSS/Atom feed</title> + <link rel="alternate" type="text/html" href="https://www.codemadness.org/youtube-feed-improved.html" /> + <id>https://www.codemadness.org/youtube-feed-improved.html</id> + <updated>2023-05-10T00:00:00Z</updated> + <published>2023-05-10T00:00:00Z</published> + <author> + <name>Hiltjo</name> + <uri>https://www.codemadness.org</uri> + </author> + <summary>Improved Youtube Atom feed by adding video duration and filtering away shorts</summary> +</entry> +<entry> <title>A simple TODO application</title> <link rel="alternate" type="text/html" href="https://www.codemadness.org/todo-application.html" /> <id>https://www.codemadness.org/todo-application.html</id> (DIR) diff --git a/output/atom_content.xml b/output/atom_content.xml @@ -7,6 +7,128 @@ <id>https://www.codemadness.org/atom_content.xml</id> <link rel="self" type="application/atom+xml" href="https://www.codemadness.org/atom_content.xml" /> <entry> + <title>Improved Youtube RSS/Atom feed</title> + <link rel="alternate" type="text/html" href="https://www.codemadness.org/youtube-feed-improved.html" /> + <id>https://www.codemadness.org/youtube-feed-improved.html</id> + <updated>2023-05-10T00:00:00Z</updated> + <published>2023-05-10T00:00:00Z</published> + <author> + <name>Hiltjo</name> + <uri>https://www.codemadness.org</uri> + </author> + <summary>Improved Youtube Atom feed by adding video duration and filtering away shorts</summary> + <content type="html"><![CDATA[<h1>Improved Youtube RSS/Atom feed</h1> + <p><strong>Last modification on </strong> <time>2023-05-10</time></p> + <p>... improved at least for my preferences ;)</p> +<h2>Features</h2> +<ul> +<li>Add the video duration to the title to quickly see how long the video is.</li> +<li>Filter away Youtube shorts and upcoming videos / announcements: only videos are shown.</li> +<li>Support more output formats: Atom, <a href="https://www.jsonfeed.org/version/1.1/">JSON Feed</a> or +<a href="sfeed.1.txt">sfeed</a> Tab-Separated-Value format.</li> +<li>Easy to build and deploy: can be run as a CGI program as a static-linked binary in a chroot.</li> +<li>Secure: additionally to running in a chroot it can use pledge(2) and unveil(2) +on OpenBSD to restrict system calls and access to the filesystem.</li> +</ul> +<h2>How to use</h2> +<p>There is an option to run directly from the command-line or in CGI-mode. When +the environment variable $REQUEST_URI is set it is automatically run in CGI +mode.</p> +<p>Command-line usage:</p> +<pre><code>youtube_feed channelid atom +youtube_feed channelid json +youtube_feed channelid tsv +</code></pre> +<p>CGI program usage:</p> +<p>The last basename part of the URL should be the channelid + the output format +extension. It defaults to TSV if there is no extension.</p> +<p>For example:</p> +<pre><code>Atom XML: https://codemadness.org/yt-chan/UCrbvoMC0zUvPL8vjswhLOSw.xml +JSON: https://codemadness.org/yt-chan/UCrbvoMC0zUvPL8vjswhLOSw.json +TSV: https://codemadness.org/yt-chan/UCrbvoMC0zUvPL8vjswhLOSw.tsv +TSV, default: https://codemadness.org/yt-chan/UCrbvoMC0zUvPL8vjswhLOSw +</code></pre> +<p>An OpenBSD httpd.conf using slowcgi as an example:</p> +<pre><code>server "codemadness.org" { + location "/yt-chan/*" { + request strip 1 + root "/cgi-bin/yt-chan" + fastcgi socket "/run/slowcgi.sock" + } +} +</code></pre> +<h2>Using it with <a href="sfeed.html">sfeed</a></h2> +<p>sfeedrc example of an existing Youtube RSS/Atom feed:</p> +<pre><code># list of feeds to fetch: +feeds() { + # feed <name> <feedurl> [basesiteurl] [encoding] + # normal Youtube Atom feed. + feed "yt IM" "https://www.youtube.com/feeds/videos.xml?channel_id=UCrbvoMC0zUvPL8vjswhLOSw" +} +</code></pre> +<p>Use the new Atom feed directly using the CGI-mode and Atom output format:</p> +<pre><code># list of feeds to fetch: +feeds() { + # feed <name> <feedurl> [basesiteurl] [encoding] + # new Youtube Atom feed. + feed "idiotbox IM" "https://codemadness.org/yt-chan/UCrbvoMC0zUvPL8vjswhLOSw.xml" +} +</code></pre> +<p>... or convert directly using a custom connector program on the local system via the command-line:</p> +<pre><code># fetch(name, url, feedfile) +fetch() { + case "$1" in + "connector example") + youtube_feed "$2";; + *) + curl -L --max-redirs 0 -H "User-Agent:" -f -s -m 15 \ + "$2" 2>/dev/null;; + esac +} + +# parse and convert input, by default XML to the sfeed(5) TSV format. +# parse(name, feedurl, basesiteurl) +parse() { + case "$1" in + "connector example") + cat;; + *) + sfeed "$3";; + esac +} + +# list of feeds to fetch: +feeds() { + # feed <name> <feedurl> [basesiteurl] [encoding] + feed "connector example" "UCrbvoMC0zUvPL8vjswhLOSw" +} +</code></pre> +<h2>Screenshot using sfeed_curses</h2> +<p><a href="downloads/screenshots/sfeed_curses_youtube.png"><img src="downloads/screenshots/sfeed_curses_youtube.png" alt="Screenshot showing the improved Youtube feed" width="480" height="270" loading="lazy" /></a></p> +<h2>Clone</h2> +<pre><code>git clone git://git.codemadness.org/frontends +</code></pre> +<h2>Browse</h2> +<p>You can browse the source-code at:</p> +<ul> +<li><a href="https://git.codemadness.org/frontends/">https://git.codemadness.org/frontends/</a></li> +<li><a href="gopher://codemadness.org/1/git/frontends">gopher://codemadness.org/1/git/frontends</a></li> +</ul> +<p>The program is: youtube/feed</p> +<h2>Dependencies</h2> +<ul> +<li>C compiler.</li> +<li>LibreSSL + libtls.</li> +</ul> +<h2>Build and install</h2> +<pre><code>$ make +# make install +</code></pre> +<h1>That's all</h1> +<p>I hope by sharing this it is useful to someone other than me as well.</p> +]]></content> +</entry> +<entry> <title>A simple TODO application</title> <link rel="alternate" type="text/html" href="https://www.codemadness.org/todo-application.html" /> <id>https://www.codemadness.org/todo-application.html</id> (DIR) diff --git a/output/index b/output/index @@ -11,6 +11,7 @@ i codemadness.org 70 i codemadness.org 70 iPhlog posts codemadness.org 70 i codemadness.org 70 +12023-05-10 Improved Youtube RSS/Atom feed /phlog/youtube-feed codemadness.org 70 12022-07-01 A simple TODO application /phlog/todo codemadness.org 70 12022-03-23 2FA TOTP without crappy authenticator apps /phlog/totp codemadness.org 70 12021-10-23 Setup an OpenBSD RISCV64 VM in QEMU /phlog/openbsd-riscv64-vm codemadness.org 70 (DIR) diff --git a/output/index.html b/output/index.html @@ -40,6 +40,7 @@ <div id="main"> <h1>Posts</h1> <table> +<tr><td><time>2023-05-10</time></td><td><a href="youtube-feed-improved.html">Improved Youtube RSS/Atom feed</a></td></tr> <tr><td><time>2022-07-01</time></td><td><a href="todo-application.html">A simple TODO application</a></td></tr> <tr><td><time>2022-03-23</time></td><td><a href="totp.html">2FA TOTP without crappy authenticator apps</a></td></tr> <tr><td><time>2021-10-23</time></td><td><a href="openbsd-riscv64-vm.html">Setup an OpenBSD RISCV64 VM in QEMU</a></td></tr> (DIR) diff --git a/output/rss.xml b/output/rss.xml @@ -7,6 +7,14 @@ <description>blog with various projects and articles about computer-related things</description> <link>https://www.codemadness.org</link> <item> + <title>Improved Youtube RSS/Atom feed</title> + <link>https://www.codemadness.org/youtube-feed-improved.html</link> + <guid>https://www.codemadness.org/youtube-feed-improved.html</guid> + <dc:date>2023-05-10T00:00:00Z</dc:date> + <author>Hiltjo</author> + <description>Improved Youtube Atom feed by adding video duration and filtering away shorts</description> +</item> +<item> <title>A simple TODO application</title> <link>https://www.codemadness.org/todo-application.html</link> <guid>https://www.codemadness.org/todo-application.html</guid> (DIR) diff --git a/output/rss_content.xml b/output/rss_content.xml @@ -7,6 +7,123 @@ <description>blog with various projects and articles about computer-related things</description> <link>https://www.codemadness.org</link> <item> + <title>Improved Youtube RSS/Atom feed</title> + <link>https://www.codemadness.org/youtube-feed-improved.html</link> + <guid>https://www.codemadness.org/youtube-feed-improved.html</guid> + <dc:date>2023-05-10T00:00:00Z</dc:date> + <author>Hiltjo</author> + <description><![CDATA[<h1>Improved Youtube RSS/Atom feed</h1> + <p><strong>Last modification on </strong> <time>2023-05-10</time></p> + <p>... improved at least for my preferences ;)</p> +<h2>Features</h2> +<ul> +<li>Add the video duration to the title to quickly see how long the video is.</li> +<li>Filter away Youtube shorts and upcoming videos / announcements: only videos are shown.</li> +<li>Support more output formats: Atom, <a href="https://www.jsonfeed.org/version/1.1/">JSON Feed</a> or +<a href="sfeed.1.txt">sfeed</a> Tab-Separated-Value format.</li> +<li>Easy to build and deploy: can be run as a CGI program as a static-linked binary in a chroot.</li> +<li>Secure: additionally to running in a chroot it can use pledge(2) and unveil(2) +on OpenBSD to restrict system calls and access to the filesystem.</li> +</ul> +<h2>How to use</h2> +<p>There is an option to run directly from the command-line or in CGI-mode. When +the environment variable $REQUEST_URI is set it is automatically run in CGI +mode.</p> +<p>Command-line usage:</p> +<pre><code>youtube_feed channelid atom +youtube_feed channelid json +youtube_feed channelid tsv +</code></pre> +<p>CGI program usage:</p> +<p>The last basename part of the URL should be the channelid + the output format +extension. It defaults to TSV if there is no extension.</p> +<p>For example:</p> +<pre><code>Atom XML: https://codemadness.org/yt-chan/UCrbvoMC0zUvPL8vjswhLOSw.xml +JSON: https://codemadness.org/yt-chan/UCrbvoMC0zUvPL8vjswhLOSw.json +TSV: https://codemadness.org/yt-chan/UCrbvoMC0zUvPL8vjswhLOSw.tsv +TSV, default: https://codemadness.org/yt-chan/UCrbvoMC0zUvPL8vjswhLOSw +</code></pre> +<p>An OpenBSD httpd.conf using slowcgi as an example:</p> +<pre><code>server "codemadness.org" { + location "/yt-chan/*" { + request strip 1 + root "/cgi-bin/yt-chan" + fastcgi socket "/run/slowcgi.sock" + } +} +</code></pre> +<h2>Using it with <a href="sfeed.html">sfeed</a></h2> +<p>sfeedrc example of an existing Youtube RSS/Atom feed:</p> +<pre><code># list of feeds to fetch: +feeds() { + # feed <name> <feedurl> [basesiteurl] [encoding] + # normal Youtube Atom feed. + feed "yt IM" "https://www.youtube.com/feeds/videos.xml?channel_id=UCrbvoMC0zUvPL8vjswhLOSw" +} +</code></pre> +<p>Use the new Atom feed directly using the CGI-mode and Atom output format:</p> +<pre><code># list of feeds to fetch: +feeds() { + # feed <name> <feedurl> [basesiteurl] [encoding] + # new Youtube Atom feed. + feed "idiotbox IM" "https://codemadness.org/yt-chan/UCrbvoMC0zUvPL8vjswhLOSw.xml" +} +</code></pre> +<p>... or convert directly using a custom connector program on the local system via the command-line:</p> +<pre><code># fetch(name, url, feedfile) +fetch() { + case "$1" in + "connector example") + youtube_feed "$2";; + *) + curl -L --max-redirs 0 -H "User-Agent:" -f -s -m 15 \ + "$2" 2>/dev/null;; + esac +} + +# parse and convert input, by default XML to the sfeed(5) TSV format. +# parse(name, feedurl, basesiteurl) +parse() { + case "$1" in + "connector example") + cat;; + *) + sfeed "$3";; + esac +} + +# list of feeds to fetch: +feeds() { + # feed <name> <feedurl> [basesiteurl] [encoding] + feed "connector example" "UCrbvoMC0zUvPL8vjswhLOSw" +} +</code></pre> +<h2>Screenshot using sfeed_curses</h2> +<p><a href="downloads/screenshots/sfeed_curses_youtube.png"><img src="downloads/screenshots/sfeed_curses_youtube.png" alt="Screenshot showing the improved Youtube feed" width="480" height="270" loading="lazy" /></a></p> +<h2>Clone</h2> +<pre><code>git clone git://git.codemadness.org/frontends +</code></pre> +<h2>Browse</h2> +<p>You can browse the source-code at:</p> +<ul> +<li><a href="https://git.codemadness.org/frontends/">https://git.codemadness.org/frontends/</a></li> +<li><a href="gopher://codemadness.org/1/git/frontends">gopher://codemadness.org/1/git/frontends</a></li> +</ul> +<p>The program is: youtube/feed</p> +<h2>Dependencies</h2> +<ul> +<li>C compiler.</li> +<li>LibreSSL + libtls.</li> +</ul> +<h2>Build and install</h2> +<pre><code>$ make +# make install +</code></pre> +<h1>That's all</h1> +<p>I hope by sharing this it is useful to someone other than me as well.</p> +]]></description> +</item> +<item> <title>A simple TODO application</title> <link>https://www.codemadness.org/todo-application.html</link> <guid>https://www.codemadness.org/todo-application.html</guid> (DIR) diff --git a/output/sitemap.xml b/output/sitemap.xml @@ -1,6 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <url> + <loc>https://www.codemadness.org/youtube-feed-improved.html</loc> + <lastmod>2023-05-10</lastmod> +</url> +<url> <loc>https://www.codemadness.org/todo-application.html</loc> <lastmod>2022-07-01</lastmod> </url> (DIR) diff --git a/output/twtxt.txt b/output/twtxt.txt @@ -1,3 +1,4 @@ +2023-05-10T00:00:00Z Improved Youtube RSS/Atom feed: https://www.codemadness.org/youtube-feed-improved.html 2022-07-01T00:00:00Z A simple TODO application: https://www.codemadness.org/todo-application.html 2022-03-23T00:00:00Z 2FA TOTP without crappy authenticator apps: https://www.codemadness.org/totp.html 2021-10-23T00:00:00Z Setup an OpenBSD RISCV64 VM in QEMU: https://www.codemadness.org/openbsd-riscv64-vm.html (DIR) diff --git a/output/urllist.txt b/output/urllist.txt @@ -1,3 +1,4 @@ +https://www.codemadness.org/youtube-feed-improved.html https://www.codemadness.org/todo-application.html https://www.codemadness.org/totp.html https://www.codemadness.org/openbsd-riscv64-vm.html (DIR) diff --git a/pages/youtube-feed-improved.md b/pages/youtube-feed-improved.md @@ -119,8 +119,7 @@ You can browse the source-code at: * <https://git.codemadness.org/frontends/> * <gopher://codemadness.org/1/git/frontends> -The program is: - youtube/feed +The program is: youtube/feed ## Dependencies @@ -128,8 +127,13 @@ The program is: * C compiler. * LibreSSL + libtls. - + ## Build and install $ make # make install + + +# That's all + +I hope by sharing this it is useful to someone other than me as well.