LinkedIn tried blocking scraping that way but as long as the scraping isn't burdensome it's basically legal but you can still be bound by TOS and civil claims
https://natlawreview.com/article/hiq-and-linkedin-reach-proposed-settlement-landmark-scraping-case
https://www.theguardian.com/sport/article/2024/jul/24/russian-chef-arrested-in-paris-over-alleged-large-scale-olympic-games-plot-paris-2024