I'm trying to scrape the table "Competitors" for every Country in the last 2 Olympic games from Wikipedia (e.g. https://en.wikipedia.org/wiki/2022_Winter_Olympics) and make it into a dataframe. I can get to the point where I have the list of URLs for each country but then, when I start grabbing I face the issue where every page has the "Competitors" table in a different order (some time is the first, sometimes the second) plus I can find a unique title to identify the table (https://en.wikipedia.org/wiki/Spain_at_the_2022_Winter_Olympics). I was trying to apply this code Scraping a table from a section in Wikipedia but I can't figure it out. Any help would be appreciated.
Thanks!