Find Business Leads and Contact Info from YellowPages

Is it time to fill your sales funnel? Don't fret - you can now update your lead list with new contacts super easily every time it runs dry. In this tutorial, I will show you how to get a few business contacts from YellowPages. You will learn to extract the name, email, address and telephone number for each business. The tips and tricks in this tutorial can apply to any business directory where you have a list of contacts, companies or even restaurants.

In this tutorial you will learn how to:

  1. Navigate through business listings on YellowPages.
  2. Go through multiple business directory pages with pagination.
  3. Extract contact information such as address, email and phone number for several businesses.

Step 1: Open ParseHub and YellowPages

  1. Open the ParseHub desktop app.
  2. Open the following link - http://www.yellowpages.ca/ in the browser. If you are not in the USA, go to your country's yellow pages.
  3. Search for "Accountants" near "San Francisco, CA" in the search bar or for any other professional in any city. You will be taken to the first page of relevant search results.
  4. Click "New Project" and "Start project on this URL" to create a new project.
  5. In the "Select page (1)" command, I checked off "Wait up to 60 seconds for elements to appear" just in case the page takes a while to load.

Step 2: Select all of the business names

  1. Using the Select tool, click on the first business' name on the webpage. The rest of the businesses will be highlighted yellow.
  2. Click on another one and they should all be selected and highlighted green. Go through the page to see if any of the businesses are not selected, and if they are not then click on them as well. Rename your selection businesses.
  3. I want to make sure the businesses load on the page before ParseHub starts trying to find them, so I click on the command and check off "Wait up to 60 seconds for elements to appear."
  4. ParseHub will automatically add a Begin a new entry command and extract the name and url of each business.

Note: You should now have all of the businesses selected and all of the business names extracted into your sample results. You will see a sample JSON with the first 3 business names.

scrape data from yellowpages

Step 3: Scrape the telephone number for each business

  1. Click the plus button next to "Begin new entry in businesses and add a Relative Select command, to create a relationship between the business names you have selected and any other items on the page.
  2. Click on the first business name. Now click on the telephone next to the business name. All of the telephone numbers on the page for all of the businesses should be selected and extracted for you. Rename the selection tel.

Note: You should see the name and the telephone number appear in separate columns for each business in your sample results.

scrape telephone numbers from yellowpages

Step 4: Scrape the address for each business

  1. Click on the plus button beside "Begin new entry in businesses" again to add another Relative Select command.
  2. Click on a business name and then click on the address next to it. This selects each address and extracts it.

Note: Keep following the steps above to select any other information for each business, such as the postal code, description, categories or website.

scrape addresses from yellow pages

Step 5: Navigate to the profile page of each business and get the email address

  1. Click on the plus button next to the "Begin new entry in businesses" command in the project design tab again, so you can add the next set of instructions right under the list.
  2. Add a Click command. You will be asked if you would like to go to the main template or create a new one: say that you would like to create a new one called "details".
  3. Once you click the button "Create new template" you will be taken to the first business' page. When you run your project, the instructions that you tell ParseHub to do on this page will be done on the pages of each business that you selected on the previous page.

Note: You should use the Click tool and create a new template every time the structure of the page changes (every time the webpage looks different). This is why we use "main_template" for the page where the businesses are listed and the "details" template for the profile page of each business.

navigate to the profile pages of each business on yellowpages

Step 6: Scrape the email addresses for each business on YellowPages

  1. In the new "details" template, I again went to the "Select page (1)" command to check off "Wait up to 60 seconds for elements to appear."
  2. Now with the Select command I click on the "Email Business" button to select it.
  3. Click on the plus button beside the "Select email" command to open the command menu.
  4. Open the full menu by clicking "Advanced" and choose the Extract command.
  5. From the dropdown menu in the ParseHub sidebar, choose "Extract href". Notice how the text in your sample results changes to
    "mailto:email@email.com".

    navigate to the profile pages of each business on yellowpages

  6. You can use ParseHub to parse just the "email@email.com" portion of the text, without the preceding "mailto:" (although it will take a little more technical knowledge). Check-mark the "Use regex" feature to do this.

  7. In the text box enter the regular expression mailto:(.*). Now you should only see the email without the "mailto:" in the sample results.

    clean up text from pages with ParseHub

  8. Just like not every business has their address on yellow pages, some may not have their email either. ParseHub will just leave that section blank for them.

Step 7: Use pagination to get information from all pages that list businesses

  1. Go back to the search results page. ParseHub should have opened a new tab when traveling to the details page, so you can just go back to the other tab. This should also take you to your "main_template".
  2. Scroll down the page until you see the "Next" button.
  3. Add a Select command by clicking on the plus button next to the command
    Select page", the very first command in your main_template.
  4. Select the "Next" button by clicking on it. Rename the selection next_button.
  5. Click on the plus button next to this new "Select & Extract next_button" command and add a Click command.
  6. The next page has the same structure as the first page, so you will choose "Go to Existing Template", select "main_template" and click the "Go to Existing Template" button. On the next page you will see that each of the business names, telephone numbers and addresses are selected, just like the previous page.

scrape contact information from yellowpages

Step 8: Run your project and download the data in CSV or JSON

  1. Click the green “Get Data” button. Click “Run” on the next page, then "Save and Run".
  2. Use the blue button at the top to refresh the page. You should also get an email when the run is finished. You can click on the link in this email to go to your finished results.
  3. Click the CSV icon to download your results in CSV. If you have Excel, the product data will open in Excel automatically.

scrape contact information from yellowpages

That's it for now! If you want more ideas on growth hacking, business directories or lead generation feel free to reach out at angelina[at]parsehub.com.

Happy happy lead hunting!