What site do you want to use the script on? Different sites will use different methods to load content. I'm not sure it would be possible for a single script to work on every site.
hmm... yeah. I am halfway successful in using this: https://addons.mozilla.org/en-US/firefox/addon/re-pagination-webext-fork/ I just wish there is a way to macro the uBlock origin's cosmetic filtering to search based on whether the heading contains the right keyword or not.