Where does the offline article content saved in Pocket Chrome App for Windows?

As most of the readers aware i was a heavy user of Pocket – A Read it Later App. I have installed the App across devices and sometimes use a script to send the links to pocket account. This weekend i was wondering how the Windows Offline Pocket Chrome App was working and i posted my question to quora as well.  Instead of waiting for an answer i thought of exploring myself. In this article i am going to explain behind the scene offline version of the pocket chrome app for windows.

Objective :
To extract my Pocket Articles API and export them to a JSON file. Pocket already provides an option in their site to export your articles to Excel format. They also Provide API for developers to access the pocket account data. Instead of going through that route i would like to export as a JSON file from the offline pocket app which already has all the information i needed.

Chrome App :
– The offline Chrome App is a standalone application in windows which still uses the underlying Chrome WebKit engine to work. It uses the same Web Elements like CSS,Javascript and HTML for the presentation. Its a package HTML application distributed as a Google Chrome Extension. It has full access to the Local Storage, Indexed DB and other resources applicable for a regular Web Page on the client side.

The offline pocket chrome app for windows is available in the Google Web store https://chrome.google.com/webstore/detail/pocket/mjcnijlhddpbdemagnpefmlkjdagkogk?hl=en . Here mjcnijlhddpbdemagnpefmlkjdagkogk is the PackageId of the Pocket Application.




How Pocket stores the data :

– Whenever an extension is installed the application files are installed in this path in google chrome. C:\Users\<USERNAME>\appdata\Local\Google\Chrome\User Data\<Profile 1>\Extensions.
– Pocket uses the HTML 5 storage features like IndexedDB to store the users data. IndexedDB is the recommended mechanism to store huge volumes of data in the client side. As users may have lot of articles Pocket chose IndexedDB as a offline persistence storage.
– Developer Tool in Chrome also allows one to inspect and debug the Chrome App’s and Extensions. Here the link to invoke the inspect element for your extensions




Alternatively, you can also invoke the Inspect element from the extensions list page as shown below.




Exporting the Article JSON List :

So far we were able to inspect the extension and we were able to see the data for all the articles is stored in the IndexedDB. As per the DB, it seems i added around 3000+ articles to the pocket account in the last 5 months. Let’s write a console snippets (Chrome Snippets) to export these items to a JSON file so that we can use them as needed later.

var request = indexedDB.open(‘PackagedAppPocket’,1);
var articleList=[];
request.onsuccess = function(e)
    idb = e.target.result;
    var transaction = idb.transaction(‘items’, IDBTransaction.READ_ONLY);
    var objectStore = transaction.objectStore(‘items’);

    objectStore.openCursor().onsuccess = function(event)
        var cursor = event.target.result;
        if (cursor)
            //console.log(‘Cursor data’, cursor.value);
            var data;

filename = ‘MyPocketArticles.json’

            if(typeof articleList === “object”){
                data = JSON.stringify(articleList, undefined, 4)

            var blob = new Blob([data], {type: ‘text/json’}),
                e    = document.createEvent(‘MouseEvents’),
                a    = document.createElement(‘a’)

            a.download = filename
            a.href = window.URL.createObjectURL(blob)
            a.dataset.downloadurl =  [‘text/json’, a.download, a.href].join(‘:’)
            e.initMouseEvent(‘click’, true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null)




Hope you enjoyed this article.  Please tweet me if you need any support.

%d bloggers like this: