Save secure page with wget

Curious to see if anyone here can help me do the following using wget or curl

Save my google analytics dashboard.

wget --random-wait referer="" --load-cookies=/Users/ideaprison/Design/\(Sites\)/Salty\ Knuckles/stats/cookies.txt -O ~/stats.html

*No error in the log, file is saved.

I removed the attempts to use user-agent and header so i’m aware those might help the problem.
Basically what i get in return is a html doc which only has a small modal box in it that reads
Internal error. Please try again later.
Analytics has encountered an unexpected condition and cannot fulfill your request.

So clearly theyre onto me.

The cookies.txt only contains my login for the analytics (used empty firefox and logged in, exported the cookies using an addon)

Let me know your thoughts because I really want to make this work!
The reason why i need this is because google analytics is very limited and bothersome so i wrote some javascript to turn the html into a nice page
Example here:


I’d start with googling for similiar solutions, that may use wget to get the data. I think there may be solutions with ruby out there.

If that doesn’t yield, then I’d have a look at the GoogleAnalytics FAQ, and if there isn’t anything, there, nor any solutions, for doing such transformations with wget. Then I’d email the guys at Google Analytics, about what you want to achieve.

As for user agents: there is really no problem to differ between wget with a user agent and a browser, besides that, the user agent may be specified in your session cookie, or used as a parameter for generating a hash.

A totally different solution, would be to log on normally, and then transform the page within Safari, with Apple Script and Javascript, maybe also with Chrome. Dashcode may be the ideal tool for this by the way! :slight_smile:

i’m going with a workaround that involves letting the browser save it to a txt file
So far so good. though not as neat as i would like it to be.



There should have been a commandline version of webkit, for such purposes. But actually I do think cocoa applications supports certain command-line parameters, but I don’t think that will help you much really, but maybe if you are using FireFox. :slight_smile:

Good luck!