如何通过命令行应用程序获取Firefox中打开的标签列表? [英] How can I get list of open tabs in Firefox via a command-line application?
问题描述
然而,Firefox不时崩溃,我的标签丢失了。如何获取打开的选项卡并将列表备份到某个文件?
(使用文件中的选项卡,我也可以使用 Git , SVN 或任何存储他们,并可以选择找到一些链接,我在浏览器中看到,但不记得它是什么。)
到目前为止:
我可以得到一些 URLs ,但这似乎并不完全是我在Firefox中看到的:
< code = $(cc:\ 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
请不要告诉我使用这个插件或插件。我真的想按照我所描述的来做。
使用PoshCode的JSON模块,请记住:我在Firefox 4上测试了这个选项卡,其中的标签全景结果在隐藏标签中,ymmv)。 ConvertFrom -Json -File〜\AppData\R * \M * \F * \P * \\ \\ * \sessionstore.js -Type PSObject -EA 0 |
选择 - 展开Windows |选择扩展选项卡
其中{!$ _。hidden} | ForEach {@($ _。Entries)[ - 1]} |
选择Title,Url
第一行中的* 。如果您关心搜索花费的(毫秒)时间,请随意将其扩展到完整路径。
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.
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).
ConvertFrom-Json -File ~\AppData\R*\M*\F*\P*\*\sessionstore.js -Type PSObject -EA 0 |
Select -Expand Windows | Select -Expand Tabs |
Where { !$_.hidden } | ForEach { @($_.Entries)[-1] } |
Select Title, Url
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.
这篇关于如何通过命令行应用程序获取Firefox中打开的标签列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!