url = 'https://auto.ria.com/uk/car/lancia/?page=1'
r = requests.get(url=url)
soup = BeautifulSoup(r.text)
items = soup.find_all('div', class_='content-bar')
len(items)
url = 'https://auto.ria.com/uk/search/?indexName=auto,order_auto,newauto_search&brand.id[0]=36&country.import.usa.not=-1&price.currency=1&abroad.not=0&custom.not=1&page=0&size=20'
r = requests.get(url=url)
soup = BeautifulSoup(r.text)
items = soup.find_all('div', class_='content-bar')
len(items)
my_items = (0, 1, 2, 3, 4, 3, 2, 1, 0)
def find_index(value, items):
for index, item in enumerate(items):
if item == value:
return index
my_value = 3
print(find_index(my_value, my_items))
def find_second_index(value, items):
first_index = find_index(value, items)
subitems = items[first_index+1:]
subindex = find_index(value, subitems)
return first_index + subindex + 1
print(find_second_index(my_value, my_items))