Created
October 12, 2017 14:07
-
-
Save zeayes/6716be128ce7017123e800a4c888193c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from BeautifulSoup import BeautifulSoup | |
url = 'https://www.nbbu.nl/lid/fbcompany-vof-h-o-d-n-afwascompany/' | |
response = requests.get(url) | |
soup = BeautifulSoup(response.content) | |
company = soup.find(attrs={'class': 'member type-member inner-wrapper'}) | |
name = company.contents[3].text | |
number = company.contents[-3].strip() | |
since = company.contents[-5].strip() | |
info = soup.find(attrs={'id': 'hoofdvestiging'}) | |
column1 = info.find(attrs={'class': 'column-1'}) | |
address = column1.contents[0].strip() + column1.contents[2].strip() | |
www = column1.contents[5].text | |
column2 = info.find(attrs={'class': 'column-2'}) | |
tel = column2.contents[0].strip() | |
fax = column2.contents[2].strip() | |
print('\n'.join([name, number, since, address, www, tel, fax])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment