Skip to navigation
Some BeautifulSoup usage example
04.03.22
soup = BeautifulSoup(r.text, "html.parser") doc = sortedcontainers.SortedDict() try: doc['material'] = soup.find_all(class_='product-material')[0].findChild('span').get_text().replace(' ','').replace('\n','').replace('\t','').replace('Article code:','').strip() doc['name'] = soup.find_all(class_='product-name')[0].get_text().strip() doc['description'] = soup.find_all(class_='product-description')[0].get_text().strip() bread = soup.find_all(class_='breadcrumb')[0].find_all(attrs={"itemprop": "name"}) doc['price_eur'] = soup.find_all(id='base-price')[0].get_text().replace(' €','').strip()
https://beautiful-soup-4.readthedocs.io/en/latest/
Reply
Anonymous
Information Epoch 1732513564
Using text data files.
Home
Notebook
Contact us