I've recently switched to using Chrome. I used Keywurl extensively with Safari. Here's a script that imports the Keywurl searches into Chrome:
#!/usr/bin/perl 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 ) }); 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;
6 comments:
that's cool!
i didn't know that Chrome is using sqlite as its internal database. :-p
Hi, I would love to use this, but can't figure how to run the script.
yeah, i would love to know how to run this?
just put this into the terminal?
If you'd like to run this, right click on the "view raw" link above and download the linked file—remember where you saved it.
Next, open up the terminal, and navigate to the folder where you saved the script. For example, if you saved it to the Desktop, you would type
cd ~/Desktop
Next, you need to mark it as executable. You do this by typing:
chmod +x keywurl_to_chrome.pl
and then finally run it by typing
./keywurl_to_chrome.pl
Good luck.
SQLite Error: "table keywords has 17 columns but 14 values were supplied"
Fix: https://gist.github.com/771425
Having a hard time running this on OSX 10.6. Don't know much about perl, but I tried to install a few of the missing python modules, but I got stuck when I got:
dyld: lazy symbol binding failed: Symbol not found: _Perl_Istack_sp_ptr
Referenced from: /System/Library/Perl/Extras/5.10.0/darwin-thread-multi-2level//auto/HTML/Parser/Parser.bundle
Expected in: flat namespace
dyld: Symbol not found: _Perl_Istack_sp_ptr
Referenced from: /System/Library/Perl/Extras/5.10.0/darwin-thread-multi-2level//auto/HTML/Parser/Parser.bundle
Expected in: flat namespace
Trace/BPT trap
Post a Comment