Did you look into either of these projects?
They output mbox data, which Discourse already has a script for:
https://github.com/discourse/discourse/blob/master/script/import_scripts/mbox.rb
So as long as you could get either of those projects to output clean mbox data that the importer script can work with, we’re golden
p.s. @pacharanero also took the scraper approach and successfully migrated several sites with it.