작성
·
406
0
import requests
from bs4 import BeautifulSoup
site_list = ['https://search.shopping.naver.com/best100v2/detail.nhn?catId=50000000, https://search.shopping.naver.com/best100v2/detail.nhn?catId=50000002']
for site in site_list:
res = requests.get(site)
soup = BeautifulSoup(res.content, 'html.parser')
data = soup.select('#productListArea > ul > li> p > a')
print(site)
for item in data:
print(item.get_text())
[바로 실전 크롤링해보기: 네이버 쇼핑 사이트 크롤링하기]
에서 진행하신 크롤링인데 선생님과 완전히 동일하게 코드를 작성했는데 다른 결과가 나오네요. 저의 경우 사이트 링크 1개만 출력됩니다. 왜 그런지 알 수 있을까요?
늘 좋은 강의 잘 듣고 있습니다.
감사합니다!