I wrote this AppleScript script, below, which extracts all contacts. How do I extract only the ones from iCloud?
set desktopPath to (path to the desktop folder as string) & "contactBackup"
alias desktopPath
tell application "Contacts"
repeat with cardPerson in people
set nameOfvCard to name of cardPerson & ".vcf"
set outFile to (open for access file (desktopPath & ":" & nameOfvCard) with write permission)
write (vcard of cardPerson as text) to outFile
close access outFile
end repeat
end tell