如何在本地计算机上以编程方式访问 Google Chrome 浏览器历史记录
我想编写一个简单的程序来显示我在一段时间内的互联网活动(我访问了哪个网站,访问了多少次等等)。我主要使用谷歌Chrome浏览器。我发现 Chrome 在此位置存储浏览器历史记录(如果我错了,请纠正我)
C:\Documents and Settings\<username>\Local Settings\Application Data\Google\Chrome\User Data\Default
如何打开历史记录文件?它们没有任何文件扩展名。我无法使用记事本、SQLite 浏览器打开。如何以编程方式访问这些数据?我想知道它是什么格式以及如何使用 C# 等编程语言读取它。
I want to write a simple program which shows my internet activity over a period of time (which site I visited, how many times and so on). I mostly use Google Chrome browser. I found out Chrome stores browser history at this location (please correct me if I'm wrong)
C:\Documents and Settings\<username>\Local Settings\Application Data\Google\Chrome\User Data\Default
How can I open the history files? They don't have any file extension. I could not open using notepad, SQLite browser. How do I access this data programmatically? I want to know which file format it is and how to read it using a programming language like C#.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
为了查看 sqlite 数据库(这就是 Chromium 历史索引),我更喜欢 sqlitebrowser。它是免费的,可在 Windows、Mac 和 Linux 上运行。我一直以来的最爱。
For viewing sqlite databases (which is what the Chromium history index is), I've preferred sqlitebrowser. It's free and works on Windows, Mac, and Linux. An all-time fave for me.
由于原始发帖人要求一个简单的程序,所以就在这里。该程序改编自java工作区网站(如代码所示)。您需要更改
getConnection ()
的参数以指向历史文件在您的计算机上所在的位置。该程序在我的Linux 2.6.39环境上编译并运行:Since the original poster asked for a simple program, here it is. The program was adapted from the java workspace website (as credited in the code). You will need to change the argument for
getConnection ()
to point to where the history files reside on your machine. The program compiles and runs on my Linux 2.6.39 environment:有一个名为 Hindsight (https://github.com/obsidianforensics/hindsight) 的开源程序可以分析Chrome 中的浏览历史记录。虽然该程序相当大且复杂,但它使用 SQL 查询访问各种 Chrome SQLite 文件,这些文件可以在 SQLite 浏览器或不同的程序中独立提取和使用。
Chrome v30+ 历史数据库的一个示例是:
不同的 Chrome 数据库以及不同版本的 Chrome 有更多的 SQL 查询。
There is an open source program called Hindsight (https://github.com/obsidianforensics/hindsight) that analyzes browsing history in Chrome. While the program is rather large and complicated, it access the various Chrome SQLite files using SQL queries, which can pull out and use independently, either in a SQLite browser or a different program.
An example of one for the Chrome v30+ History database is:
There are many more SQL queries for different Chrome databases, as well as different versions of Chrome.
我知道 Safari 使用 Binary PLists 作为其历史记录(以及 SQLite用于其缓存)。 Chrome 有可能也在做同样的事情吗?
I know Safari uses Binary PLists for its history (and SQLite for its cache). Is it possible that Chrome is doing the same?
它只是一个 SQlite 3 数据库,我能够成功打开它(当然你无法打开正在运行的浏览器的锁定数据库)。
It is just a SQlite 3 database, I was able to open it successfully (though of course you can't open a locked database of a running browser).
这是我创建的一个类,用于从 Google Chrome 读取浏览数据。我从此处获得的大部分代码,但是我对其进行了一些调整以添加对 Google Chrome 的支持。您可能还想从 此处下载 SQLite for .Net 并添加对 System.Data.Sqlite 的引用。
URL 的类:
它对我来说就像一个魅力。希望有帮助
Here is a class I created to read browsing data from Google chrome. Most of the code I got from here but I tweaked it abit to add support for Google Chrome. You probably also want to download the SQLite for .Net from here and add the references to System.Data.Sqlite.
The class for the URL:
It worked like a charm for me. Hope it helps