I love Chrome Cookies


I know it’s been way too long since I’ve posted and this isn’t intended as a heartfelt explanation, merely a reference for those in need.

I’ve been hacking up a storm and shoehorning my way around problems and this is no different.

If you need to use wget with a site that requires authentication, then you need to dump some cookies from Chrome (or Firefox) because they’ve moved from cookies.txt to sqlite3.

Here’s how (when typing this from the cmdline hit ^V then <Tab> for the separator, i.e. after the 1st ‘:

sqlite3 -separator '       ' Cookies 'select host_key, httponly, path, secure, expires_utc, name, value from cookies' > ~/Sites/uservice/chrome_cookies.txt

Unfortunately that didn’t work for me (not sure why wget wasn’t correctly reading the file) so I ended up using Firebug to look at the HTTP headers, and then using wget with:

wget --no-cookies --header= "Cookie: name1=v1; name2=v2; name3=v3"

It’s actually way easier than it looks to get your header correctly, just copy and paste what you see from Firebug (look at the “Net” field and have it show all communications, what you want is the 1st line sent).

I figured this out with some help but mostly by my lonesome given the differences for Chrome.

About jay

I'm trying to build something interactive where I can learn from others and hopefully share useful knowledge too. thecapacity@gmail.com
This entry was posted in frustration, hacks. Bookmark the permalink.

One Response to I love Chrome Cookies

  1. jay says:

    In case anyone needs it, here’s most of my wget cli (edited for privacy)

    This was after I downloaded wget version 1.12 and compiled it:

    ~/bin/wget-1.12/src/wget –no-cookies –header “Cookie: ” –referer=http:///login –domains= –random-wait -w8 -e robots=off -U “Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv: Gecko/20100722 Firefox/3.6.8” -E -t3 -c -r -l4 -nc -k -p -np –max-redirect 2 http://example.com/main_page

Comments are closed.