關于iTunes的研究到處都可以見到,
這里根據看雪的文章
http://bbs.pediy.com/showthread.php?t=168303 ,
簡單的用c#代碼模擬iTunes賬號的登陸(只考慮成功的情況),并獲取賬號里的信息,關于解析plist的庫現已有多個庫可用,
采用的是iphone-plist-net,地址在:
http://code.google.com/p/iphone-plist-net/ 上。
模擬登陸最重要的是post 什么數據到 哪個url上,
通過跟蹤,這里是主要的數據
url地址:p3-buy.itunes.apple.com
post的數據為:
(Request-Line):GET
/WebObjects/MZFinance.woa/wa/authenticate?appleId=xxx&password=xxx&attempt=1&machineName=&why=purchase&guid=4AEF365B.CF847F94.08E11EF5.FDD88C5B.09DA8172.65FAFEFB.6A193139&Pod=3&PRH=3 HTTP/1.1
Cache-Control:no-cache
Referer:http://itunes.apple.com/cn/
Accept-Language:zh-cn, zh;q=0.75, en-us;q=0.50, en;q=0.25
X-Apple-Tz:28800
X-Apple-Store-Front:143465-19,12
Host:p3-buy.itunes.apple.com
Connection:Close
post后返回的是plist格式的字符,里面包含了用戶的信息。
C#簡單的代碼如下:
string strInfo = GetiTunesData("https://p3-buy.itunes.apple.com/WebObjects/MZFinance.woa/wa/authenticate?appleId=asdfasdf@asdf.co&password=qweqweqwe&attempt=1&machineName=&why=purchase&guid=4AEF365B.CF847F94.08E11EF5.FDD88C5B.09DA8172.65FAFEFB.6A193139&Pod=3&PRH=3");
Stream s = new MemoryStream(Encoding.UTF8.GetBytes(strInfo));
PListRoot root = PListRoot.Load(s);
PListDict dic = (PListDict)root.Root;
PListDict accountInfo = (PListDict)dic["accountInfo"];
PListDict address = (PListDict)accountInfo["address"];
string firstName = ((PListString)address["firstName"]).Value;
string lastName = ((PListString)address["lastName"]).Value;
這里可以知道,plist的很多字段,這里字段以后用來購買軟件。
posted on 2013-07-05 11:47
漂漂 閱讀(3044)
評論(1) 編輯 收藏 引用