The Python script, main.py
, controls the entire operation of LeadGenPy. It utilizes Selenium with a web driver to enter Google Maps, search for specific business types, and extract relevant information.
LeadGenPy performs the following tasks:
-
Data Extraction:
- Searches for a specific business type and location.
- Loops through search results, extracts business details, and stores data in CSV (
data.csv
) and JSON (data.json
) files simultaneously. - Data extracted includes:
{ "BusinessName": "Sample Business", "Address": "123 Main Street, Cityville, State 12345", "PhoneNumber": "123-456-7890", "Website": "samplebusiness.com", "Category": "General Business", "Rating": "4.2", "ReviewCount": "10", "google_map_link": "https://www.google.com/maps/place/Sample+Business/data=...", "email": "info@samplebusiness.com", "status": "success" }
-
User Interaction:
- Offers options to the user:
- Terminate (
mode == 0
). - Start extraction (
mode == 1
). - View extracted dataset (
mode == 2
). - Transfer data to Google Sheets (
mode == 3
). - Generate personalized emails using Chat GPT (
mode == 4
). - Production mode (combining extraction, data transfer, and email sending) (
mode == 5
). - Development mode for sheet cleanup (
else
).
- Terminate (
- Offers options to the user:
-
Authentication:
- Prompts for Google sign-in if not authenticated (used for storing data in Google Sheets).
-
Select Extraction Mode (Mode 1):
- Choose the extraction mode to search for a specific business type and location on Google Maps.
- Follow on-screen instructions to provide the business name and location.
- The script will loop through search results, extract business details, and store data in CSV (data.csv) and JSON (data.json) files.
-
Lead Generation Using Chat GPT API (Mode 4):
- Choose the lead generation mode to generate personalized messages using the OpenAI Chat GPT API.
- The script will use the collected business data to create custom lead messages.
-
Sending Emails (Mode 4):
- The script will use the generated messages to send personalized emails to the extracted email addresses.
-
Additional Modes:
- Explore other modes for viewing the extracted dataset, transferring data to Google Sheets, and more.
-
Production Mode (Mode 5):
- A combined mode that includes extraction, data transfer, and email sending for a streamlined workflow.
-
Development Mode (Else):
- Cleanup mode for sheet maintenance.
Follow these steps to set up and run LeadGenPy locally:
-
Clone the Repository:
git clone https://github.com/your-username/LeadGenPy.git
-
Install Dependencies:
pip install -r requirements.txt
Dependencies:
selenium==4.5.0
python-dotenv==0.21.0
beautifulsoup4==4.12.2
requests==2.28.1
google-auth-oauthlib==1.1.0
google-auth-httplib2==0.1.0
google-auth==2.15.0
google-api-python-client==2.70.0
google-api-core==2.11.0
googleapis-common-protos==1.57.0
openai==0.28.0
lxml
-
Environment Variables:
- Create a
.env
file with the following content:OPENAI_API_KEY="Your-OpenAI-API-KEY" SPREADSHEET_ID="Your-Google-sheet-ID" EMAIL_ADDRESS="Your-Email-Address"
- Sample
- Create a
-
Download ChromeDriver:
- Download the appropriate version of ChromeDriver based on your Chrome browser version to avoid compatibility errors.
- Copy the Chromedriver.exe to the
assets\chromedriver.exe
folder - To check your browser version, Open Chrome and enter this URL
chrome://version
-
Run the Script:
cd src && python main.py
-
Authenticate with Google (if prompted):
- This is necessary for storing data in Google Sheets.
-
Select the desired mode:
- Choose the option that corresponds to your workflow.
This project is licensed under the MIT License - see the LICENSE file for details.
Feel free to contribute! Check out the Contributing Guidelines for more information.
- Discord: #wikkie
- LinkedIn: Vignesh Mayilsamy
- Email: wikkiedev@gmail.com