Jump to content
jdfwarrior

Chrome Bookmark Search Workflow

Recommended Posts

A workflow to allow you to search Chrome Bookmarks and open them when actioned in Chrome.

 

I originally posted these on my Tumblr but I've since noticed a few issues with it so I fixed a few things and wanted to post it here so people could comment or report issues.

 

http://d.pr/f/gkwy

Share this post


Link to post

Yeah, now it's working here, too.
But you need to type at least 3 letters to get som suggestions, right?!
Something Alfred-related won't show up until you've entered at least 'alf'.

Share this post


Link to post

Yeah that's something that I think we really should try to standardize across workflows is not starting some searches until a minimum string length is reached. Think about some people with a HUGE amount of Chrome bookmarks or something. It keeps things from slowing down. A minimum string length definitely needs to be used for script filters pulling data from the net

Share this post


Link to post

Actually I have to type 6 characters for some of my bookmarks. Any idea why that would be? I've only noticed it on one I have labeled "Quicklinks". Nothing shows up until I get to the "l".

Share this post


Link to post

It may be updating the database. The way it currently runs is.. it checks the last mod time of the database file. If it's changed since the last time the extension ran then it truncates the contents of the database and reloads them all. If you have a lot of bookmarks, it may be taking a second to load them back up. Just a thought?

Share this post


Link to post

Thanks for this: it's very useful. I'm running Chromium, but with a couple of changes it works well.

One hiccup: it doesn't seem to like bookmarks in Japanese. Seems like any bookmark with a Unicode reference for a double-byte character in the "name" field of a Chrome bookmark gets junked in the database and doesn't show up in searches. For example, the Bookmarks record below doesn't get picked up (even though the name contains some non-Japanese text):

 

{
            "date_added": "12988168872055591",
            "id": "73",
            "name": "goo \u5927\u76F8\u64B2",
            "type": "url",
            "url": "http://sumo.goo.ne.jp/"
         }

 

Could this have something to do with the SQLite database encoding?

[edit]…or maybe not: I just had a look at the database in the Firefox SQLite Manager, and the Japanese looks fine.

Edited by Chris Ryal

Share this post


Link to post
It may be updating the database. The way it currently runs is.. it checks the last mod time of the database file. If it's changed since the last time the extension ran then it truncates the contents of the database and reloads them all. If you have a lot of bookmarks, it may be taking a second to load them back up. Just a thought?

 

I've waited quite a bit and it never worked afterwards. I don't feel like I have all that many bookmarks as I store most things in Pinboard. As a workaround I've been deleting the .db file every so often. Kind of a pain though. Also - do you have any idea why Safari bookmarks no longer open in the default browser anymore like they did in Alfred v. 1? Seems Safari is the only option in "Open with" now too.

Share this post


Link to post

I may have to find another way to make it locate the chrome bookmarks file. I was trying to make it link directly to where the file should be but foreign languages are making that difficult because the file structure is diff. I may have to do a rewrite of this workflow to make it work for the users with foreign languages. I also accidentally included a database file that had MY path saved in it originally so people had to delete the bookmarks.db file to get it to work.

Share this post


Link to post

I'm getting the following warning ahead of the XML which seems to cause me not to get any results:

 

 

Warning: SQLite3::exec(): near "This": syntax error in /Users/bmiller/Dropbox/Home/Library/Alfred2/Alfred.alfredpreferences/workflows/user.workflow.8771B37D-3EFC-4FD5-AC1F-C7135CFD2E90/extension_utils.php on line 269
<?xml version="1.0"?>
<......

Share this post


Link to post

Actually, I was looking to make it so I could browse a specific folder of bookmarks, but no others. I've adapted David's workflow for my own purposes (imported that folder of bookmarks into Chrome, and load in Safari with the modified keyword), and it does precisely what I wanted. It's here, if you're interested.

Share this post


Link to post

This is great!!

 

I the search algorithm is not very good though (not sure whether that is Alfred or the workflow). Below are a couple of screenshots.

 

1) Alfred "ch new" finds the new york times page  http://postimage.org/image/475xpczff/

2) Alfred "ch new " does not find the new york times page  http://postimage.org/image/3s37c238z/

3) Alfred "ch newt" does not find the new york times page http://postimage.org/image/whi74jw4n/

4) Alfred "ch nyt" does not find the page either http://postimage.org/image/cn8n0bhg1/bfc6a68a/

 

I think they should all find the page...

Share this post


Link to post

This is great!!

 

I the search algorithm is not very good though (not sure whether that is Alfred or the workflow). Below are a couple of screenshots.

 

1) Alfred "ch new" finds the new york times page  http://postimage.org/image/475xpczff/

2) Alfred "ch new " does not find the new york times page  http://postimage.org/image/3s37c238z/

3) Alfred "ch newt" does not find the new york times page http://postimage.org/image/whi74jw4n/

4) Alfred "ch nyt" does not find the page either http://postimage.org/image/cn8n0bhg1/bfc6a68a/

 

I think they should all find the page...

 

You are correct. I have a few things I need to update on it but have been stretched out lately trying to keep up with support stuff. I'll add it to my notes and try to get an update pushed out soon.

 

Thanks

Share this post


Link to post

This works sketchy for me. It doesn't find all my bookmarks, especially any new ones I've added since installing this, though it could be coincidentally as I've deleted the db file and same results.

 

It finds some, not others basically and I've typed the exact match.

Share this post


Link to post

Hi David,

 

I found this workflow not working well when there is Chinese characters (or other utf-8 characters) in title. A tweak by changing line 66 in bookmarks.php:

 

'title' => htmlentities( $match->name ),

 

to

 

'title' => htmlentities( $match->name, ENT_QUOTES, "utf-8" ),

 

will solve the problem.

Share this post


Link to post

Hi David,

 

I found this workflow not working well when there is Chinese characters (or other utf-8 characters) in title. A tweak by changing line 66 in bookmarks.php:

 

'title' => htmlentities( $match->name ),

 

to

 

'title' => htmlentities( $match->name, ENT_QUOTES, "utf-8" ),

 

will solve the problem.

 

 

I don't even see that entry anywhere in the file. I searched for 'title' and it returned nothing. Here's what I have on line 66 (do I have a different workflow installed??):

 

http://cl.ly/image/3c390s1b0444

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...