추가 '네이버 크롤링'
This commit is contained in:
parent
6ccc22f2cb
commit
ad611a2f19
|
|
@ -0,0 +1,24 @@
|
||||||
|
import requests
|
||||||
|
from bs4 import BeautifulSoup
|
||||||
|
|
||||||
|
response = requests.get('https://www.naver.com/')
|
||||||
|
html = response.text
|
||||||
|
soup = BeautifulSoup(html, 'html.parser')
|
||||||
|
check=[]
|
||||||
|
ranking=1
|
||||||
|
|
||||||
|
for tag in soup.select('li[class=ah_item] a'):
|
||||||
|
|
||||||
|
url = tag.get('href')
|
||||||
|
|
||||||
|
if tag.get('data-ssl'):
|
||||||
|
print('\n' + "* " * 20 + '\n')
|
||||||
|
print(url)
|
||||||
|
|
||||||
|
related = requests.get(url)
|
||||||
|
htmlr = related.text
|
||||||
|
soupr = BeautifulSoup(htmlr, 'html.parser')
|
||||||
|
|
||||||
|
for tagr in soupr.select('ul[class=_related_keyword_ul] a'):
|
||||||
|
result = tagr.text
|
||||||
|
print(result)
|
||||||
Loading…
Reference in New Issue