undefined
Blog > Data Collection > Post

Build a Website Phone Number Extractor Step by Step

Sunday, January 24, 2021

Do you want to get the sales leads in bulks? Then, you are on the right page. Web scraping is an efficient way to extract phone numbers from web efficiently. With this article, you are able to know how to build a "Phone Number Extractor" with Octoparse.

 

Build Phone Extractor with Octoparse

 

Octoparse enables you to extract all the phone numbers from the web page with its advanced features. For example, if you are looking at all the lawyers in Dallas, Texas (United States) on www.lawyers.com, you will see the perfect results with all the details information of each lawyer.

But you may also notice that some phone numbers on the web page will appear after clicking on the “VIEW PHONE#” button and the location of the PHONE NUMBER button may change according to the contact information posted by different lawyers.

 

 

So, how to extract all the phone numbers of lawyers in Dallas, Texas on this site? The solution is to modify the X Path generated by Octoparse to accurately extract the phone numbers information wherever it is.

 

Firstly, there are 17 pages for the results. 

We can get the list of URLs as follows.

https://www.lawyers.com/all-legal-issues/dallas/texas/law-firms-p1/ 

https://www.lawyers.com/all-legal-issues/dallas/texas/law-firms-p2/

https://www.lawyers.com/all-legal-issues/dallas/texas/law-firms-p3/

https://www.lawyers.com/all-legal-issues/dallas/texas/law-firms-p2/

...

https://www.lawyers.com/all-legal-issues/dallas/texas/law-firms-p17/

 

 

Create a loop for extract data from the list of URLs.

 

Then extract all the phone numbers of the lawyers, and modify the X Path.

 

 

 

 

The result seems pretty good, right?

 

Before extracting any data from websites, I’d strongly recommend you read the terms of service of the website you want to pull data out from and thus avoid legal issues. I’ve attached the Octoparse file (Click HERE)and you can download it to extract the data directly after you launch Octoparse.

 

Octoparse is not just used to extract phone numbers, but also to extract other web content from complex websites using techniques such as AJAX, JavaScript, pagination, etc.. Try out more features now!

 

Web Scraping Legality

 

However, in some cases, scraping private data for business use may lead to legal issues. If you have worries, we have done a bit explanation on web scraping legality here:

Is web scraping via Octoparse legal and ethical?

Is Web Crawling Legal? Well, It Depends.

Is Web Scraping Legal in some Countries?

Web Scraping 101: 10 Myths that Everyone Should Know

 

 

 

Author: The Octoparse Team

 

contact us


 

Recommended reading:

How to Crawl Data from a Website

Price Scraping | Octoparse, Free Web Scraping Software

Why Extracting Big Data Is Important

3 Best Article Scraping Software Tools

Scraping Data from Website to Excel

Free Online Web Crawler Tool

Web Crawler Service

Download Octoparse to start web scraping or contact us for any
question about web scraping!

Contact Us Download
We use cookies to enhance your browsing experience. Read about how we use cookies and how you can control them by clicking cookie settings. If you continue to use this site, you consent to our use of cookies.
Accept decline