import requests
from bs4 import BeautifulSoup
from time import sleep
headers = {"User-Agent":
            "Mozilla/5.0 (Window; U; Windows NT 6.1; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5 (.NET CLR 3.5.30829)"}
countries = ["США","Швейцария","Сингапур","Норвегия","Ирландия","Австралия","Дания","Швеция","Нидерланды","Канада","Германия","Финляндия","Австрия","Турция","Дубай"]
for a in countries:
    url = f"https://www.booking.com/searchresults.ru.html?ss={a}&ssne={a}&ssne_untouched={a}"
    response = requests.get(url, headers=headers)
    soup = BeautifulSoup(response.text, "lxml") #html.parser
    count_hotel_block = soup.find("div",class_="d7a0553560")
    count_hotel = count_hotel_block.find("div",class_="d8f77e681c").text.split()
    c = 0
    for d in count_hotel:
        try:
            c = c + int(d)
        except:
            pass
    for b in range(0,c,25):
        url = f"https://www.booking.com/searchresults.ru.html?ss={a}&ssne={a}&ssne_untouched={a}&offset={b}"
        response = requests.get(url, headers=headers)
        soup = BeautifulSoup(response.text, "lxml") #html.parser
        
        block = soup.find("div", class_="d4924c9e74")
        b1 = block.find_all("div", {"role":"group"})
        for b2 in b1:
            name = b2.find("div", class_="f6431b446c a15b38c233").text
            
            url = f"https://www.google.com/search?q={name}" + " " + "email"
            response = requests.get(url, headers=headers)
            soup = BeautifulSoup(response.text, "lxml") #html.parser        tab_photo = []
    tab_photo_text = []
    tab_photo_html_text = []
    img = message.photo[0].file_id
    txt_html = message.html_text
    capt = message.caption
    tab_photo.insert(0, img)
    tab_photo_text.insert(0, capt)
    tab_photo_html_text.insert(0, txt_html)
    for a, c in zip(tab_photo, tab_photo_html_text):
        bot.send_message(message.chat.id, a, c, parse_mode='HTML')tab_photo = []
tab_photo_text = []
img = message.photo[0].file_id
capt = message.caption
tab_photo.insert(0, img)
tab_photo_text.insert(0, capt)
for a, c in zip(tab_photo, tab_photo_text):
      bot.send_message(message.chat.id, a, c)