def get_pages_count(html):
soup = BeautifulSoup(html, 'html.parser')
pagination = soup.find('span', class_='pagination-item-1WyVp')
if pagination:
return int(pagination[-2].get_text())
else:
return 1
from furl import furl
from datetime import datetime
URL='https://www.сайт.ru/город/категория/book-dfgdfge?pmax=100&pmin=10&q=книга+для+чтения'
a = (furl(URL)).asdict()
a=datetime.strftime(datetime.now(), "%Y_%m_%d__%H_%M__") +a['path']['segments'][0] + '_' + a['query']['params'][-1][-1]