Skip to content

Commit

Permalink
feat(proditores): keep a local cache to compute accounts that recentl…
Browse files Browse the repository at this point in the history
…y unfollowed
  • Loading branch information
streambinder committed Oct 28, 2024
1 parent 862f0ee commit 4d4213b
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions social/proditores/runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,23 @@ pending="$(jq -r '.relationships_follow_requests_sent[].string_list_data[].value
rprint "Computing blocked accounts set from file..."
[ -n "${blocked_json}" ] && blocked="$(jq -r '.relationships_blocked_users[].string_list_data[].href' <"${blocked_json}" | sort -u)"

rprint "Pulling last run followers cache..."
cache_path="$(ls -t "$HOME/.cache/proditores/"* 2>/dev/null | head -1)"

rprint "Dumping cache of current followers..."
mkdir -p "$HOME/.cache/proditores" && echo "${followers}" > "$HOME/.cache/proditores/followers-$(date +%s)"

if [ -n "${cache_path}" ]; then
rprint "Computing unfollowed accounts set..."
unfollowed="$(diff -urN "${cache_path}" <(echo "${followers}") | awk -F'-' '/^-/ {print $2}')"

if [ -n "${unfollowed}" ]; then
pprint "Proditores found for unfollowing:"
echo "${unfollowed}" | xargs printf "\- https://instagram.com/%s\n"
echo
fi
fi

pprint "Proditores found for not following back:"
awk -F'-' '/^-/ {print $2}' <<<"${followers_x_following}" | xargs printf "\- https://instagram.com/%s\n"
echo
Expand Down

0 comments on commit 4d4213b

Please sign in to comment.