There really needs to be a close proximity to the source; this means that online content isn’t really going to spread it. You need to be physically located in the environment near the people with depression and anxiety.
Also, you have to be easily socially suggestible and open to the input of others, on the level of mirroring and the chameleon effect.
Example: I worked for a boss with depression and anxiety. It never rubbed off on me, but his wife was highly suggestible and she seemed to mirror his foibles and idiosyncrasies.
I don’t know if I would go as far as the conclusions of the Rat Park experiment, but there is something to be said for a healthy, safe, and nurturing environment.