- Use the Google People's (Contacts) API to fetch email addresses from a large contacts directory and from personal contacts & write them to txt files.
- Use case: Scrape all emails from a University Contacts directory and export them to a txt file.
- Google Contacts does not have a native Bulk Contact Export feature that exports all contacts at once. This provides a way to do so.
- You can customise this script to store names, phone numbers and more. Read more.
-
Clone the Repository
git clone https://github.com/aryanranderiya/GoogleContactsEmailScraper.git
-
Navigate to the project directory:
cd GoogleContactsEmailScraper
-
Install Dependencies
pip install -r requirements.txt
-
Run the Script
python app.py
Make sure to setup a Project using Google Cloud Console.
More Information Here: https://developers.google.com/people/v1/getting-started
-
The Script should work fine out of the box if a project is setup correctly using OAuth 2.0 with the following scopes:
contacts.readonly
&directory.readonly
in Google Cloud Console -
After running the script using
python app.py
it will redirect to complete the authentication procses, after which atoken.json
file be created in the same directory. -
After scraping all the emails, the txt files containing the emails will be stored in the same directory in
contacts_emails.txt
anddirectory_emails_alphabetic.txt
directory_emails_domain.txt
if your account is under an organization (such as a University domain: studentusername@university.edu.in)
Thank you for viewing this Repo! A 🌟 would be appreciated if this project was helpful!