Check this post: https://lemm.ee/post/39350987
Firefox
A community for discussion about Mozilla Firefox.
I remember seeing a firefox plugin that would sync tabs to a filesystem folder where you could automate them and such. It could likely help with what you're looking for. Can't recall the name.
Found it https://omar.website/tabfs/
I'm an emacs person, so I don't have a good frame of reference for what you want, but does Vimium C do what you want?
https://github.com/gdh1995/vimium-c
EDIT: Or the original Vimium, not familiar with the differences:
One other potential: it looks like these days -- I seem to vaguely recall a bookmarks.txt years back -- Firefox stores bookmarks in an sqlite database in your profile directory, "places.sqlite".
It also looks like people have constructed scripts to convert an SQL table to text, edit it in vim, and then reconstruct the table:
https://github.com/BnMcGn/vibase
You might be able to just use something like that to edit the database directly.
That being said, it might be okay if you need one major piece of work offline, but it looks like Firefox establishes an exclusive lock on places.sqlite when it's running, so unless offline editing is sufficient or there's a way to request that Firefox not use exclusive access, I don't know if this would work for you.