cleanup and add README

This commit is contained in:
2025-06-29 14:25:55 -04:00
parent 6d5eb310c5
commit 978a8e5c7c
2 changed files with 53 additions and 9 deletions

19
run.sh
View File

@ -9,18 +9,17 @@ process() {
local eid="$1"
local title="$2"
echo "processing entry: $eid title: $title"
title=${title//$/✓}
echo "Downloding content. entry: $eid title: $title"
curl --fail -o /dev/null -s "$MURL/v1/entries/$eid/fetch-content" \
--url-query update_content=true \
-H "X-Auth-Token: $MINIFLUX_TOKEN"
echo "Updating title. entry: $eid title: $title"
curl --fail -o /dev/null -s -X PUT "$MURL/v1/entries/$eid" \
--json "$(printf '{"title":"%s"}' "$title")" \
--json "$(printf '{"title":"%s"}' "${title/$/✓}")" \
-H "X-Auth-Token: $MINIFLUX_TOKEN"
echo "Marking as unread. entry: $eid title: $title"
curl --fail -s -X PUT "$MURL/v1/entries" \
--json "$(printf '{"entry_ids":[%s],"status":"unread"}' "$eid")" \
-H "X-Auth-Token: $MINIFLUX_TOKEN"
@ -31,7 +30,7 @@ main() {
local w1 w2
if [ "$(date +%u)" = 4 ]; then
if [ "$(date +%A)" = Thursday ]; then
w1=$(date --iso-8601=s -d 'last thursday')
else
w1=$(date --iso-8601=s -d 'last thursday -1 week')
@ -39,18 +38,20 @@ main() {
w2=$(date --iso-8601=s -d '3 weeks ago')
echo "w1: $w1 w2: $w2"
echo "Considering articles between w2: $w2 and w1: $w1 "
curl -s --fail -D headers.out "$MURL/v1/feeds/$FID/entries" \
curl -s --fail "$MURL/v1/feeds/$FID/entries" \
--url-query limit=50 \
--url-query order=id \
--url-query direction=desc \
-H "X-Auth-Token: $MINIFLUX_TOKEN" |
yq '.entries[]' |
mlr --l2p --ho \
mlr --l2n \
filter '$title =~ "\[\$\]"' \
'then' filter -s w1="$w1" -s w2="$w2" '$published_at > @w2 && $published_at < @w1' \
'then' cut -of id,title | while read -r eid title; do
echo "processing entry: $eid title: $title"
process "$eid" "$title"
done