如何通过命令行应用程序获取 Firefox 中打开的选项卡列表?
我在 Firefox 中打开了很多选项卡。当我关闭 Firefox 然后再次运行它时,选项卡就在那里。没关系。
然而,Firefox 有时会崩溃,我的选项卡也会丢失。如何获取打开的选项卡并将列表备份到某个文件?
(通过文件中的选项卡,我还可以使用 Git,SVN,或任何存储它们的内容,并可选择查找一些“我在浏览器中看到但不记得是什么”的链接是的。)
到目前为止我得到了什么:
我能够得到一些 URL,但这似乎并不完全是我在 Firefox 中看到的:
$c = ((gc c:\Users\..\AppData\Roaming\Mozilla\Firefox\Profiles\xfvj8vd5.default\sessionstore.js ) -join '')
$sess = [Jayrock.Json.Conversion.JsonConvert]::Import( $c.trim('()') )
$sess.windows[0].tabs |
% { $_.entries } |
% { $_.url } |
Select-Object -Unique
请不要告诉我“使用这个插件或那个插件”。我真的很想按照我描述的那样做。
I have a lot of tabs open in Firefox. After I close Firefox and then run it again, the tabs are there. That's all right.
However, from time to time, Firefox crashes and my tabs are lost. How do I get the open tabs and backup the list to some file?
(With tabs in a file, I can also use Git, SVN, or whatever to store them and optionally find some link 'that I saw in my browser but can't remember what it was'.)
What I got so far:
I'm able to get some URLs, but that's doesn't seem to be exactly what I see in Firefox:
$c = ((gc c:\Users\..\AppData\Roaming\Mozilla\Firefox\Profiles\xfvj8vd5.default\sessionstore.js ) -join '')
$sess = [Jayrock.Json.Conversion.JsonConvert]::Import( $c.trim('()') )
$sess.windows[0].tabs |
% { $_.entries } |
% { $_.url } |
Select-Object -Unique
Please, don't tell me "use this addon or that addon". I really would like do it as I described.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您可以从如何导出所有 URL 下载详细的 SQL 脚本一次 Firefox 选项卡(PowerShell)
You can download detail SQL script from how to export all URLs of Firefox tabs at once(PowerShell)
使用 PoshCode 中的 JSON 模块,这看起来是正确的(请记住:我在 Firefox 4 上测试了这一点,其中选项卡全景会产生“隐藏”选项卡,ymmv)。
第一行中的所有 * 只是为了使其简短。如果您关心搜索所花费的(毫秒)秒,请随意将其扩展到完整路径。
Using the JSON module from PoshCode, this looks right (bear in mind: I tested this on Firefox 4, where the Tab Panorama results in "hidden" tabs, ymmv).
All the * in the first line are just to make it short. Feel free to expand that to the full path if you care about the (milli)seconds spent searching.
我建议使用 brotab 获取所有打开的选项卡的 URL:
同时安装 Web 扩展: https://addons.mozilla.org/en-US/firefox/addon /brotab/
重新启动 Firefox,您可以使用
brotab list
进行解析:然后用普通 Firefox 打开
urls-backup.txt
中的所有 URL:I'd recommend using brotab to get the URLs of all open tabs:
Install the web extension as well: https://addons.mozilla.org/en-US/firefox/addon/brotab/
Restart Firefox, and you can use
brotab list
and parse it as so:Then open all URLs in
urls-backup.txt
with normal Firefox:不在 PowerShell 中,但我最近遇到了这个问题,所以也许这个在线人可以帮助某人:
not in PowerShell but I recently faced this problem so maybe this onliner can help someone: