Using Firefox 3.0+ cookies with wget/curl

Tags: , , , , ,

Firefox versions prior to 3.0 stored their cookies in a standard cookies.txt file that could be used by tools like wget or curl. From version 3.0 onwards, Firefox uses sqlite for persistence of cookies and other data, making it slightly more difficult to use the same cookies. Here’s an invocation you can use to generate a cookies.txt file from your cookies.sqlite file:

sqlite3 -separator $'\t' cookies.sqlite \
    'select host, "TRUE", path, case isSecure when 0 then "FALSE" else "TRUE" end, expiry, name, value from moz_cookies' > cookies.txt

Make sure you’re in the proper profile directory, and that Firefox isn’t running. Otherwise, you’ll get a message that the database is locked.

I’ve tested this so far with Firefox 3.5 and 3.6. Should work as long as the structure of the cookies.sqlite file doesn’t change.

Share and Enjoy

  • Facebook
  • Twitter
  • Delicious
  • LinkedIn
  • StumbleUpon
  • Add to favorites
  • Email
  • RSS

Comments are closed.