Programmatically acess Google chrome history

后端 未结 3 1150
情深已故
情深已故 2021-01-02 18:21

I want to index all the user actions and websites in google chrome. i understand that google chrome index all the data in sqlLite database. how can i Programmatically access

3条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-02 18:44

    You need to download the appropriate assembly from the SqLite downloads page

    Once you add a reference to the SQLite assembly, its very similar to standard ADO.net

    All the user history is stored in the History database located at the path in the connection string below

    SQLiteConnection conn = new SQLiteConnection
        (@"Data Source=C:\Users\YourUserName\AppData\Local\Google\Chrome\User Data\Default\History");
    conn.Open();
    SQLiteCommand cmd = new SQLiteCommand();
    cmd.Connection = conn;
    //  cmd.CommandText = "SELECT name FROM sqlite_master WHERE type='table' ORDER BY name;";
    //  Use the above query to get all the table names
    cmd.CommandText = "Select * From urls";
    SQLiteDataReader dr = cmd.ExecuteReader();
    while (dr.Read())
    {
    Console.WriteLine(dr[1].ToString());
    }
    

提交回复
热议问题