12/10/2009

Using curl to talk to iTunes

=====Using curl to talk to iTunes=====

To talk to iTunes from curl, spoof the user agent to pretend to be iTunes and set your store front to one of the legal values. Here, I set the store by passing it as a header field using curl's -H switch.


curl -s -A "iTunes/9.0.2 (Macintosh; U; PPC Mac OS X 10.2" -H "X-Apple-Store-Front: 143441-1,5" 'http://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewTopLegacy?id=25204&popId=30&genreId=36' > itunes_app_Topcharts_paidapps

12/03/2009

Get HK stock quote from curl

Reference for neat way to download stock data from HK Yahoo.

[[http://www.gummy-stuff.org/Yahoo-data.htm]]

http://finance.yahoo.com/d/quotes.csv?s= a BUNCH of STOCK SYMBOLS separated by "+" &f=a bunch of special tags

The following is an example to get 1398.hk

s=Symbol
n=Name
d1=Last Trade Date
l1=Last Trade(Price Only)
r=P/E Ratio
e=Earnings/Share
c=Change & Percent Change


#!/bin/bash

#Get the stock price and information from yahoo.
curl -s 'http://hk.finance.yahoo.com/d/quotes.csv?s=1398.hk&f=snd1l1cer'