Why do I get "www.hankyung.com" url in this script? Can I have any method to get a class = "info" not class ="info press"?
links[0]
<div class="info_group"> <a class="info press" href="http://www.hankyung.com/" onclick="return goOtherCR(this, 'a=nws*a.prof&r=1&i=88000107_000000000000000004520785&g=015.0004520785&u='+urlencode(this.href));" target="_blank"><span class="thumb_box"><img alt="" class="thumb" height="20" onerror="this.src='data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7';this.className='thumb bg_default_press'" src="https://search.pstatic.net/common/?src=https%3A%2F%2Fmimgnews.pstatic.net%2Fimage%2Fupload%2Foffice_logo%2F015%2F2018%2F08%2F01%2Flogo_015_18_20180801163901.png&type=f54_54&expire=24&refresh=true" width="20"/></span>한국경제</a><span class="info">1시간 전</span><a class="info" href="https://news.naver.com/main/read.nhn?mode=LSD&mid=sec&sid1=105&oid=015&aid=0004520785" onclick="return goOtherCR(this, 'a=nws*a.nav&r=1&i=88000107_000000000000000004520785&u='+urlencode(this.href));" target="_blank">네이버뉴스</a> </div>
news_url = links[0].find("a", {"class":"info"}).get("href")
news_url
>>>'http://www.hankyung.com/'
You can use :not to the exclude the unwanted class (bs4 4.7.1+)
news_url = links[0].select_one('a.info:not(.press)')['href']
news_url