How to Scrape and Crawl Business Directories Contact Details?

How-to-Scrape-and-Crawl-Business-Directories-Contact-Details

Business directories enable users to search for companies, services, or providers in a specific area in a more targeted manner. A business directory is similar to an online category of the Yellow Pages. Almost all business directories contain an index of companies listed in alphabetic order by industry—the individual entry links to the related company’s website.

The listings provide information related to specific businesses, including name, contact information, address, associations, services, or products offered. The businesses are available by activity, size, or location. However, your business must include all relevant information in business directories. Failure to do so can confuse potential customers. If you are new to the business and wondering what info must enhance your business's visibility, the best option is to scrape business directories using Yellow Pages scraper.

What to Include Before Adding to a Directory?

Your company listing must have the following information before adding it to a directory:

  • Consistent Info: If you add company business to multiple business directories, ensure the company information is the same across all directories.
  • Website Link: Backlinks or inbound links are essential for your company’s website. You can add a tracking link at the end of the URL to monitor how much traffic your website gains from the directories.
  • Company Description: Ensure to put the right and detailed description about your company that reflects your vision, mission, objectives, services, and products.
  • Multimedia: Adding visual taste to your company can enhance visibility and search. Try to add videos of your office, products, employees, or daily business operation.

There are still several things to include in the company listing. Scrape business listing to know what your competitors have added differently.

Example of Business Directories

Some of the well-known business directories are as follows:

  • Yelp
  • Yellow Pages
  • Checktrade.com
  • Yell
  • Super Pages
  • HubSpot
  • YellowBook.com
  • MapQuest, etc.

List of Data Fields

The following data are available from business directories

  • Company Name
  • Company Type
  • Location
  • Contact Number
  • Email
  • Source URL
  • State
  • Postal Code
  • Website

Scrape Business Directories Using Python

Here, we are taking the example of Yellow Pages to scrape and crawl business directories contact details using Python. Yellow Pages consist of massive data for businesses. In this corporate world, lead generation is a crucial factor. And you must be aware of it. It is a process where you approach prospective clients via emails, messages, or calls and make them aware of your products and services. And if they like your offer, they will purchase it from you.

Now, the question arises, how will you generate leads and scrape data to get emails or contact numbers? So, here comes the role of business directory scraping services. In this blog, we will scrape Yellow Pages to obtain contact numbers and other details.

Suppose you are a kitchen utensil dealer or manufacturer looking for a prospective buyer. In such a situation, restaurants will be your primary targets. Hence, we will scrape restaurant details from the yellow pages. We are more interested in getting the name, address, and phone number. We are targeting restaurants in New York. Consider this URL.

Scrape-Business-Directories-Using-Python

We will use Python to scrape leads from business directories. Further, we will use requests and beautifulsoup for task execution.

Create a folder and install these libraries.

Create-a-folder-and-install-these-libraries

Let’s start with the coding process.

Create a file and name it.

Here, we will use ypages.py. Import the installed libraries.

Here-we-will-use-ypages-py-Import-the-installed-libraries

Now, declare the target website for yellow page scraping.

Now-declare-the-target-website-for-yellow-page-scraping

We have made the GET request using the request library for our target website. We will first inspect the web page to check where all results are stored.

We are using BS4 on the stored data in the resp variable for creating an HTML tree.

We-are-using-BS4-on-the-stored-data-in-the-resp-variable-for-creating-an-HTML-tree

We can see that all results are under the div tag with the class ‘result.’ We will find the name, address, and contact number within this div.

We-can-see-that-all-results-are-under-the-div-tag-with-the-class-result-We-will-find-the-name-address-and-contact-number-within-this-div

The name lies under a tag with a class name as ‘business name”. Next, we will check for phone numbers.

The-name-lies-under-a-tag-with-a-class-name-as-business-name-Next-we-will-check-for-phone-numbers

The address is within the div tag having class name as adr. Now, we have all the information with us. So, we will extract the data by running a loop.

The-address-is-within-the-div-tag-having-class-name-as-adr

On printing, you will get this.

On-printing-you-will-get-this

We have successfully scraped all the target data. But how to scrape emails and websites? For this, we will first check the locations of email and website addresses for a specific restaurant's Yellow Pages.

We-have-successfully-scraped-all-the-target-data-But-how-to-scrape-emails-and-websites

The website lies within a tag inside the href attribute.

The-email-is-within-the-href-attribute-with-a-tag

The email is within the href attribute with a tag.

Our objective in scraping all these details is to generate a new target website for each restaurant. For example, the URL for Mr. K’s restaurant is:

The section till .com will remain the same, but the string after that will change according to the restaurant.

Now-we-will-scrape-our-data-of-interest

Now, we will scrape our data of interest.

We will make specific changes in the last ‘for’ loop.

We-will-make-specific-changes-in-the-last-for-loop

Our new target_website is a link to the dedicated page. We will then extract data from these pages.

Our-new-target-website-is-a-link-to-the-dedicated-page-We-will-then-extract-data-from-these-pages

The BS4 .get() function will help us to extract data from any attribute. After printing, we can have all emails and website URL

The-BS4-get-function-will-help-us-to-extract-data-from-any-attribute

The final complete code is ready for cold emailing or cold calling.

The-final-complete-code-is

Conclusion

Thus, we learned how to create a target prospect list for your company using business directories data scraping. The proper business directory scraper can help extract valuable business data from target websites. Collecting prospects is not limited to Yellow Pages but can be done similarly from all business directories. IWeb Data Scraping provides the best-automated business directory scraping services using tools and techniques that are GDPR compliant.

For more information, get in touch with iWeb Data Scraping now! You can also reach us for all your web scraping service and mobile app data scraping requirements.

Let’s Discuss Your Project