That’s no fun!! As amazing as carpets are in a space, keeping them clean can be tricky! I don’t have an extensive knowledge of carpet cleaning tricks, but there’s one out there about mixing a little white vinegar with a little OxiClean and some Febreeze! You can just spray the combo on the carpet, then vacuum! It’s not a cure-all, but it’s definitely cost-friendly, and doesn’t take much more time than it would to vacuum!!
Hope this helps! Let me know if you find out any other tricks!