#!/bin/env tclsh
lassign $argv db feed uri
cd [file dirname [file dirname [dict get [info frame [info frame]] file]]]
switch -regexp -matchvar matches -- $uri {
{^at://.+} {}
{^(?:(?:(?:(?:(?:https://)?bsky.app)?/)?profile)?/)?([^/]+)/post/(.+)$} {
lassign $matches pub mkey
set uri at://$pub/app.bsky.feed.post/$mkey
}
default {return -code error "unknown URI format!"}
}
package require sqlite3
sqlite3 db $db
db eval "DELETE FROM $feed WHERE uri = :uri;"