Whoever runs the MLS website is definitely keeping me on my toes. They made a couple new changes to the scores page that broke SoccerPhone again.
First, they dropped the date information from each score. Admittedly, I probably should have had exception handling code for this scenario, but it just seems strange that they would suddenly drop the date info, especially when most weeks as of late have had games on more than one day during the week. I’ll need to go back and clean up the code I put in to handle this scenario, but it works for now. It’s definitely good enough for code written at 1:30 am on a Saturday night.
Second, they changed the alt tags for the team images. The alt tags were not only an easy way for me to grab the team names, but also the proper way to code a website. Alt tags are there for a reason. Text-only browsers and web browsers for the blind depend on images having alt tags. I had to change my code to grab the team names from the relative file paths to the image files. Fortunately, they used the same abbreviations (e.g., SJ for San Jose) as for the scoring details, so I could reuse a Python function I had already written to convert team abbreviations to team names.