Easily the hardest scraper I've ever built. The dynamic nature of the target website makes the scraping tricky. On top of that, the HTML pages are not 100% standardized (althought that's to be expected). The website didn't show any sorts of countermeasures, at least.
The scraper heavily relies on recursion in order to navigate through the dynamic menus and pages. It's inneficient in fact, but it was the obvious solution that first came to my mind. No multi-threading/async was used, tho it would be a great improvement.
IMPORTANT:
- The scraper was built and tested with Python 3.9.6.
- Edge browser was chosen. Edge v119.0.2151.44 was used together with msgedgedriver.exe v119.0.2151.44. The driver can (gladly) be found at /components/msgedgedriver.exe.
- The scraper will only work properly when connected to Portugal's website. A VPN is advised.