Hey faatal,
I think you could get this from your database. Could you send me (or link) a file with all quest ID's, their faction and title. If you do that, I will work on the input file for the code like you suggested. You may see the same ID in multiple places, for example:
9999 Priest get something
[undead]
9999
[priest]
9999
That would mean that the quest is for undead priests only. So you can filter on race first then on class/profession.
If you send me the database dump, I will work on this.