如何从SQLite文件恢复Firefox书签文件?

z4iuyo4d  于 2023-04-21  发布在  SQLite
关注(0)|答案(4)|浏览(136)

我有两个文件,我设法从Windows XP下的Firefox安装恢复。第一个是urlclassifier3.sqlite,第二个是urlclassifier.pset。
我知道这些文件包含Firefox安装的实际书签,在用户配置文件下,假设配置文件为.\Mozilla\Firefox\Profiles\akcum27.default。如何从这些文件中恢复书签?
最大的一个是.sqlite文件,大约56KB。

vnzz0bqm

vnzz0bqm1#

一个实际工作的查询(在Windows上,就像这个问题一样)是:

sqlite3 places.sqlite "select '<a href=''' || url || '''>' || moz_bookmarks.title || '</a><br/>' as ahref from moz_bookmarks left join moz_places on fk=moz_places.id where url<>'' and moz_bookmarks.title<>''" > t1.html

这假定:

  • 使用Windows命令行(CMD)
  • 当前目录是文件 places.sqlite 所在的目录(每个Firefox配置文件都有一个,默认配置文件通常命名为 “default”“default-release”
  • SQLite 3(可执行文件sqlite3)已安装,并位于路径(环境变量PATH)中

生成的HTML示例:

<a href='http://www.wunderground.com/hurricane/'>Tropical weather</a><br/>
<a href='http://www.dmi.dk/vejr/maalinger/radar-nedboer/'>DMI, Radar</a><br/>
<a href='http://www.skyandtelescope.com/observing/objects/planets/3304091.html?page=1&c=y'>Transit Times of Jupiter's Great Red Spot - Planets - SkyandTelescope.com</a><br/>
<a href='https://www.quora.com/What-is-the-most-misspelt-word-in-the-English-language'>(951/25) What is the most misspelt word in the English language? - Quora</a><br/>
<a href='http://www.eevblog.com/2015/06/16/eevblog-754-altium-circuit-maker-first-impressions/'>EEVblog #754 - Altium Circuit Maker First Impressions | EEVblog - The Electronics Engineering Video Blog</a><br/>
<a href='https://www.arduino.cc/en/Main/ArduinoBoardUno'>Arduino - ArduinoBoardUno</a><br/>

注意事项

  • 结果不像Firefox Bookmarks 菜单中那样排序,并且有一些 * 额外的 * 条目,既有http/https条目,如 “关于我们”,也有一些非http/https条目。
  • SQLite通常由其他工具安装,但要使其在Windows上从头开始工作,一个简单的方法是从the official download pagesample direct download URL)下载命令行工具包,解压缩三个文件,并将文件 sqlite3.exe 复制到profile文件夹(文件 places.sqlite 所在的位置)。
  • 它也适用于Linux,但
  • 如果Firefox正在运行,则结果为 “错误:database is locked”(如果使用了多个Firefox配置文件,则针对有问题的Firefox配置文件。例如,在地址栏中使用 about:profiles 来浏览配置文件)
  • 默认情况下,SQLite 3未安装在Ubuntu系统上,但可以通过以下方式安装:
sudo apt install sqlite3
  • Ubuntu 18.04(Bionic Beaver)和Ubuntu MATE 20.04(Focal Fossa)验证了这一点
  • 已知它可用于(反向版本顺序):
  • Ubuntu 18.04(Bionic Beaver)上的Firefox 97.0(2022-02-08)
  • Firefox 97.0 on(2022-02-08)Ubuntu MATE 20.04(Focal Fossa)
  • Firefox 83.0上(2020-11-17)Ubuntu MATE 20.04(Focal Fossa)
  • Firefox 57.0.2(2017-12-23)在Windows 10. Quantum. 64位版本64位)
  • Firefox 46(2016-04-26)
  • Windows上的Firefox 40(约. 2015-08.在Quantum之前)。
kgqe7b3p

kgqe7b3p2#

书签保存在文件places.sqlite中,而不是urlclassifier中。您可以尝试将当前安装中的文件替换为该文件。请确保Firefox已关闭。如果不起作用:
您可能需要安装Firefox插件“SQLite Manager”,然后使用该插件(使用Alt键打开Firefox中的插件菜单)从旧安装中打开文件places.sqlite。右键单击左手的 Tables -〉moz_bookmarke,然后单击“export table”
将表导出为XML或SQL,然后从当前安装中打开file places.sqlite,然后单击 Database -〉Import Table 并以与导出相同的方式导入它。

mjqavswn

mjqavswn3#

您也可以替换Firefox配置文件夹中的places.sqlite文件,然后,由于Firefox可能无法检索数据库,您可以打开另一个Web浏览器(Chrome,Edge等)并从这个新浏览器导入Firefox书签(大多数浏览器都可以导入Firefox书签)。最后,您可以从Firefox再次从这个第三方Web浏览器导入书签。

ffvjumwh

ffvjumwh4#

一个快速和肮脏的解决方案是:

dalem@QnD:~/Downloads$ sqlite3 places.sqlite 'select "<a href={" || url || "}>" || moz_bookmarks.title || "</a><br/>" as ahref  from moz_bookmarks left join moz_places on fk=moz_places.id where url<>"" and moz_bookmarks.title<>""' > t1.html

相关问题