Skip to content

Instantly share code, notes, and snippets.

@streaak
Last active May 14, 2022 20:29
Show Gist options
  • Save streaak/d018931bf4d9861073790596ec8c27e0 to your computer and use it in GitHub Desktop.
Save streaak/d018931bf4d9861073790596ec8c27e0 to your computer and use it in GitHub Desktop.
Script to gather emails from Hunter.io API
#!/bin/bash
total=$(curl -s "https://api.hunter.io/v2/email-count?domain=$1" | jq -r '.data.total')
echo "Total is $total"
if [ "$total" != "0" ]; then
for (( i=0; i<=$total; i+=100 ))
do
echo "offset $i"
curl -s "https://api.hunter.io/v2/domain-search?domain=$1&api_key=KEYHERE&limit=100&offset=$i" | jq -r '.data.emails[].value' >> hunter_emails.txt
done
sort -uo hunter_emails.txt hunter_emails.txt
fi
@streaak
Copy link
Author

streaak commented Aug 21, 2020

Yep, noticed that after I posted this. Running sort on every iteration is dumb anyway

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment