代码之家  ›  专栏  ›  技术社区  ›  Peter

在FireFox运行时,如何访问FireFox 3书签?

  •  1
  • Peter  · 技术社区  · 16 年前

    Firefox3现在将书签存储在名为profiles.Sqlite的Sqlite文件中。

    在Firefox 3运行时,此文件被锁定。

    我不希望用户必须安装插件。

    当FF 3运行时,有没有办法抓取书签?

    2 回复  |  直到 13 年前
        1
  •  3
  •   ChrisLively    16 年前

    SQLLite是一种用于单用户应用程序的嵌入式数据库,不是为多用户访问而构建的。请参阅其主题为“其他RDBMS可能工作得更好的情况”的部分 When To Use question list .

    所以,没有其他选择。构建一个插件。

        2
  •  2
  •   jeff    16 年前

    http://www.codertakeout.com .

    using System.Data.SQLite;  // need to install sqlite .net driver
    
    String path_to_db = @"C:\Documents and Settings\Jeff\Application Data\Mozilla\Firefox\Profiles\yhwx4xco.default\places.sqlite";
    String path_to_temp = System.IO.Path.GetTempFileName();
    
    System.IO.File.Copy(path_to_db, path_to_temp, true);
    SQLiteConnection sqlite_connection = new SQLiteConnection("Data Source=" + path_to_temp + ";Version=3;Compress=True;Read Only=True;");
    
    SQLiteCommand sqlite_command = sqlite_connection.CreateCommand();
    
    sqlite_connection.Open();
    
    sqlite_command.CommandText = "SELECT moz_bookmarks.title,moz_places.url FROM moz_bookmarks LEFT JOIN moz_places WHERE moz_bookmarks.fk = moz_places.id AND moz_bookmarks.title != 'null' AND moz_places.url LIKE '%http%';";
    
    SQLiteDataReader sqlite_datareader = sqlite_command.ExecuteReader();
    
    while (sqlite_datareader.Read())
        {
            System.Console.WriteLine(sqlite_datareader[1]);
        }
    sqlite_connection.Close();
    System.IO.File.Delete(path_to_temp);