-
Notifications
You must be signed in to change notification settings - Fork 0
/
upwork_project.py
22 lines (20 loc) · 944 Bytes
/
upwork_project.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import requests
from bs4 import BeautifulSoup
import pandas as pd
url = 'https://www.mcexpocomfort.it/en/Exhibitor-Online-Directory/#search=d%3D103945%7C1111_109%26rpp%3D64'
page_content = requests.get(url)
soup = BeautifulSoup(page_content.content,'html.parser')
items = soup.find_all(class_='listItemDetail exhibitorDetail')
print(len(items))
names = [item.find(class_='name').get_text() for item in items]
hall = [item.find(class_='formSection attributeattribute-dataType-textboxonelineonelanguage attribute-Id-104603 attribute-Name-hall keyvaluepair').get_text() for item in items]
stand= [item.find(class_='formSection attributeattribute-dataType-textboxonelineonelanguage attribute-Id-104602 attribute-Name-stand keyvaluepair').get_text() for item in items]
company_detail = pd.DataFrame(
{
'Company Name':names,
'Hall':hall,
'Stand':stand,
}
)
print(company_detail)
company_detail.to_csv('company.csv')