Skip to content
Advertisement

Multiple errors when scraping premier league tables

I am learning web-scraping.

I succeeded scraping top youtubers ranking with this as reference.

I am using the same logic to scrape the PL ranking, but having two issues:

  1. it is only collecting up to 5th place.
  2. it is getting only the first place for the result
  3. and then, getting attribute error:

error

JavaScript

Advertisement

Answer

The issue is that html.parser doesn’t parse the page correctly (try using lxml parser). Also, there get every second <tr> to get correct results:

JavaScript

Prints:

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement