Created
January 29, 2021 08:06
-
-
Save jmurphyau/3c6657ebeaedd91f5b687252822a23b9 to your computer and use it in GitHub Desktop.
Download WWDC 2020 Sample Code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -s 'https://developer.apple.com/wwdc20/sample-code/' | pcre2grep -o1 '<a href="https://developer.apple.com/documentation/(.*?)"' | while read sample_suffix; do json_response="$(curl -s 'https://developer.apple.com/tutorials/data/documentation/'$sample_suffix'.json')"; redir_url=$(echo "$json_response" | pcre2grep -o1 'Moved Permanently. Redirecting to /documentation/(.*)'); [[ ! -z $redir_url ]] && json_response="$(curl -s 'https://developer.apple.com/tutorials/data/documentation/'$redir_url'.json')"; echo $json_response | jq -r '.sampleCodeDownload.action | select(.overridingTitle == "Download") | .identifier' ; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment