Ubuntu Forums ubuntu.com - launchpad.net - ubuntu help  

Go Back   Ubuntu Forums > The Ubuntu Forum Community > Other Community Discussions > Development & Programming > Programming Talk
Register Reset Password Forum Help Forum Council Search Today's Posts Mark Forums Read

Programming Talk
This forum is for all programming questions.
The questions do not have to be directly related to Ubuntu and any programming language is allowed.

 
Thread Tools Display Modes
Old May 18th, 2008   #1
Yuzem
Dipped in Ubuntu
 
Join Date: Oct 2006
Beans: 538
Ubuntu 7.10 Gutsy Gibbon
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 18th, 2008 at 11:10 PM..
Yuzem is offline   Reply With Quote
Old May 19th, 2008   #2
aysiu
HP Mini 1120nr User
 
aysiu's Avatar
 
Join Date: May 2005
Location: US
My beans are hidden!
Ubuntu 9.10 Karmic Koala
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 &
__________________
tutorials | blog |
advice | more advice
aysiu is online now   Reply With Quote
Old May 19th, 2008   #3
Yuzem
Dipped in Ubuntu
 
Join Date: Oct 2006
Beans: 538
Ubuntu 7.10 Gutsy Gibbon
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?
Yuzem is offline   Reply With Quote
Old May 20th, 2008   #4
Yuzem
Dipped in Ubuntu
 
Join Date: Oct 2006
Beans: 538
Ubuntu 7.10 Gutsy Gibbon
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.
Yuzem is offline   Reply With Quote
Old May 20th, 2008   #5
Can+~
Chocolate Ubuntu Mocha Blend
 
Can+~'s Avatar
 
Join Date: Aug 2007
Location: 127.0.0.1
Beans: 1,726
Ubuntu 9.10 Karmic Koala
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
Quote:
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.
__________________
"Premature optimization is the root of all evil" (Donald Knuth)

Last edited by Can+~; May 20th, 2008 at 12:28 PM..
Can+~ is offline   Reply With Quote
Old May 20th, 2008   #6
Yuzem
Dipped in Ubuntu
 
Join Date: Oct 2006
Beans: 538
Ubuntu 7.10 Gutsy Gibbon
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...?
Yuzem is offline   Reply With Quote

Bookmarks

Tags
bookmarks, cli, firefox 3, sqlite

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 12:29 AM.


vBulletin ©2000 - 2010, Jelsoft Enterprises Ltd. Ubuntu Logo, Ubuntu and Canonical © Canonical Ltd. Tango Icons © Tango Desktop Project. bilberry