随笔 - 224  文章 - 41  trackbacks - 0
<2010年12月>
2829301234
567891011
12131415161718
19202122232425
2627282930311
2345678

享受编程

常用链接

留言簿(11)

随笔分类(159)

随笔档案(224)

文章分类(2)

文章档案(4)

经典c++博客

搜索

  •  

最新评论

阅读排行榜

评论排行榜

关于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 漂漂 阅读(2928) 评论(1)  编辑 收藏 引用

FeedBack:
# re: 模拟iTunes的登陆,并获取用户的名称[未登录] 2016-04-15 09:30 123
暗室逢灯  回复  更多评论
  

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理