You've already forked miniflux_lwn
cleanup and add README
This commit is contained in:
43
README.md
Normal file
43
README.md
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
### Miniflux old feed fetcher
|
||||||
|
|
||||||
|
Some news sites pay-wall articles for some time such that they are only
|
||||||
|
available to subscribers. After the pay-wall period, they are then freely
|
||||||
|
available to all. This script is for [lwn][0].
|
||||||
|
|
||||||
|
1. Gets all articles before last Thursday that were pay-walled. Title starts
|
||||||
|
with `[$] ...` for pay-walled articles
|
||||||
|
2. Downloads full content
|
||||||
|
3. Updates title replacing `$` with `✓`, i.e Now it reads `[✓] ...`
|
||||||
|
4. Marks those articles as unread
|
||||||
|
|
||||||
|
### Dependencies
|
||||||
|
|
||||||
|
* [yq][1]
|
||||||
|
* [miller][2]
|
||||||
|
|
||||||
|
### Usage
|
||||||
|
|
||||||
|
1. Update miniflux url and feed id
|
||||||
|
2. export MINIFLUX_TOKEN environment variable
|
||||||
|
3. Run `./run.sh`
|
||||||
|
|
||||||
|
```sh
|
||||||
|
❯ ./run.sh
|
||||||
|
Considering articles between w2: 2025-06-08T13:47:04-04:00 and w1: 2025-06-19T00:00:00-04:00
|
||||||
|
processing entry: 3068 title: [$] Finding locking bugs with Smatch
|
||||||
|
Downloding content. entry: 3068 title: [$] Finding locking bugs with Smatch
|
||||||
|
Updating title. entry: 3068 title: [$] Finding locking bugs with Smatch
|
||||||
|
Marking as unread. entry: 3068 title: [$] Finding locking bugs with Smatch
|
||||||
|
processing entry: 3061 title: [$] Improving iov_iter
|
||||||
|
Downloding content. entry: 3061 title: [$] Improving iov_iter
|
||||||
|
Updating title. entry: 3061 title: [$] Improving iov_iter
|
||||||
|
Marking as unread. entry: 3061 title: [$] Improving iov_iter
|
||||||
|
processing entry: 3060 title: [$] An end to uniprocessor configurations
|
||||||
|
Downloding content. entry: 3060 title: [$] An end to uniprocessor configurations
|
||||||
|
Updating title. entry: 3060 title: [$] An end to uniprocessor configurations
|
||||||
|
Marking as unread. entry: 3060 title: [$] An end to uniprocessor configurations
|
||||||
|
```
|
||||||
|
|
||||||
|
[0]: https://lwn.net
|
||||||
|
[1]: https://github.com/mikefarah/yq
|
||||||
|
[2]: https://github.com/johnkerl/miller
|
19
run.sh
19
run.sh
@ -9,18 +9,17 @@ process() {
|
|||||||
local eid="$1"
|
local eid="$1"
|
||||||
local title="$2"
|
local title="$2"
|
||||||
|
|
||||||
echo "processing entry: $eid title: $title"
|
echo "Downloding content. entry: $eid title: $title"
|
||||||
|
|
||||||
title=${title//$/✓}
|
|
||||||
|
|
||||||
curl --fail -o /dev/null -s "$MURL/v1/entries/$eid/fetch-content" \
|
curl --fail -o /dev/null -s "$MURL/v1/entries/$eid/fetch-content" \
|
||||||
--url-query update_content=true \
|
--url-query update_content=true \
|
||||||
-H "X-Auth-Token: $MINIFLUX_TOKEN"
|
-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" \
|
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"
|
-H "X-Auth-Token: $MINIFLUX_TOKEN"
|
||||||
|
|
||||||
|
echo "Marking as unread. entry: $eid title: $title"
|
||||||
curl --fail -s -X PUT "$MURL/v1/entries" \
|
curl --fail -s -X PUT "$MURL/v1/entries" \
|
||||||
--json "$(printf '{"entry_ids":[%s],"status":"unread"}' "$eid")" \
|
--json "$(printf '{"entry_ids":[%s],"status":"unread"}' "$eid")" \
|
||||||
-H "X-Auth-Token: $MINIFLUX_TOKEN"
|
-H "X-Auth-Token: $MINIFLUX_TOKEN"
|
||||||
@ -31,7 +30,7 @@ main() {
|
|||||||
|
|
||||||
local w1 w2
|
local w1 w2
|
||||||
|
|
||||||
if [ "$(date +%u)" = 4 ]; then
|
if [ "$(date +%A)" = Thursday ]; then
|
||||||
w1=$(date --iso-8601=s -d 'last thursday')
|
w1=$(date --iso-8601=s -d 'last thursday')
|
||||||
else
|
else
|
||||||
w1=$(date --iso-8601=s -d 'last thursday -1 week')
|
w1=$(date --iso-8601=s -d 'last thursday -1 week')
|
||||||
@ -39,18 +38,20 @@ main() {
|
|||||||
|
|
||||||
w2=$(date --iso-8601=s -d '3 weeks ago')
|
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 limit=50 \
|
||||||
--url-query order=id \
|
--url-query order=id \
|
||||||
--url-query direction=desc \
|
--url-query direction=desc \
|
||||||
-H "X-Auth-Token: $MINIFLUX_TOKEN" |
|
-H "X-Auth-Token: $MINIFLUX_TOKEN" |
|
||||||
yq '.entries[]' |
|
yq '.entries[]' |
|
||||||
mlr --l2p --ho \
|
mlr --l2n \
|
||||||
filter '$title =~ "\[\$\]"' \
|
filter '$title =~ "\[\$\]"' \
|
||||||
'then' filter -s w1="$w1" -s w2="$w2" '$published_at > @w2 && $published_at < @w1' \
|
'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
|
'then' cut -of id,title | while read -r eid title; do
|
||||||
|
|
||||||
|
echo "processing entry: $eid title: $title"
|
||||||
process "$eid" "$title"
|
process "$eid" "$title"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user