使用wget或curl下载Xcode [英] Downloading Xcode with wget or curl

查看:193
本文介绍了使用wget或curl下载Xcode的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用wget或curl从Apple Developer网站下载Xcode。



当我运行这个命令:

  wget \ 
--post-data =theAccountName = USERNAME& theAccountPW = PASSWORD\
--cookies = on \
--keep-session-cookies \
--save-cookies = cookies.txt \
-O - \
https:// developer .apple.com / ios / download.action?path = / ios / ios_sdk_4.1__final / xcode_3.2.4_and_ios_sdk_4.1.dmg> / dev / null

一个名为 cookies.txt的文件已创建并包含如下内容:

  developer.apple.com FALSE / FALSE 0 XXXXXXXXXXXXXXXX XXXXXXXXXXXX 
开发人员.apple.com FALSE / FALSE 0 developer.sessionToken

我不完全肯定,应该有比它更多的(具体来说, sessionToken 后的字母数字字符串)。



使用curl做同样的事情:

  curl \ 
-dtheAccountName = USERNAME& theAccountPW = PASSWORD \
-c xcode-cookie \
-AMozilla / 5.0(Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1)Gecko / 20061204 Firefox / 0.1\
https://developer.apple.com/ios/download.action?path=/ios/ios_sdk_4.1__final/xcode_3.2.4_and_ios_sdk_4.1.dmg

我得到一个名为 xcode-cookie 的文件, c $ c> cookies.txt 文件wget给了我,除了行是颠倒的。



然后我试图下载.dmg文件。



使用wget:

  wget \ 
--cookies = on \
--load-cookies = cookies.txt \
--keep-session-cookies \
http://developer.apple.com/ios /download.action?path=/ios/ios_sdk_4.1__final/xcode_3.2.4_and_ios_sdk_4.1.dmg

这会给我一个名为 login?appIdKey = XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX& path =%2F%2Fios%2Fdownload.action?path =%2Fios%2Fios_sdk_4.1__final%2Fxcode_3.2.4_and_ios_sdk_4.1.dmg $ b $



使用curl:

  curl \ 
-b xcode-cookie \
-c xcode-cookie \
-O -v \\ \\
-AMozilla / 5.0(Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1)Gecko / 20061204 Firefox / 2.0.0.1\
https://developer.apple.com/ios/download.action?path=/ios/ios_sdk_4.1__final/xcode_3.2.4_and_ios_sdk_4 .1.dmg

它打印的基本上与wget(减去HTML) >

我想说的是,它与sessionToken不在cookie中,但像我之前说的,我不知道,我甚至尝试从我的浏览器导出cookies,然后



我必须做错事,除非苹果自10月以来改变了一些东西。 10 因为这个家伙似乎要做某事



提前感谢!

解决方案

对于Chrome,


  1. 安装 cookies.txt Chrome扩展

  2. 登录到Apple开发者网站并获取下载网址

  3. 运行cookies.txt扩展并下载cookies.txt文件

  4. 从cookies.txt下载目录中,将Cookie加载到wget并开始恢复下载。例如,要下载Xcode_7.dmg,您需要运行:



    wget --load-cookies = cookies.txt -c http://adcdownload.apple.com/Developer_Tools/Xcode_7/Xcode_7.dmg



I am trying to download Xcode from the Apple Developer site using just wget or curl. I think I am successfully storing the cookie I need to download the .dmg file, but I am not completely sure.

When I run this command:

wget \  
   --post-data="theAccountName=USERNAME&theAccountPW=PASSWORD" \  
   --cookies=on \  
   --keep-session-cookies \  
   --save-cookies=cookies.txt \        
   -O - \  
   https://developer.apple.com/ios/download.action?path=/ios/ios_sdk_4.1__final/xcode_3.2.4_and_ios_sdk_4.1.dmg > /dev/null

A file called cookies.txt is created and contains something like this:

developer.apple.com FALSE / FALSE 0 XXXXXXXXXXXXXXXX  XXXXXXXXXXXX
developer.apple.com FALSE / FALSE 0 developer.sessionToken

I'm not completely certain, but I think there should be more to it than that (specifically, an alphanumeric string after sessionToken).

When I try to do the same thing with curl using this:

curl \  
   -d "theAccountName=USERNAME&theAccountPW=PASSWORD" \
   -c xcode-cookie \ 
   -A "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1" \
   https://developer.apple.com/ios/download.action?path=/ios/ios_sdk_4.1__final/xcode_3.2.4_and_ios_sdk_4.1.dmg

I get a file called xcode-cookie that contains the same information as the cookies.txt file wget gives me, except that the lines are reversed.

I then tried to download the .dmg file.

Using wget:

wget \
   --cookies=on \
   --load-cookies=cookies.txt \
   --keep-session-cookies \
   http://developer.apple.com/ios/download.action?path=/ios/ios_sdk_4.1__final/xcode_3.2.4_and_ios_sdk_4.1.dmg

This gives me a file called login?appIdKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&path=%2F%2Fios%2Fdownload.action?path=%2Fios%2Fios_sdk_4.1__final%2Fxcode_3.2.4_and_ios_sdk_4.1.dmg , which is just an HTML page containing the login form for the developer site.

Using curl:

curl \
   -b xcode-cookie \
   -c xcode-cookie \
   -O -v \
   -A "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1" \
   https://developer.apple.com/ios/download.action?path=/ios/ios_sdk_4.1__final/xcode_3.2.4_and_ios_sdk_4.1.dmg

Which prints basically the same thing as wget (minus the HTML).

I want to say it has to do with the sessionToken not being in the cookie, but like I said before I am not sure. I even tried exporting the cookies from my browser and following the instructions in the blog post I linked below and several other sites I found while searching for help.

I must be doing something wrong, unless Apple has changed something since Oct. 10 because this guy seems to be to do something right.

Thanks in advance!

解决方案

For Chrome,

  1. Install cookies.txt Chrome extension
  2. Login to Apple Developer site and get the url for downloading
  3. Run cookies.txt extension and download cookies.txt file
  4. From the cookies.txt download directory, load cookies into wget and start resumable download. For example, to download Xcode_7.dmg, you would run:

    wget --load-cookies=cookies.txt -c http://adcdownload.apple.com/Developer_Tools/Xcode_7/Xcode_7.dmg

这篇关于使用wget或curl下载Xcode的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆