Page 1 of 2 12 LastLast
Results 1 to 10 of 18

Thread: How to access Firefox 3 bookmarks from the command line?

  1. #1
    Join Date
    Oct 2006
    Location
    Argentina
    Beans
    584
    Distro
    Ubuntu

    Question How to access Firefox 3 bookmarks from the command line?

    On the firefox forums someone told me to use sqlite but it doesn't work.

    It tells me that the database is locked:
    Error: database is locked
    If I close firefox it tells me:
    Unable to open database ".mozilla/firefox/adnu2zvf.default/places.sqlite": file is encrypted or is not a database

    Here it is the post on mozillazine:
    http://forums.mozillazine.org/viewtopic.php?t=655853
    Last edited by Yuzem; May 19th, 2008 at 04:10 AM.

  2. #2
    Join Date
    May 2005
    Location
    US
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: How to access Firefox 3 bookmarks from the command line?

    In answer to your thread title question:
    Code:
    nano -B ~/.mozilla/firefox/adnu2zvf.default/bookmarks.html
    should do it.

    What might solve the post problem is:
    Code:
    mv ~/.mozilla ~/.mozilla.old
    firefox &

  3. #3
    Join Date
    Oct 2006
    Location
    Argentina
    Beans
    584
    Distro
    Ubuntu

    Re: How to access Firefox 3 bookmarks from the command line?

    Quote Originally Posted by aysiu View Post
    In answer to your thread title question:
    Code:
    nano -B ~/.mozilla/firefox/adnu2zvf.default/bookmarks.html
    should do it.
    That is the old bookmark file. I need to access the new bookmarks: places.sqlite (firefox 3)

    Quote Originally Posted by aysiu View Post
    What might solve the post problem is:
    Code:
    mv ~/.mozilla ~/.mozilla.old
    firefox &
    If I do that I will lose all my bookmarks, extensions and settings and what would be the effect?

  4. #4
    Join Date
    Oct 2006
    Location
    Argentina
    Beans
    584
    Distro
    Ubuntu

    Re: How to access Firefox 3 bookmarks from the command line?

    aysiu: Could you move this thread to the Programming Talk sub forum or I should ask again there?

    What I really want to know is how to access firefox3 bookmarks form bash to add support for them to avatar-factory.

    I realize that the Programming Talk sub forum is a better place for this question.

    Thanks.

  5. #5
    Join Date
    Aug 2007
    Location
    127.0.0.1
    Beans
    1,800
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: How to access Firefox 3 bookmarks from the command line?

    Having the command line interface of sqlite3 (sqlite3 package on synaptic)

    Code:
    sqlite3 places.sqlite
    Code:
    sqlite> .databases
    seq  name             file                                                      
    ----------------------------------------------------------
    0    main             /home/canxp/places.sqlite
    Code:
    sqlite> .tables
    moz_anno_attributes  moz_favicons         moz_keywords       
    moz_annos            moz_historyvisits    moz_places         
    moz_bookmarks        moz_inputhistory   
    moz_bookmarks_roots  moz_items_annos
    sqlite> SELECT * FROM moz_bookmarks
    That last one produces a huge output.

    Use the sqlite3 module of python, or the one on C, if you need to do something else with this data.

    I made a copy of the file on my home folder by the way. Most probably, the error you get is that you're trying to open the database while firefox has a lock on it.

    *edit*
    Also, there's a little trick with firefox, you can make another account for your testing, open firefox with:

    Code:
    firefox-3.0 -ProfileManager
    That will let you create new profiles (that are stored in the .mozilla folder), with that you can test without screwing with important data.
    Last edited by Can+~; May 20th, 2008 at 05:28 PM.
    "Just in terms of allocation of time resources, religion is not very efficient. There's a lot more I could be doing on a Sunday morning."
    -Bill Gates

  6. #6
    Join Date
    Oct 2006
    Location
    Argentina
    Beans
    584
    Distro
    Ubuntu

    Re: How to access Firefox 3 bookmarks from the command line?

    Thanks, that worked but I still can't access the database if firefox is running:
    Code:
    Error: database is locked
    If a copy places.sqlite to temp dir I still get an error:
    Code:
    Unable to open database "places.sqlite": file is encrypted or is not a database
    I don't need to do any advanced thing. I just need to parse all the bookmarks to manipulate them with bash.

    Is there a simple command to export the bookmarks to a text format that can be accessed with cat, grep, sed etc...?

  7. #7
    Join Date
    Sep 2006
    Location
    Durham, NC
    Beans
    30
    Distro
    The Feisty Fawn Testing

    Re: How to access Firefox 3 bookmarks from the command line?

    The bookmarks.html file is generated from the places database, so if all you need is to read in the files and parse them that should do it. Otherwise you'll have to go through sqlite3. The database locks when you're using firefox so that firefox can be sure it's stable.

  8. #8
    Join Date
    Oct 2007
    Beans
    1,914
    Distro
    Lubuntu 12.10 Quantal Quetzal

    Re: How to access Firefox 3 bookmarks from the command line?

    Quote Originally Posted by Yuzem View Post
    If a copy places.sqlite to temp dir I still get an error:
    Code:
    Unable to open database "places.sqlite": file is encrypted or is not a database
    Did you close firefox before trying that? I'm asking because it worked for Can+~. The file itself might be in an unreadable state before the database is closed.

  9. #9
    Join Date
    Oct 2006
    Location
    Argentina
    Beans
    584
    Distro
    Ubuntu

    Re: How to access Firefox 3 bookmarks from the command line?

    But the bookmarks.html file is not updated by firefox.
    It gets imported the first time that firefox 3 is executed but when changes are made to the bookmarks it doesn't get updated.

    Edit: No, I didn't close firefox. I want to access the bookmarks even if firefox is running like in previous versions.
    Last edited by Yuzem; May 28th, 2008 at 08:14 PM.

  10. #10
    Join Date
    Jun 2006
    Location
    Gwangju, Korea
    Beans
    3,479

    Re: How to access Firefox 3 bookmarks from the command line?

    SQLite3 doesn't permit simultaneous connections. Only one process can have an sqlite database open at a time. So unless you can convince Firefox to close its database (perhaps via an extension?), you can't do what you want.

Page 1 of 2 12 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •