Skip to content

Instantly share code, notes, and snippets.

@jmurphyau
Created January 29, 2021 08:06
Show Gist options
  • Save jmurphyau/3c6657ebeaedd91f5b687252822a23b9 to your computer and use it in GitHub Desktop.
Save jmurphyau/3c6657ebeaedd91f5b687252822a23b9 to your computer and use it in GitHub Desktop.
Download WWDC 2020 Sample Code
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