Вот код:
import requests
import datetime
from bs4 import BeautifulSoup
now = datetime.datetime.now()
now_date = now.strftime("%d.%m.%Y")
URL = 'https://sxodim.com/almaty/search-events?date_from=' + now_date + '&date_to=' + now_date
HEADERS = {'user_agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 Edge/18.18363'}
response = requests.get(URL, headers=HEADERS)
soup = BeautifulSoup(response.text,'html.parser')
news_sxodim = soup.find_all('div', class_='news small ')
title_sxodim = ''
price_sxodim = ''
page_num = []
for i in soup.find_all('div', class_ = 'info'):
price_sxodim += i.find('div', class_ = 'str bold').text.strip() + '\n'
print(price_sxodim)
Вот ошибка:
`price_sxodim += i.find('div', class_ = 'str bold').text.strip() + '\n'
AttributeError: 'NoneType' object has no attribute 'text'`
А вот откуда я пытаюсь взять нужную мне инфу:
<a href="https://sxodim.com/almaty/event/klassicheskiy-ekspress-tur-ot-sxodim-travel-13-dekabrya" class="img" style="background-image:url('/uploads/images_cache/341x200/posts/2020/12/03/8c19029adfdaad9609293bcb686acfb2.jpg')">
<span class="ticket_icon sold_out"></span>
</a>
<div class="info">
<div class="category_wrapper">
<a href="https://sxodim.com/almaty/events/tourism" class="category">
Туризм
</a>
<div class="views">326</div>
</div>
<div style="width:80%">
<a class="title" href="https://sxodim.com/almaty/event/klassicheskiy-ekspress-tur-ot-sxodim-travel-13-dekabrya">Классический экспресс-тур от Sxodim Travel (13 декабря)</a>
</div>
<div class="favorite_btn " data-id="35618" data-show_popup="login">
<svg class="svg-icon svg-icon--favorite">
<use xlink:href="https://sxodim.com/app/images/sprite.svg#favorite"></use>
</svg>
</div>
<div class="descr">
<div class="str">
13 декабря
</div>
<div class="str">300 км от города Алматы, на территории национального парка «Көлсай көлдері»</div>
<div class="str bold">8500 - 9500 тенге</div>
</div>
</div>
Меня интересуют class "str bold".
Подскажите в чем проблема