
* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.
* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.
몽고디비에서 Movies 폴더, 결과값이 나오지 않습니다.(강의 2분 13초)
VS에서 hello.py에는 다음과 같이 적었고
from pymongo import MongoClient
import certifi
ca = certifi.where()
client = MongoClient('mongodb+srv://sparta:test@cluster1.g5zvb7v.mongodb.net/?retryWrites=true&w=majority', tlsCAFile=ca)
db = client.dbsparta
import requests
from bs4 import BeautifulSoup
URL = "https://movie.daum.net/ranking/reservation"
headers = {'User-Agent' : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36'}
data = requests.get(URL,headers=headers)
soup = BeautifulSoup(data.text, 'html.parser')
trs = soup.select('#old_content > table >tbody > tr')
for tr in trs:
a = tr.select_one('td.title > div > a')
if a is not None:
title = a.text
rank = tr.select_one('td:nth-child(1) > img')['alt']
star = tr.select_one('td.point').text
doc = {
'title':title,
'rank':rank,
'star':star
}
db.movies.insert_one(doc)
터미널 실행 시, 오류메세지는 없었습니다.
다만, 몽고디비에서 refresh를 하면 캡쳐화면과 같이 나옵니다.
어떻게 해야 movies 폴더가 나올까요.
참고로 저는 네트워크에 따라 VS에 certifi를 추가한 상태입니다
(참고 문의사항/답변 URL https://spartacodingclub.kr/community/fastqna/all/645315fcac4c4c6681bac013/mongoDB%20%EC%97%B0%EA%B2%B0%ED%95%98%EA%B8%B0 )

