안경잡이개발자

728x90
반응형

  소스코드는 다음과 같습니다.


import urllib.request
from bs4 import BeautifulSoup


def main():
    url = "https://news.nate.com/recent?mid=n0100"
    sourcecode = urllib.request.urlopen(url).read()
    soup = BeautifulSoup(sourcecode, "html.parser")

    divs = soup.find_all("div", class_="mduSubjectList")
    for div in divs :
        link = div.find("a")["href"]
        print("http:" + link)


if __name__ == "__main__":
    main()



728x90
반응형

Comment +0