diff options
author | Case Duckworth | 2022-07-19 15:00:46 -0500 |
---|---|---|
committer | Case Duckworth | 2022-07-19 15:00:46 -0500 |
commit | f9d86ec57f17b320d8dc2e9f63618cbd5cbbb25a (patch) | |
tree | ba8d4c5d14ed455f994355faa1934d7dc7f33307 | |
parent | Improve logging (diff) | |
download | sfeed-f9d86ec57f17b320d8dc2e9f63618cbd5cbbb25a.tar.gz sfeed-f9d86ec57f17b320d8dc2e9f63618cbd5cbbb25a.zip |
Add further silo processing
-rwxr-xr-x | runsfeed | 8 | ||||
-rwxr-xr-x | sfeed_html.sh | 17 |
2 files changed, 17 insertions, 8 deletions
diff --git a/runsfeed b/runsfeed index 0db2bac..4c1aef0 100755 --- a/runsfeed +++ b/runsfeed | |||
@@ -23,10 +23,10 @@ main() { | |||
23 | test -d "$sfeedpath" || mkdir -p "$sfeedpath" | 23 | test -d "$sfeedpath" || mkdir -p "$sfeedpath" |
24 | touch /tmp/runsfeed.ok | 24 | touch /tmp/runsfeed.ok |
25 | 25 | ||
26 | if ! $NOFETCH; then | 26 | # if ! $NOFETCH; then |
27 | logok "Finding Invidious host" \ | 27 | # logok "Finding Invidious host" \ |
28 | get_invidious_url "https://api.invidious.io/instances.json?sort_by=health" | 28 | # get_invidious_url "https://api.invidious.io/instances.json?sort_by=health" |
29 | fi | 29 | # fi |
30 | logok "Removing unsubscribed feeds" \ | 30 | logok "Removing unsubscribed feeds" \ |
31 | remove_unsubs "$sfeedrc" | 31 | remove_unsubs "$sfeedrc" |
32 | logok -n "Updating feeds" \ | 32 | logok -n "Updating feeds" \ |
diff --git a/sfeed_html.sh b/sfeed_html.sh index 9fc749d..b245f0b 100755 --- a/sfeed_html.sh +++ b/sfeed_html.sh | |||
@@ -69,8 +69,9 @@ EOF | |||
69 | 69 | ||
70 | filter_invidious() { | 70 | filter_invidious() { |
71 | # Convert youtube links to invidious links | 71 | # Convert youtube links to invidious links |
72 | host="$(cat /tmp/invidious.host)" | 72 | sed -e "s@https://www\.youtube\.com@https://invidious.snopyta.org@" \ |
73 | sed "s@https://www\.youtube\.com@${host}@" | 73 | -e 's@https://i\.reddit\.com@https://libreddit.spike.codes@' \ |
74 | -e 's@https://twitter\.com@https://nitter.net@' | ||
74 | } | 75 | } |
75 | 76 | ||
76 | html_feed() { # html_feed FEED(file) => HTML | 77 | html_feed() { # html_feed FEED(file) => HTML |
@@ -136,7 +137,7 @@ html_feed() { # html_feed FEED(file) => HTML | |||
136 | printf "%s", "<a href=\"" id "\" target=\"_blank\">" stamp "</a>" | 137 | printf "%s", "<a href=\"" id "\" target=\"_blank\">" stamp "</a>" |
137 | } | 138 | } |
138 | print "</td>" | 139 | print "</td>" |
139 | printf "<td class=\"entry-title%s", (link ~ /youtube/ ? " youtube" : "") | 140 | printf "<td class=\"entry-title%s", silo_links(link) |
140 | print "\"><a href=\"" link "\" target=\"_blank\">" title "</a></td>" | 141 | print "\"><a href=\"" link "\" target=\"_blank\">" title "</a></td>" |
141 | print "</tr>" | 142 | print "</tr>" |
142 | } | 143 | } |
@@ -146,7 +147,15 @@ html_feed() { # html_feed FEED(file) => HTML | |||
146 | printf "<a%s href=\"#%s\">%s</a></li>\n", (yt ? " class=\"yt\"" : ""), FNAME, NAME >> ASIDE | 147 | printf "<a%s href=\"#%s\">%s</a></li>\n", (yt ? " class=\"yt\"" : ""), FNAME, NAME >> ASIDE |
147 | } | 148 | } |
148 | printf "%s", (stamp ? stamp : ".") > "/dev/stderr" | 149 | printf "%s", (stamp ? stamp : ".") > "/dev/stderr" |
149 | }' "$1" | filter_invidious)" | 150 | } |
151 | function silo_links(link) { | ||
152 | if (link ~ /youtube\.com/) return " youtube" | ||
153 | if (link ~ /facebook\.com/) return " facebook" | ||
154 | if (link ~ /twitter\.com/) return " twitter" | ||
155 | if (link ~ /reddit\.com/) return " reddit" | ||
156 | return "" | ||
157 | } | ||
158 | ' "$1" | filter_invidious)" | ||
150 | if [ -z "$entries" ]; then return 1; fi | 159 | if [ -z "$entries" ]; then return 1; fi |
151 | echo "<section id=\"$filename\">" | 160 | echo "<section id=\"$filename\">" |
152 | # TODO: Include a link back to the website | 161 | # TODO: Include a link back to the website |