mirror of
https://github.com/kmein/niveum
synced 2026-03-17 18:41:09 +01:00
radio-news: good news only
This commit is contained in:
@@ -23,20 +23,24 @@ in {
|
|||||||
startAt = "*:50";
|
startAt = "*:50";
|
||||||
script = ''
|
script = ''
|
||||||
set -efu
|
set -efu
|
||||||
PATH=$PATH:${lib.makeBinPath [pkgs.w3m pkgs.gnused pkgs.curl pkgs.jq]}
|
PATH=$PATH:${lib.makeBinPath [pkgs.w3m pkgs.gnused pkgs.curl pkgs.jq pkgs.yq]}
|
||||||
|
|
||||||
export GEMINI_API_KEY="$(cat "$CREDENTIALS_DIRECTORY/gemini-api-key")"
|
export GEMINI_API_KEY="$(cat "$CREDENTIALS_DIRECTORY/gemini-api-key")"
|
||||||
|
|
||||||
WIKI_URL="https://en.wikipedia.org/wiki/Portal:Current_events"
|
EVENTS=$(
|
||||||
|
curl https://www.goodnewsnetwork.org/feed/ \
|
||||||
EVENTS=$(w3m -dump "$WIKI_URL" | sed -n "/$(date -I)/,/$(date -I -d yesterday)/p" | head -n -1)
|
| xq '
|
||||||
|
.rss.channel.item
|
||||||
|
| map(select((.pubDate|strptime("%a, %d %b %Y %H:%M:%S %z")) as $date | ($date | mktime) > (now - (60 * 60 * 24))) | {title, description})
|
||||||
|
'
|
||||||
|
)
|
||||||
|
|
||||||
SYSTEM_PROMPT=$(cat <<EOF
|
SYSTEM_PROMPT=$(cat <<EOF
|
||||||
You are a news anchor writing a short news digest for a radio broadcast.
|
You are a news anchor writing a short news digest for a radio broadcast.
|
||||||
Summarize the following news headlines into a cohesive, engaging script under 400 words.
|
Summarize the following news headlines into a cohesive, engaging script under 400 words.
|
||||||
Keep it professional, concise, and easy to follow.
|
Keep it professional, concise, and easy to follow.
|
||||||
|
|
||||||
Begin the digest with: "Here's your news update for $(date -u +"%B %d, %Y")."
|
Begin the digest with: "Here's your good news update for $(date -u +"%B %d, %Y")."
|
||||||
EOF
|
EOF
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -53,8 +57,7 @@ in {
|
|||||||
{
|
{
|
||||||
"parts": [
|
"parts": [
|
||||||
{
|
{
|
||||||
"text": "Current events (from Wikipedia): $(echo "$EVENTS")"
|
"text": $(jq -Rs <<< "$EVENTS")
|
||||||
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user