The invention discloses compounds having virus resistance and a composition thereof. The composition comprises one or more of the 13 compounds comprising 6'-O-caffeoyl deacetyl asperulosidic acid methyl ester. The compounds having virus resistance and the composition thereof can be extracted from plants and can also be prepared by synthesis. The composition comprising the compounds having virus resistance can prevent and treat viral infection-caused diseases such as influenza, myocarditis, conjunctivitis, viral pneumonia, encephalitis, leukemia, hepatitis B, hepatitis C, AIDS, genitourinary system infection, EB virus infection, human papillomavirus infection and cytomegalovirus infection. The composition can be prepared into an oral preparation, an injection, a spray, a subcutaneous injection and an anus suppository.