Comment by michaelteter
12 hours ago
I have no idea how that person is doing it, but I suspect it could be using osascript. Here's how I do it from my homegrown Go bookmark tool:
const fetchTabsScript = `
tell application "Brave Browser"
set output to ""
repeat with w in windows
repeat with t in tabs of w
set output to output & (URL of t) & "|||" & (title of t) & "\n"
end repeat
end repeat
return output
end tell
`
func GetOpenTabs() ([]Tab, error) {
cmd := exec.Command("osascript", "-e", fetchTabsScript)
output, err := cmd.Output()
// ...
}
No comments yet
Contribute on Hacker News ↗