It's usually just compression messing with the quality. The actual file on your drive is still fine, lol. Those sites just crush it down for faster loading.
But what if you download the file after it's been compressed? Sometimes the downloaded version is still the compressed one, not your original. That would mean the quality loss is permanent for sharing.