Python library to search for trains on renfe.es
pip3 install renfepy
If chromium is not installed Renfepy will install a it. In case of error it is recommended to install it.
from renfepy.renfe import RenfePy
renfepy = RenfePy(gui=False)
going_trains = renfepy.search("Madrid", "Barcelona", "04/02/2023")
going_trains.table()