Skip to content

Instantly share code, notes, and snippets.

@NoraCodes
Created June 6, 2023 01:20
Show Gist options
  • Save NoraCodes/28066f686a609a3dd467b7b468ecf515 to your computer and use it in GitHub Desktop.
Save NoraCodes/28066f686a609a3dd467b7b468ecf515 to your computer and use it in GitHub Desktop.
Script to delete your chosts (Cohost posts) one page at a time
# You have to go into devtools and pull out your Cookie: header including the part that says Cookie:
# and replace YOUR COOKIE HEADER with that
# and replace YOUR PROJECT NAME in two places
for item in $(curl https://cohost.org/api/v1/project/YOUR PROJECT NAME/posts | jq ".items[] | objects | .postId"); do
curl 'https://cohost.org/api/v1/trpc/posts.delete?batch=1' \
-X POST -H 'content-type: application/json' \
-H 'Origin: https://cohost.org' \
-H 'YOUR COOKIE HEADER' \
--data-raw \{\"0\":\{\"projectHandle\":\"YOUR PROJECT NAME\",\"postId\":$item\}\}
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment