fedi-tl 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. #!/bin/bash
  2. # Copyright © 2021 sev, p
  3. #
  4. # This program is free software: you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation, either version 3 of the License, or (at
  7. # your option) any later version.
  8. #
  9. # This program is distributed in the hope that it will be useful, but
  10. # WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. # General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU General Public License
  15. # along with this program. If not, see <https://www.gnu.org/licenses/>.
  16. h="$1"
  17. l="$2"
  18. if [ -z "$h" ]; then echo "usage: fedi-tl hostname [true|false]" >&2; exit 1; fi
  19. if [ -z "$l" ]; then l=true; fi
  20. # TODO: Use the non pleroma-specific one, pipe through
  21. # htmlfmt or something. Pleroma's "text/plain" screws up
  22. # line breaks.
  23. curl -k -vv -4 https://$h/api/v1/timelines/public?local=$l | \
  24. tee /tmp/fedi-tl-$h | \
  25. jq -r 'map(.account.acct + " [" + .created_at + "]", "\t" + .pleroma.content["text/plain"], "\n")|join("\n")'