Do not do this. Use [Anubis] to try to block the bots or use [Iocaine] and let the bots scrape as much garbage as they want, but dont sacrifice accessibility to fight scraping.
Sacrificing accessibility for not getting web-scraped
https://tilschuenemann.de/projects/sacrificing-accessibility-for-not-getting-web-scraped
[Anubis]: https://anubis.techaro.lol/
[Iocaine]: https://iocaine.madhouse-project.org/