diff options
author | Case Duckworth | 2022-07-18 14:39:04 -0500 |
---|---|---|
committer | Case Duckworth | 2022-07-18 14:39:04 -0500 |
commit | 73bc440ac4d0413becb98c78955b97c68cf725b3 (patch) | |
tree | c2b5a03ebb19ec60c297c8918549ffb604256bc1 | |
parent | Add padding (diff) | |
download | sfeed-73bc440ac4d0413becb98c78955b97c68cf725b3.tar.gz sfeed-73bc440ac4d0413becb98c78955b97c68cf725b3.zip |
Add Youtube feed processing
-rwxr-xr-x | sfeed_html.sh | 13 | ||||
-rw-r--r-- | style.css | 6 |
2 files changed, 16 insertions, 3 deletions
diff --git a/sfeed_html.sh b/sfeed_html.sh index 2dd830c..948bf93 100755 --- a/sfeed_html.sh +++ b/sfeed_html.sh | |||
@@ -81,9 +81,11 @@ html_feed() { # html_feed FEED(file) => HTML | |||
81 | 81 | ||
82 | ## ENTRIES | 82 | ## ENTRIES |
83 | entries="$(awk -v NOW="$now" -v FRESH_SECS="$fresh_secs" \ | 83 | entries="$(awk -v NOW="$now" -v FRESH_SECS="$fresh_secs" \ |
84 | -v NAME="$filename" -v ASIDE="$aside" -v limit="$LIMIT" \ | 84 | -v NAME="$filename" -v FNAME="$filename" \ |
85 | -v ASIDE="$aside" -v limit="$LIMIT" \ | ||
85 | 'BEGIN { FS="\t"; fresh_feed = 0; FRESH = (NOW - FRESH_SECS); } | 86 | 'BEGIN { FS="\t"; fresh_feed = 0; FRESH = (NOW - FRESH_SECS); } |
86 | FNR == 1 { nitem = 0; } | 87 | FNR == 1 { nitem = 0; } |
88 | NAME ~ /^\[yt\]/ { sub(/^\[yt\] /, "", NAME); yt = 1; } | ||
87 | function unescape(t) { | 89 | function unescape(t) { |
88 | t = html_escape(t); | 90 | t = html_escape(t); |
89 | gsub(/\\\t/,"\t",t); | 91 | gsub(/\\\t/,"\t",t); |
@@ -141,14 +143,19 @@ html_feed() { # html_feed FEED(file) => HTML | |||
141 | END { | 143 | END { |
142 | if (show_in_sidebar) { | 144 | if (show_in_sidebar) { |
143 | printf "<li%s>", (fresh_feed?" class=\"fresh\"":"") >> ASIDE | 145 | printf "<li%s>", (fresh_feed?" class=\"fresh\"":"") >> ASIDE |
144 | printf "<a href=\"#%s\">%s</a></li>\n", NAME, NAME >> ASIDE | 146 | printf "<a%s href=\"#%s\">%s</a></li>\n", (yt ? " class=\"yt\"" : ""), FNAME, NAME >> ASIDE |
145 | } | 147 | } |
146 | printf "%s", (stamp ? stamp : ".") > "/dev/stderr" | 148 | printf "%s", (stamp ? stamp : ".") > "/dev/stderr" |
147 | }' "$1" | filter_invidious)" | 149 | }' "$1" | filter_invidious)" |
148 | if [ -z "$entries" ]; then return 1; fi | 150 | if [ -z "$entries" ]; then return 1; fi |
149 | echo "<section id=\"$filename\">" | 151 | echo "<section id=\"$filename\">" |
150 | # TODO: Include a link back to the website | 152 | # TODO: Include a link back to the website |
151 | printf '<header><h2><a href="#%s">#</a> %s</h2>\n' "$filename" "$filename" | 153 | case "$filename" in |
154 | \[yt\]*) yt=" class=\"yt\"" ;; | ||
155 | *) yt="" ;; | ||
156 | esac | ||
157 | fn="$(echo "$filename" | sed 's@^\[yt\]@@')" | ||
158 | printf '<header><h2%s><a href="#%s">#</a> %s</h2>\n' "$yt" "$filename" "$fn" | ||
152 | echo "<span class=\"flinks\">" | 159 | echo "<span class=\"flinks\">" |
153 | if [ -f "$SFEED_DATA/urls/$filename" ]; then | 160 | if [ -f "$SFEED_DATA/urls/$filename" ]; then |
154 | feed_url="$(sed -n '1p;1q' "$SFEED_DATA/urls/$filename")" | 161 | feed_url="$(sed -n '1p;1q' "$SFEED_DATA/urls/$filename")" |
diff --git a/style.css b/style.css index 58a6e47..7bdb47d 100644 --- a/style.css +++ b/style.css | |||
@@ -195,3 +195,9 @@ footer a:link { | |||
195 | display: inline; | 195 | display: inline; |
196 | text-decoration: underline; | 196 | text-decoration: underline; |
197 | } | 197 | } |
198 | |||
199 | .yt::after { | ||
200 | content: " *"; | ||
201 | color: red; | ||
202 | size: 50%; | ||
203 | } | ||