
4-11 수업에서 메타 태그를 크롤링 할때
og_image = soup.select_one('meta[property="og:image"]')['content']
수업대로 이렇게 하면 크롤링이 되는데
3주차 수업에서 배웠던 방법대로
og_image = soup.select_one('head > meta:nth-child(9)')['content']
이렇게 하면
TypeError: 'NoneType' object is not subscriptable
이런 에러 메세지가 뜹니다
어떻게 하면 3주 차에 했던 방법으로도 크롤링을 할 수 있을 까요?
