Created
January 6, 2010 13:21
-
-
Save nothingmuch/270267 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
# fixed for recent version of Chrome by hac (https://gist.github.com/771425) | |
use strict; | |
use warnings; | |
use Mac::PropertyList qw(parse_plist_file); | |
use DBI; | |
my $app_support = "$ENV{HOME}/Library/Application Support"; | |
my $dbh = DBI->connect("dbi:SQLite:dbname=$app_support/Google/Chrome/Default/Web Data"); | |
my $plist = parse_plist_file("$app_support/Keywurl/Keywords.plist"); | |
my $keywords = $plist->{keywords}; | |
$dbh->begin_work; | |
my $t = time; | |
my $sth = $dbh->prepare(qq{ | |
INSERT INTO keywords VALUES ( | |
NULL, -- id | |
?, -- name | |
?, -- keyword | |
"", -- favicon url | |
?, -- url | |
0, -- show in default list | |
0, -- safe for auto replace | |
"", -- originating URL | |
$t, -- date created | |
0, -- usage count | |
"", -- input encodings | |
"", -- suggest url | |
0, -- prepopulate id | |
0, -- autogenerate keyword | |
0, -- logo id | |
0, -- created by policy | |
"" -- instant URL | |
) | |
}); | |
foreach my $link ( keys %$keywords ) { | |
my $data = $keywords->{$link}; | |
my $url = $data->{expansion}->value; | |
$url =~ s/\{query\}/{searchTerms}/g; | |
$sth->execute( | |
$link, # name | |
$link, # keyword | |
$url, | |
); | |
} | |
$dbh->commit; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment