Re: [SLUG] firefox is seriously dragging

From: Shawn J. Goff (shawn7400@gmail.com)
Date: Fri Jul 17 2009 - 13:34:10 EDT


On Fri, 17 Jul 2009 11:30:25 -0400 (EDT)
Eben King <eben01@verizon.net> wrote:

> On Fri, 17 Jul 2009, Eben King wrote:
>
> > On Fri, 17 Jul 2009, Shawn J. Goff wrote:
>
> [bookmarks.js]
>
> >> That is JSON, a form of Javascript object literal. You could pull
> >> out everything with "http..." to get all the urls.
> >
> > Yeah, there's over 3000 of them. It includes each tab's history.
> > I thought of parsing the file programmatically enough to extract
> > them that way.
> >
> >> There is also a "Bookmark All Tabs" function under the bookmarks
> >> menu. This will create a bookmark folder with all your open pages
> >> in there.
> >
> > Good, I'll see if that works. It might require that the tabs be
> > loaded before it bookmarks them, which puts me back where I
> > started. Wait, does that only apply to the tabs in that window? I
> > suspect it does.
>
> It does. It doesn't wait for loading to complete, but it only
> bookmarks those tabs which are loaded fully.
>
> I think I see how the file's structured:
>
> ({
> windows:
> [(
> tabs:
> [(
> entries:
> [(
> url: "http://whatever"
> title: "Whatever"
> ...
> )]
> )]
> )]
> })
>
> Extra spaces and linefeeds added for clarity. Whitespace is
> generally ignored by compilers. And I still don't know how to make a
> computer parse it enough to extract each tab's URL. Maybe a two-RE
> sed command or several of them as part of a big one-liner?
>
You can use PHP's json_decode() to convert it to
an object or an associative array then you can easily get to values. Or
to just read it with some whitespace in there, try
var_dump(json_decode(file_get_contents("path/to/file.js")))
-----------------------------------------------------------------------
This list is provided as an unmoderated internet service by Networked
Knowledge Systems (NKS). Views and opinions expressed in messages
posted are those of the author and do not necessarily reflect the
official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 20:37:09 EDT