a guest Apr 5th, 2020 284 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- import sys
- from bs4 import BeautifulSoup
- import requests
- import urllib.request
- base_url = 'https://news.naver.com/main/main.nhn?mode=LSD&mid=shm&sid1='
- category = 
- for i in category:
- URL = base_url + str(i)
- response = urllib.request.urlopen(URL)
- soup = BeautifulSoup(response, "html.parser")
- #results = soup.select("#section_body .photo a")
- results = soup.select("#section_body > ul.type06_headline > li:nth-child(1) > dl > dt:nth-child(2) > a")
RAW Paste Data