You've already forked miniflux_lwn
initial commit
This commit is contained in:
59
run.sh
Executable file
59
run.sh
Executable file
@ -0,0 +1,59 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
MURL="https://miniflux.i.balki.me"
|
||||
FID=61
|
||||
|
||||
process() {
|
||||
local eid="$1"
|
||||
local title="$2"
|
||||
|
||||
echo "processing entry: $eid title: $title"
|
||||
|
||||
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"
|
||||
|
||||
curl --fail -o /dev/null -s -X PUT "$MURL/v1/entries/$eid" \
|
||||
--json "$(printf '{"title":"%s"}' "$title")" \
|
||||
-H "X-Auth-Token: $MINIFLUX_TOKEN"
|
||||
|
||||
curl --fail -s -X PUT "$MURL/v1/entries" \
|
||||
--json "$(printf '{"entry_ids":[%s],"status":"unread"}' "$eid")" \
|
||||
-H "X-Auth-Token: $MINIFLUX_TOKEN"
|
||||
|
||||
}
|
||||
|
||||
main() {
|
||||
|
||||
local w1 w2
|
||||
|
||||
if [ "$(date +%u)" = 4 ]; then
|
||||
w1=$(date --iso-8601=s -d 'last thursday')
|
||||
else
|
||||
w1=$(date --iso-8601=s -d 'last thursday -1 week')
|
||||
fi
|
||||
|
||||
w2=$(date --iso-8601=s -d '3 weeks ago')
|
||||
|
||||
echo "w1: $w1 w2: $w2"
|
||||
|
||||
curl -s --fail -D headers.out "$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 \
|
||||
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
|
||||
process "$eid" "$title"
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
main
|
Reference in New Issue
Block a user