How to extract bookmarks from Safari Bookmarks.plist?

Discussion in 'Apple' started by DG, Aug 17, 2005.

  1. DG

    DG Guest

    The new Safari version (in Tiger) seems to use a new binary format for
    ~/Library/Safari/Bookmarks.plist and not a plain XML file as before. It
    can be edited in Property List Editor as a regular XML file, but I
    haven't been able to automatically extract bookmarks with previously
    working methods, like grep, DOMParser or even an applescript posted at
    http://bbs.applescript.net/viewtopic.php?pid=43156

    Does anybody know how can I extract bookmarks (URL and title) using
    shell commands, applescript or javascript? Maybe even the spotlight
    shell command "mdfind" could help, as the spotlight results also
    include bookmarks, but I still don't know how to make a query for this.

    Thanks
     
    DG, Aug 17, 2005
    #1
    1. Advertisements

  2. DG

    DG Guest

    Yes, I know this can be done manually using the methods you mention.
    What I need is to extract bookmarks automatically from a widget
    (javascript) anytime the user requests it.
     
    DG, Aug 18, 2005
    #2
    1. Advertisements

  3. DG

    DG Guest

    Thanks for your replies. I found a way!

    I used spotlight's shell commands:
    mdfind "kMDItemKind='Safari bookmark'" to get the bookmark files
    spotlight has cached and mdls <bookmark file> combined with grep to
    extract individual attributes, like name and url.

    I hope this will be useful for somebody else.
     
    DG, Aug 19, 2005
    #3
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.