如何在Mac上以编程方式读取Chrome和Firefox的缓存? [英] How do I read the cache of Chrome and Firefox programmatically on the Mac?

查看:318
本文介绍了如何在Mac上以编程方式读取Chrome和Firefox的缓存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

背景



我想在我的Cocoa应用程序中访问Chrome和Firefox的缓存。我需要获取最近访问的页面的HTML。 Safari是一块蛋糕 - 所有这些信息都可以在SQLite数据存储中找到,但在Chrome和Firefox中不是这样。



问题 / p>

对于Firefox,缓存位于/Library/Caches/Firefox/Profiles/xxx.default/Cache,文件名为_CACHE_001_ _CACHE_002_ _CACHE_003_和_CACHE_MAP_



对于Chrome,缓存位于/ Library / Caches / Google / Chrome /默认/缓存中,文件名为data_0 data_1 data_2和data_3



我尝试的



我可以找到的唯一一篇文章揭示了这些缓存在在这里。它建议使用缓存查看器工具,但不解释如何以编程方式这样做。



问题


  1. 有没有任何方法使用命令行工具
    或Cocoa框架重建
    这个数据?还是它
    的水平太低了?


  2. 有另一种方式获得
    最近网页的HTML,我
    不知道吗?



解决方案

我可以看到的唯一解决方案是由Ole建议,来自Chrome和Firefox的代码,并了解它们如何对缓存进行编码。



我意识到这是一个巨大的编码难题。我正在抛弃这个功能,尝试一个更简单的方法。


Background

I want to access the cache of Chrome and Firefox in my Cocoa application. I need to get the HTML for pages accessed recently. Safari is a piece of cake - all this information is available in SQLite data stores, but not so in Chrome and Firefox.

The Problem

For Firefox, the cache is in /Library/Caches/Firefox/Profiles/xxx.default/Cache with filenames _CACHE_001_ _CACHE_002_ _CACHE_003_ and _CACHE_MAP_

For Chrome, the cache is in /Library/Caches/Google/Chrome/Default/Cache with filenames data_0 data_1 data_2 and data_3

What I've tried

The only article I can find that sheds any light on what format these caches are in is here. It recommends a Cache Viewer tool, but doesn't explain how one might do this programmatically.

Questions

  1. Is there any way of reconstructing this data using command line tools or the Cocoa framework? Or is it much too low level?

  2. Is there another way of getting at the HTML of recent web pages that I don't know about?

解决方案

The only solution I can see is that suggested by Ole above, namely to look at the code from Chrome and Firefox and work out how they encode the cache.

I've since realised this is a huge coding challenge fraught with difficulties. I'm ditching this functionality and trying a simpler way.

这篇关于如何在Mac上以编程方式读取Chrome和Firefox的缓存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆