sfeed: sync config and update youtube connector - randomcrap - random crap programs of varying quality
(HTM) git clone git://git.codemadness.org/randomcrap
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 2dec46b8c9cc5ab2c9cc9b7fcdf6b51562afa6b5
(DIR) parent 9ae7ac3d5dd71d197dc1ad9e4d3821c72e3f16f4
(HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Wed, 10 May 2023 20:49:03 +0200
sfeed: sync config and update youtube connector
Diffstat:
M config/sfeed/connectors/youtube-vi… | 39 ++-----------------------------
M config/sfeed/filter | 10 +++++-----
M config/sfeed/global | 3 +++
3 files changed, 10 insertions(+), 42 deletions(-)
---
(DIR) diff --git a/config/sfeed/connectors/youtube-videos-with-duration b/config/sfeed/connectors/youtube-videos-with-duration
@@ -1,5 +1,5 @@
#!/bin/sh
-# Dependencies: frontends/youtube/channel2tsv
+# Dependencies: frontends/youtube/feed
# youtube_with_duration(url)
youtube_with_duration() {
@@ -18,42 +18,7 @@ youtube_with_duration() {
return
fi
- f1="$(mktemp)"
- f2="$(mktemp)"
-
- # first output to "$f2"
- sfeed > "$f2"
-
- # get channel data.
- youtube_channel2tsv "$channelid" > "$f1"
-
- # combine data and output it.
- LC_ALL=C awk -v "f1=$f1" -v "f2=$f2" '
-BEGIN {
- FS = OFS = "\t";
-}
-FILENAME == f1 {
- durations[$1] = $6;
-}
-FILENAME == f2 {
- # quick way to get video ID after v parameter.
- idx = index($3, "v=");
- if (idx > 1) {
- id = substr($3, idx + 2);
-
- # Add duration to title if it can be found.
- # Currently the channel videos page has 30 videos, the Atom
- # feed has 15, so they usually match, Youitube shorts,
- # upcoming video announcements or livestreams typically do not match.
- # This is a feature imho, because it allows filtering them away.
- if (durations[id])
- $2 = $2 " [" durations[id] "]";
- }
- print $0;
-}
-' "$f1" "$f2"
-
- rm -f "$f1" "$f2"
+ youtube_feed "$channelid"
}
youtube_with_duration_test() {
(DIR) diff --git a/config/sfeed/filter b/config/sfeed/filter
@@ -181,11 +181,11 @@ filter() {
return s
}
function filtertitle(s) {
- gsub("̵[67];", "'"'"'", s);
- gsub("<[/]?em>", "_", s);
- gsub("<[/]?b>", "*", s);
- gsub("<[/]?nobr>", "", s);
- gsub("<[/]?wbr>", "", s);
+ #gsub("̵[67];", "'"'"'", s);
+ #gsub("<[/]?em>", "_", s);
+ #gsub("<[/]?b>", "*", s);
+ #gsub("<[/]?nobr>", "", s);
+ #gsub("<[/]?wbr>", "", s);
return s;
}
{
(DIR) diff --git a/config/sfeed/global b/config/sfeed/global
@@ -48,6 +48,9 @@ fetch() {
*://lobste.rs/*)
# requires User-Agent
useragent="bla";;
+ *://old.reddit.com/*)
+ # requires User-Agent
+ useragent="007";;
*)
useragent="";;
esac