Форум сайта python.su
Здравствуйте!
Почему код выдает всегда разные результаты по объему строк и соответственно результаты?
import requests from bs4 import BeautifulSoup url = 'https://www.rusprofile.ru/id/10601564' response = requests.get(url) ##(response.status_code) soup = BeautifulSoup(response.text, "html.parser") ##quotes = soup.find_all('span', class_='text') ##tags = soup.find_all('div', class_='tags') ##name = soup.find('div', class_='company-header__row').find('h1').get_text(strip=True) ##company_rows = soup.find('div', class_='company-requisites').find_all('div',class_='company-row') ##company_info_texts = company_rows[1].find_all('dd',class_='company-info__text') ##date = company_info_texts[0].get_text() ##capital = company_info_texts[1].find('span').get_text() ##director= soup.find('span', class_='company-info__text').get_text() ##company_info_title = company_rows[1].find_all('div',class_='company-info__title') ##ogrn = soup.find('span', id='clip_ogrn').get_text() ##inn = soup.find('span', id='clip_inn').get_text() ##kpp = soup.find('span', id='clip_kpp').get_text() ##okpo = soup.find('span', id='clip_okpo').get_text() ##okato = soup.find('span', id='clip_okato').get_text() ## ##index = soup.find('span', itemprop="postalCode").get_text() ##region = soup.find('span', itemprop="addressRegion").get_text() ##gorod = soup.find('span', itemprop="addressLocality").get_text() ##street = soup.find('span', itemprop="streetAddress").get_text() ##address = index+region+gorod+street print(soup)
Офлайн