check in youtube-feed-improved (draft) - 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 174feb76c952a617db8c3c74442eb00395e27aae
(DIR) parent bad5e2be6c8380de20838988fa999c44db120c7d
(HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Wed, 10 May 2023 20:03:27 +0200
check in youtube-feed-improved (draft)
Diffstat:
A output/downloads/screenshots/sfeed… | 0
A pages/youtube-feed-improved.cfg | 6 ++++++
A pages/youtube-feed-improved.md | 135 +++++++++++++++++++++++++++++++
3 files changed, 141 insertions(+), 0 deletions(-)
---
(DIR) diff --git a/output/downloads/screenshots/sfeed_curses_youtube.png b/output/downloads/screenshots/sfeed_curses_youtube.png
Binary files differ.
(DIR) diff --git a/pages/youtube-feed-improved.cfg b/pages/youtube-feed-improved.cfg
@@ -0,0 +1,6 @@
+title = Improved Youtube RSS/Atom feed
+id = youtube-feed
+description = Improved Youtube Atom feed by adding video duration and filtering away shorts
+keywords = youtube, sfeed, RSS, atom, frontends
+created = 2023-05-10
+updated = 2023-05-10
(DIR) diff --git a/pages/youtube-feed-improved.md b/pages/youtube-feed-improved.md
@@ -0,0 +1,135 @@
+... improved at least for my preferences ;)
+
+
+## Features
+
+* Add the video duration to the title to quickly see how long the video is.
+* Filter away Youtube shorts and upcoming videos / announcements: only videos are shown.
+* Support more output formats: Atom, [JSON Feed](https://www.jsonfeed.org/version/1.1/) or
+ [sfeed](sfeed.1.txt) Tab-Separated-Value format.
+* Easy to build and deploy: can be run as a CGI program as a static-linked binary in a chroot.
+* 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.
+
+
+## How to use
+
+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.
+
+
+Command-line usage:
+
+ youtube_feed channelid atom
+ youtube_feed channelid json
+ youtube_feed channelid tsv
+
+
+CGI program usage:
+
+The last basename part of the URL should be the channelid + the output format
+extension. It defaults to TSV if there is no extension.
+
+For example:
+
+ 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
+
+
+An OpenBSD httpd.conf using slowcgi as an example:
+
+ server "codemadness.org" {
+ location "/yt-chan/*" {
+ request strip 1
+ root "/cgi-bin/yt-chan"
+ fastcgi socket "/run/slowcgi.sock"
+ }
+ }
+
+
+## Using it with [sfeed](sfeed.html)
+
+sfeedrc example of an existing Youtube RSS/Atom feed:
+
+ # 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"
+ }
+
+
+Use the new Atom feed directly using the CGI-mode and Atom output format:
+
+ # 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"
+ }
+
+... or convert directly using a custom connector program on the local system via the command-line:
+
+ # 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"
+ }
+
+
+## Screenshot using sfeed_curses
+
+[](downloads/screenshots/sfeed_curses_youtube.png)
+
+
+## Clone
+
+ git clone git://git.codemadness.org/frontends
+
+
+## Browse
+
+You can browse the source-code at:
+
+* <https://git.codemadness.org/frontends/>
+* <gopher://codemadness.org/1/git/frontends>
+
+The program is:
+ youtube/feed
+
+
+## Dependencies
+
+* C compiler.
+* LibreSSL + libtls.
+
+
+## Build and install
+
+ $ make
+ # make install