Donmai

How to unfavorite an expunged post?

Posted under General

By "expunged" I mean disappeared from a takedown request.
If it's just a post being flagged and/or not approved, I can still go to the post and unfavorite it. And if it's in a favgroup I can find out the post id, edit the favgroup, Ctrl+F for the id and delete the number. But that doesn't work for ordinary favorites, since there doesn't appear to be a way to edit favorites as a plaintext list of post ids, the way there is for favgroups and pools.

They're not expunged, they're banned. You can unfavorite them through the API (DELETE /favorites/${postId}.json) if you want. This JS snippet should be enough, just paste it into the dev console on a Danbooru page.

fetch(`https://danbooru.donmai.us/favorites.json?search[user_id]=${document.body.dataset["currentUserId"]}&search[post_tags_match]=is%3Abanned&limit=200`)
  .then(resp => resp.json())
  .then(favs => favs.forEach(
    fav => fetch(
      `https://danbooru.donmai.us/favorites/${fav.post_id}.json`, {
        method: "DELETE",
        headers: {"X-CSRF-Token": Danbooru.Utility.meta("csrf-token")}
    }).then()
  ))
1