생활
파이썬 크롤링에 관련해서 질문드립니다.
beautifulsoup를 사용해서 크롤링을 하고있는데, 게시글 제목을 가져오려고 chrome에서 copy selector사용해서 가져오려고 합니다.
copy selector 해보니
#div_content > div:nth-child(11) > div.list_title > a > span.subject_fixed 라고 나오길
html = req.text soup = BeautifulSoup(html, 'html.parser') posts = soup.select('span.subject_fixed')이런식으로 코드 짜봣는데 posts 배열이 빈 배열이라고 나오네요;;
어디가 문제인걸까요?
55글자 더 채워주세요.
1개의 답변이 있어요!
질문으로 봐서 정확히 판단은 안되지
출력시 빈배열이라고 나오는건가요?
req.text 에서 크롤링해오는 구조를 확인해 보거나 select 안에 구문을 a > span.subject_fixed 이렇게 해보시는 것도 도움이 될것 같습니다.