Search code examples
csswgetgoogle-webfonts

Google Font CSS different when pulled via WGET


I'm trying to dynamically grab a Google Fonts css file so I can parse it for the font URL. I'm hitting some odd behavior. Compare:

http://fonts.googleapis.com/css?family=Droid+Sans (From Chrome, if it matters)

To

WGET -qO- http://fonts.googleapis.com/css?family=Droid+Sans

From Chrome, I get:

@font-face {
  font-family: 'Droid Sans';
  font-style: normal;
  font-weight: normal;
  src: local('Droid Sans'), local('DroidSans'), url('http://themes.googleusercontent.com/static/fonts/droidsans/v3/s-BiyweUPV0v-yRb-cjciBsxEYwM7FgeyaSgU71cLG0.woff') format('woff');
}

But WGET gives me:

@font-face {
  font-family: 'Droid Sans';
  font-style: normal;
  font-weight: normal;
  src: local('Droid Sans'), local('DroidSans'), url('http://themes.googleusercontent.com/static/fonts/droidsans/v3/s-BiyweUPV0v-yRb-cjciC3USBnSvpkopQaUR-2r7iU.ttf') format('truetype');
}

I see thirtydot's answer at Google fonts external CSS Vs copying the code of external css in my css? stating that Google serves up different CSS based on who is requesting the file. Anyone know what WGET params I can pass so that it hands me the same version I am getting from Chrome?


Solution

  • wget -U "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.24 Safari/536.5" http://fonts.googleapis.com/css?family=Droid+Sans