Last active
July 26, 2023 11:09
-
-
Save furycd001/4bc1e88f662b4d0bd620ce0675a416f4 to your computer and use it in GitHub Desktop.
Revisions
-
furycd001 revised this gist
Jul 26, 2023 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,11 +1,11 @@ #!/bin/env bash INSTANCE="https://fosstodon.org" # Replace with your Mastodon instance URL # Function to fetch and display the timeline function display_timeline { # Fetch the public timeline using curl and the Mastodon API toot_timeline=$(curl -s "$INSTANCE/api/v1/timelines/public" | jq -r '.[] | .content? | gsub("<[^>]*>"; "")' | head -n 20) # Loop through the toot texts and display them while IFS= read -r toot_text; do @@ -31,4 +31,4 @@ while true; do # Display the timeline and check for new toots display_timeline done -
furycd001 created this gist
Jul 26, 2023 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,34 @@ #!/bin/bash INSTANCE="https://your-mastodon-instance" # Replace with your Mastodon instance URL # Function to fetch and display the timeline function display_timeline { # Fetch the public timeline using curl and the Mastodon API toot_timeline=$(curl -s "$INSTANCE/api/v1/timelines/public" | jq -r '.[] | .content? | gsub("<[^>]*>"; "")' | head -n 5) # Loop through the toot texts and display them while IFS= read -r toot_text; do # If the toot text is empty or only contains spaces, continue to the next toot if [ -z "${toot_text// }" ]; then continue fi # Print the cleaned text-only toot content with a blank line after each toot echo "$toot_text" echo done <<< "$toot_timeline" } # Display the timeline initially display_timeline # Loop to check for new toots while true; do sleep 60 # Wait for 60 seconds before fetching the timeline again clear # Clear the terminal screen # Display the timeline and check for new toots display_timeline done