python tgbot parser eda.ru Не выводит рецепты.Помогите с кодом
Помогите пожалуйста с кодом.Telegrambot python parser рецептов с сайта eda.ru Бот запускается но при нажатии на кнопку начать поиск и вводе рецепта к примеру (салат)ничего не выводит.Раньше все Работало.
import re
import requests
import telebot
from telebot import types
bot = telebot.TeleBot('бот Token')
@bot. message_handler(commands=['start'])
def start(msg):
markup = types.InlineKeyboardMarkup(row_width=1)
btn = types.InlineKeyboardButton(
"Начать Поиск", switch_inline_query_current_chat='')
markup.add(btn)
bot.send_message(msg.chat.id, "Поиск", reply_markup=markup)
def filter_title(w):
if w.group('nbsp'):
return ' '
elif w.group('tri'):
return '...'
else:
return ''
@bot.inline_handler(func=lambda query: len(query.query) > 0)
def search_recipe(query):
try:
res = requests.get(
"https://eda.ru/recipesearch?q={0}&onlyEdaChecked=true".format(query.query))
res.encoding = 'utf-8'
pat = re.compile(
r'js-bookmark__obj.+?src="([^"]*)".+?horizontal-tile__item-title.+?href="([^"]*)".+?span>\s+(.+?)\s+<.+?js-portions-count-print">([^<]+)<', re.M | re.S)
reg_list = pat.findall(res.text)
recept_list = []
i = 0
for p in reg_list:
recept_list.append(types.InlineQueryResultArticle(
id=i,
title=re.sub(
r'(^\s+)|(?P<tri>…)|(?P<nbsp> )|(\s+$)', filter_title, p[2]),
description=p[3],
thumb_url=p[0],
input_message_content=types.InputTextMessageContent(
message_text="https://eda.ru"+p[1])
))
i += 1
bot.answer_inline_query(query.id, recept_list)
except Exception as e:
print(e)
bot.polling(none_stop=True)