pub / newsplanet

Planet-Style Newsfeed generated with perlanet
git clone https://src.jayvii.de/pub/newsplanet.git
Home | Log | Files | Exports | Refs | README | RSS

commit 64a8ca17f53d6c71d7f0a05e42ee82775e43fc92
parent 3eeb4b2c54676ef4d9eb4788e5e978720f6309f9
Author: JayVii <jayvii[AT]posteo[DOT]de>
Date:   Sun, 27 Oct 2024 13:02:28 +0100

feat: add second newsfeed: Links!

Diffstat:
Dconfig.yaml | 40----------------------------------------
Ageneral.yaml | 40++++++++++++++++++++++++++++++++++++++++
Alinks.yaml | 36++++++++++++++++++++++++++++++++++++
Mrun.sh | 30+++++++++++++++++++++++-------
Mtemplate.html | 2+-
5 files changed, 100 insertions(+), 48 deletions(-)

diff --git a/config.yaml b/config.yaml @@ -1,40 +0,0 @@ -title: Newsplanet -description: Planet-style news feed -url: https://news.jayvii.de -entries: 5000 -entries_per_feed: 20 -entries_sort_order: "issued" -author: - name: JayVii - email: jayvii+newsplanet[AT]posteo[DOT]de -opml: opml.xml -page: - file: index.html - template: template.html -feed: - file: rss.xml - format: RSS -cache_dir: /tmp/newsplanet -feeds: - - title: Tagesschau - url: https://www.tagesschau.de/inland/index~rss2.xml - web: https://www.tagesschau.de/inland - - title: Tagesschau - url: https://www.tagesschau.de/ausland/index~rss2.xml - web: https://www.tagesschau.de/ausland - - title: Tagesschau - url: https://www.tagesschau.de/wirtschaft/index~rss2.xml - web: https://www.tagesschau.de/wirtschaft - - title: Deutschlandfunk - url: https://www.deutschlandfunk.de/nachrichten-100.rss - web: https://www.deutschlandfunk.de/nachrichten-100.html - - title: Deutschlandfunk - url: https://www.deutschlandfunk.de/politikportal-100.rss - web: https://www.deutschlandfunk.de/politikportal-100.html - - title: Deutschlandfunk - url: https://www.deutschlandfunk.de/wirtschaft-106.rss - web: https://www.deutschlandfunk.de/wirtschaft-106.html - - title: Deutschlandfunk - url: https://www.deutschlandfunk.de/presseschauen-100.rss - web: https://www.deutschlandfunk.de/presseschauen-100.html - max_entries: 16 # 4 times a day, 3 days diff --git a/general.yaml b/general.yaml @@ -0,0 +1,40 @@ +title: Newsplanet +description: Planet-style news feed +url: https://news.jayvii.de +entries: 5000 +entries_per_feed: 20 +entries_sort_order: "issued" +author: + name: JayVii + email: jayvii+newsplanet[AT]posteo[DOT]de +opml: opml.xml +page: + file: index.html + template: template.html +feed: + file: index.xml + format: RSS +cache_dir: /tmp/newsplanet +feeds: + - title: Tagesschau + url: https://www.tagesschau.de/inland/index~rss2.xml + web: https://www.tagesschau.de/inland + - title: Tagesschau + url: https://www.tagesschau.de/ausland/index~rss2.xml + web: https://www.tagesschau.de/ausland + - title: Tagesschau + url: https://www.tagesschau.de/wirtschaft/index~rss2.xml + web: https://www.tagesschau.de/wirtschaft + - title: Deutschlandfunk + url: https://www.deutschlandfunk.de/nachrichten-100.rss + web: https://www.deutschlandfunk.de/nachrichten-100.html + - title: Deutschlandfunk + url: https://www.deutschlandfunk.de/politikportal-100.rss + web: https://www.deutschlandfunk.de/politikportal-100.html + - title: Deutschlandfunk + url: https://www.deutschlandfunk.de/wirtschaft-106.rss + web: https://www.deutschlandfunk.de/wirtschaft-106.html + - title: Deutschlandfunk + url: https://www.deutschlandfunk.de/presseschauen-100.rss + web: https://www.deutschlandfunk.de/presseschauen-100.html + max_entries: 16 # 4 times a day, 3 days diff --git a/links.yaml b/links.yaml @@ -0,0 +1,36 @@ +title: Newsplanet (Links) +description: Planet-style news feed +url: https://news.jayvii.de +entries: 5000 +entries_per_feed: 20 +entries_sort_order: "issued" +author: + name: JayVii + email: jayvii+newsplanet[AT]posteo[DOT]de +opml: opml.xml +page: + file: links.html + template: template.html +feed: + file: links.xml + format: RSS +cache_dir: /tmp/newsplanet +feeds: + - title: Taz + url: https://taz.de/Themen-des-Tages/!p15;rss/ + web: https://taz.de/Themen-des-Tages/!p15/ + - title: Taz + url: https://taz.de/Politik/!p4615;rss/ + web: https://taz.de/Politik/!p4615/ + - title: Taz + url: https://taz.de/Oeko/Oekonomie/!p4623;rss/ + web: https://taz.de/Oeko/Oekonomie/!p4623/ + - title: Freitag + url: https://www.freitag.de/gruenes-wissen/@@RSS + web: https://www.freitag.de/gruenes-wissen/ + - title: Freitag + url: https://www.freitag.de/politik/@@RSS + web: https://www.freitag.de/politik/ + - title: Freitag + url: https://www.freitag.de/wirtschaft/@@RSS + web: https://www.freitag.de/wirtschaft/ diff --git a/run.sh b/run.sh @@ -1,31 +1,47 @@ #!/usr/bin/env sh +# fetch input config file, fall back to "general" +if [ -z $1 ]; then + CONFIG="general.yaml" +else + CONFIG="$1" +fi + # Generate site printf "Fetching feeds and generating html...\n" -perlanet config.yaml +perlanet "$CONFIG" + +# fetch name of resulting html file +HTML=`grep -E '^\s+file:.*?\.html\s*$' "$CONFIG" | awk '{ print $NF }'` + +# fetch name of resulting xml file +XML=`grep -E '^\s+file:.*?\.xml\s*$' "$CONFIG" | awk '{ print $NF }'` + +# insert link to rss/xml file +sed -E -e "s/<!--XML-->/\"$XML\"/" -i "$HTML" # remove images and iframes from article previews printf "Removing images and iframes...\n" -sed -E -e 's/<img[^>]*>//g' -e 's/<iframe[^>]*>//g' -i index.html +sed -E -e 's/<img[^>]*>//g' -e 's/<iframe[^>]*>//g' -i "$HTML" # remove linebreaks and empty paragraphs printf "Clean up HTML...\n" -sed -E -e 's/<br[^a-z]*[^>]*>//g' -e 's/<p[^a-z]*[^>]*><\/p>//g' -i index.html +sed -E -e 's/<br[^a-z]*[^>]*>//g' -e 's/<p[^a-z]*[^>]*><\/p>//g' -i "$HTML" # insert favicon image buttons printf "Insert favicons...\n" -sed -E -e 's/<!--IMG\ src=\"(https:\/\/[^\/]*)[^\"]*(\"[^>]*>)-->/<img src=\"\1\/favicon.ico\2/g' -i index.html +sed -E -e 's/<!--IMG\ src=\"(https:\/\/[^\/]*)[^\"]*(\"[^>]*>)-->/<img src=\"\1\/favicon.ico\2/g' -i "$HTML" # Insert feeds list printf "Inserting feeds list...\n" FEEDS=` - grep -E '^\s*web:' config.yaml | \ + grep -E '^\s*web:' "$CONFIG" | \ awk '{ print "<a href=\""$NF"\">"$NF"</a><br>" }' | \ sed -e 's/\//\\\\\//g' -ze's/\n//g' ` -sed -E -e "s/<!--FEEDS-->/$FEEDS/" -i index.html +sed -E -e "s/<!--FEEDS-->/$FEEDS/" -i "$HTML" # Insert Update time printf "Inserting update time...\n" DATE=`date +%c` -sed -E -e "s/<!--UPDATED-->/$DATE/" -i index.html +sed -E -e "s/<!--UPDATED-->/$DATE/" -i "$HTML" diff --git a/template.html b/template.html @@ -74,7 +74,7 @@ <!-- RSS Button --> <a class="button" - href="./rss.xml" + href=<!--XML--> > RSS Feed </a>