So there you can calculate the space that can be taken up by transaction. It gets difficult because not all blocks have only transactions in the payload.
Then you have to multiply with the byte sizes inside each transaction:https://www.oreilly.com/library/view/mastering-bitcoin/9781491902639/ch05.html
Unfortunately this can also vary...
Thanks, I did also end up there myself :p
I even found some python parsers online that do the jobhttps://github.com/ragestack/blockchain-parser
The difficult part actually is to parse the input script.