MNT: fix compatibility with beautifulsoup4 4.13.0b2
Closes #58086

- [x] closes #xxxx (Replace xxxx with the GitHub issue number)
- [ ] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
- [ ] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [ ] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.
- [ ] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.

I'm not sure this change warrants a changelog entry, but I'll happily add one upon request. Thanks @neutrinoceros (doesn't need a changelog entry) Thanks for merging ! Would it be alright to backport this ? Sure I supposed that would be OK @Meeseeksdev backport 2.2.x thanks !