Пытался отправить get запрос с помощью библиотеки requests, выдаёт только response 200, файл при этом не скачивается.
r = requests.get('https://www.cian.ru/export/pdf/rent/flat/262482762/')
with open('file.pdf', 'wb') as f:
f.write(r.content)
можно также автоматически заходить на указанную почту, в которую пришло письмо с кодом, парсить его оттуда и вставлять в поле при регистрации
Придётся создавать аккаунт, отдельно для него. Все это, опять же, нужно автоматизировать, что, в свою очередь, займёт время и много лишний движений
Может, запрос перехватить?
product_tds = item.find_all("a")
title = product_tds[0].find("a").text
a
и внутри него опять ищете тег a
title = product_tds[0].text
product_tds
всегда будет содержать один элемент. Потому что он лежит внутри одного из восьми вложенных div. Так что переделываем логику в принципе get_attribute('textContent')
self.shops = self.driver.execute_script('return shopsObj')
for shop in self.shops:
print(shop['address'], shop['availability_hint'])
self.shops = self.driver.find_elements(By.XPATH, '//div[@class="b-shops-map__shop _other"]')
self.shops = self.driver.find_elements(By.XPATH, '//div[@class="b-shops-map__shop _other"]')
for shop in self.shops:
print(shop.find_element_by_class_name('b-shops-map__address-text').text)
print(shop.find_element_by_class_name('b-shops-map__availability-col-wrapper').find_element_by_class_name('b-tooltip-new__text.s-tooltip-text').get_attribute('textContent').strip())
print()
@client.on(events.NewMessage(chats=[]))
await event.message.forward_to(entity)
from bs4 import BeautifulSoup
html = '''
<div class="soundTitle sc-clearfix sc-hyphenate sc-type-h2 sc-text-h4 streamContext m-interactive"><div class="soundTitle__titleContainer">
<div class="soundTitle__playButton">
<a role="button" href="" class="snippetUXPlayButton sc-button-play playButton sc-button sc-button-xlarge" tabindex="0" title="Play" draggable="true">Play</a>
</div>
<div class="soundTitle__usernameTitleContainer">
<div class="sc-type-light sc-text-secondary sc-text-h4 soundTitle__secondary">
<a href="/gracedaviesofficial" class="soundTitle__username sc-link-secondary
sc-link-light">
<span class="soundTitle__usernameText">
Grace Davies
</span>
</a>
</div>
<a class="sc-link-primary soundTitle__title sc-link-dark sc-text-h4" href="/gracedaviesofficial/hello-adele">
<span class="">Hello - Adele</span>
</a>
</div>
<div class="soundTitle__additionalContainer sc-ml-1.5x">
<div class="soundTitle__uploadTime sc-mb-0.5x">
<time class="relativeTime" title="Posted on 26 October 2015" datetime="2015-10-26T14:51:09.000Z"><span class="sc-visuallyhidden">Posted 6 years ago</span><span aria-hidden="true">6 years ago</span></time>
</div>
<div class="soundTitle__tagContainer">
<span class="sc-snippet-badge sc-selection-disabled sc-snippet-badge-medium sc-snippet-badge-grey sc-hidden"></span>
<span class="sc-snippet-badge sc-selection-disabled sc-snippet-badge-small sc-snippet-badge-grey sc-hidden"></span>
<a class="sc-tag soundTitle__tag sc-tag-small" href="/tags/hello"><span class="sc-truncate sc-tagContent">hello</span></a>
</div>
</div>
</div>
</div>
'''
soup = BeautifulSoup(html, 'html.parser')
a_tags = soup.find_all('a', {'class': 'soundTitle__title'})
for a_tag in a_tags:
print(a_tag['href'], a_tag.find('span').text)