Download Xcode from developer.apple.com using aria2c
Because developer.apple.com needs login, to download Xcode using aria2c, we need to export a cookies file for this site.
After tried some Chrome extensions like cookies.txt, cookietxt-export, I found the cookies text they generate don't work with aria2c. But you can use my fork muyexi/cookie-txt-export of cookie-txt-export.
Follow the below steps:
Git clone from muyexi/cookie-txt-export.
Open extensions page in Chrome, click "Developer Mode", and load unpacked extension from the src directory.
Open https://developer.apple.com/downloads/, use "cookie-txt export" to generate a cookies.txt file for this site.
Execute this script:
aria2c --load-cookies=cookies.txt XCODE_LINK