Scrape Sensor - Problem with class

I am trying to get out values from a webpage with scrape sensor.
I would like to use the class for search but it seems like it always pick the first occurrence of the class when I would like the second.

I cant seem to use nth_of_type together with a class so how should I do?

- platform: scrape
  name: Lunch
  select: '.app-daymenu-name'

‚Äú.list-group-item:nth-of-type(2) .app-daymenu-name‚ÄĚ

Does that work?

unfortunately not. still gets

  File "/usr/lib/python3.6/site-packages/homeassistant/components/sensor/", line 120, in update
    value =[0].text
IndexError: list index out of range

The selected text on thr below url is what I want.

Can you post your scrape sensor config again?

Here is the final, working scrape.
Got some help in another forum

select: ‚Äė.panel > div:nth-of-type(2) > div:nth-of-type(1) .app-daymenu-name‚Äô

Just for the record… :hamburger::fries:

If someone else wish to import mashie here are some findings:

Find the menu in mashie, but alter the URL

Instead of app:ävlinge%20kommun/Stinsgårdenfsk

Use menu:ävlinge%20kommun/Stinsgårdenfsk

Or menu with querystring old=Trueävlinge%20kommun/Stinsgårdenfsk?old=True

With menu, you can easily integrate with iframe in lovelace:

Or maybe it offers other possibilities when scraping?

This is a nice find as well if you get stuck with scraping sites:

1 Like