The API method is the way to go anyway, and I wouldn't do that by using the following way, but let's say there was no API.
Every thread page includes structural data in JSON format. And interactionStatistic.userInteractionCount
is the total reply count. The HTML page could be read by a script (PHP for example), then <script type="application/ld+json">(.*)</script>
is extracted by using simple regex, and it is the JSON string contains the data you need.