diff --git a/filter.sh b/filter.sh index 4b98a89..897f7bf 100755 --- a/filter.sh +++ b/filter.sh @@ -184,11 +184,11 @@ function filter_entries { fi fi # sortiere und forme marked_entries um - marked_entries=$(echo $title $content) + marked_entries="$title $content" # https://unix.stackexchange.com/questions/353321/remove-all-duplicate-word-from-string-using-shell-script # entfernt doppelte eintraege innerhalb einer zeile marked_entries=$(echo marked_entries | xargs -n1 | sort -u | xargs | sed -r 's/\s/\, /g') - echo $marked_entries #d + echo "$marked_entries" #d done } function mark_as_read { @@ -266,3 +266,78 @@ esac # curl --request PUT --header "X-Auth-Token: hLPp23gO8QeZWPYXXXXXXXMs0jG0XTYgNZBgRA=" --header "Content-Type: application/json" --data '{"entry_ids":[388229, 388211], "status":"read"}' https://miniflux.mgrote.net/v1/entries + + + +lese suchwörter per feedurl ein +suche pro feed url nach suchwortern +markiere als gelesen + + + + +get all feeds where are unread entries+ +check if for that feeds a filter is defined +search for keywords for this feedsunread entries +mark entries as read + + +token: hLPp23gO8QeZWPYzK3jYgmGbABvMs0jG0XTYgNZBgRA= # später tauschen + + +curl -H "X-Auth-Token: hLPp23gO8QeZWPYzK3jYgmGbABvMs0jG0XTYgNZBgRA=" https://miniflux.mgrote.net/v1/me + + +#!/bin/bash +# get all feeds where are unread entries+ + +token="X-Auth-Token: hLPp23gO8QeZWPYzK3jYgmGbABvMs0jG0XTYgNZBgRA=" +url="https://miniflux.mgrote.net/v1/" +for feed in $(curl --silent -H $token $url/feeds | jq .[].id) ; do + unread_entries=$(curl --silent -H $token $url/feeds/$feed/entries?status=unread) +done + + + + +---- +#!/bin/bash +# get all feeds where are unread entries+ + +MF_FILTERLIST=" +golem.de::Anzeige +golem.de::Aus dem Verlag: +golem.de::Elon Musk +golem.de::Fifa +golem.de::Fussball +golem.de::Fußball +golem.de::(g+) +" + +token="X-Auth-Token: hLPp23gO8QeZWPYzK3jYgmGbABvMs0jG0XTYgNZBgRA=" +url="https://miniflux.mgrote.net/v1" + +# für jeden feed +for feed in $(curl --silent -H "$token" "$url/feeds" | jq .[].id) ; do + echo for1 + unread_entries=$(curl --silent -H "$token" "$url/feeds/$feed/entries?status=unread" | jq .total) + # der ungelesen einträge hat + if [[ $unread_entries -gt 0 ]] ; then + echo if1 + fi +done + + echo "$MF_FILTERLIST" | while read -r line ; do + echo while1 + filter_url=$(echo "$line" | tr '[:upper:]' '[:lower:]' | awk --field-separator="::" '{print $1}') + echo $filter_url + mf_site_url=$(curl --silent -H "$token" "$url/feeds/$feed" | jq --raw-output .site_url) + echo $mf_site_url + # prufe ob ein filter dafur existiert + echo "$filter_url" | grep "$mf_site_url" + if [[ $(echo "$filter_url" | grep --silent "$mf_site_url") ]] ; then + echo for2 + echo "id: $feed" + echo "$mf_site_url $filter_url" + fi + done