-
카테고리
-
세부 분야
데이터 분석
-
해결 여부
미해결
2-8-1 질문드립니다..
21.03.24 12:52 작성 조회수 99
0
네이버 태그가 바껴서 해본다고 해봤는데 print해봤는데 아무것도 나오질 않아요..
from bs4 import BeautifulSoup
import urllib.request as req
import urllib.parse as rep
import sys
import io
import os
sys.stdout = io.TextIOWrapper(sys.stdout.detach(), encoding='utf-8')
sys.stderr = io.TextIOWrapper(sys.stderr.detach(), encoding='utf-8')
base = "https://search.naver.com/search.naver?where=image&sm=tab_jum&query="
quote = rep.quote_plus("사자")
url = base + quote
res = req.urlopen(url)
savePath = "c:\\imagedown\\" # C:\imagedown\ 윈도우는 \대신 / 써도 상관x
try:
if not (os.path.isdir(savePath)):
os.makedirs(os.path.join(savePath))
except OSError as e:
if e.errno != errno.EEXIST:
print("폴더 만들기 실패")
raise
soup = BeautifulSoup(res, "html.parser")
img_list = soup.select("div.photo_bx api_ani_send._photoBox > div.thumb > a.link_thumb._imageBox._infoBox > img")
print("test", img_list)
답변을 작성해보세요.
0
좋은사람
지식공유자2021.03.25
안녕하세요.
지금 현재 이미지를 따로 불러오는 방식으로 rendering이 변경되었습니다.
뒤에 배울 selenium으로 처리하실 수가 있으세요.
조만간 selenium 버전으로 변경해서 소스코드 올려드리겠습니다.
답변 1