Learn practical skills, build real-world projects, and advance your career
Updated 3 years ago
Project Outline:-
- Go to Website http://www.nyeca.org/find-a-contractor-by-name/
- Click on the Box that says “Search by Name of Contractor”
- You then will be able to see a list of Contractors Names and contact info in Alphabetical order as you scroll down
- Then take “All of the data” for all contractors from A to Z
• and “Enter Data into Excel Sheet”
• If there are “Multiple Contacts for the same company as seen in this example ABM Electrical & Lighting Services LLC,
• please create a separate line in the excel document duplicating the company name and address
• Adding the additional contact’s name, email and phone number email and phone numbers”
#Installing the request library to get the page data
!pip install requests --upgrade --quiet
import requests
scrape_url = 'http://www.nyeca.org/find-a-contractor-by-name/'
response = requests.get(scrape_url)
response.status_code
200
len(response.text)
556453
page_contents = response.text
page_contents[:1000]
'<!DOCTYPE html>\r\n<html class="no-ie" lang="en-US"> <!--<![endif]-->\r\n\t<head>\r\n\t\t\r\n\t\t<meta charset="UTF-8">\r\n\t\t\r\n\t\t\t\t\t<link rel="icon" type="image/png" href="http://www.nyeca.org/wp-content/uploads/2018/01/nyeca.png" />\r\n\t\t\r\n\t\t<meta name="viewport" content="width=device-width, initial-scale=1.0" />\r\n\t\t\r\n\t\t<link rel="dns-prefetch" href="//fonts.googleapis.com" />\r\n\t\t\r\n\t\t<title>Find A Contractor – By Name – NYECA</title>\n<meta name=\'robots\' content=\'max-image-preview:large\' />\n<link rel=\'dns-prefetch\' href=\'//fonts.googleapis.com\' />\n<link rel=\'dns-prefetch\' href=\'//s.w.org\' />\n<link rel="alternate" type="application/rss+xml" title="NYECA » Feed" href="http://www.nyeca.org/feed/" />\n<link rel="alternate" type="application/rss+xml" title="NYECA » Comments Feed" href="http://www.nyeca.org/comments/feed/" />\n\t\t<script type="text/javascript">\n\t\t\twindow._wpemojiSettings = {"baseUrl":"https:\\/\\/s.w.org\\/images\\/core\\/emoji\\/13.1.0\\/72x72\\/","ext":".png","svgUrl":"https:\\'