나홀로 데이터 분석가의 1인 연구실

[올리브영] 내 피부에 맞는 화장품 직접 찾아보자 - 2 본문

Personal Project/Long-Term Project

[올리브영] 내 피부에 맞는 화장품 직접 찾아보자 - 2

나홀로 데이터 분석가 2022. 12. 27. 16:42

0-1. 수집 데이터 정의

  • 수집 대상 URL: 올리브영 스토어(www.oliveyoung.co.kr)
  • 수집 대상: 스킨케어 제품에 대한 기본 정보

<그림1> 올리브영 스토어(www.oliveyoung.co.kr)

 

수집 대상을 스킨케어 제품으로 한정한 이유는 2가지이다.

  1. 스킨케어 제품은 대부분 무색무취이기에 색조나 피부톤에 대한 고려를 일부 배제할 수 있음.
  2. 매일 밤낮으로 사용하기에, 다른 뷰티제품 대비 사용빈도가 높음.

1-1. 데이터 수집 계획

  • 수집 시기: 2022.12.24
  • 수집 대상: 제품명, 브랜드, 제품 링크
  • 사용 소프트웨어: Python3(Requests)

1-2. 데이터 수집

  • Python 3.8.5
  • Requests 2.24.0
  • bs4 4.9.3
  • pandas 1.1.3

 

# One Page Crawler Source

def crawling_products(source):

# 브랜드명 수집
    brands = source.find_all('span', class_='tx_brand')

    for brand in brands:
        brand_lst.append(brand.text)

# 제품명 수집
    prds = source.find_all('p', class_='tx_name')

    for prd in prds:
        prd_lst.append(prd.text)

# 제품 링크 수집
    links = source.find_all('div', class_='prd_info')

    for link in links:
        link_lst.append(link.find('a')['href'])

# Whole Page Crawler Source

brand_lst = []
prd_lst = []
link_lst = []

for page_nums in tqdm(range(1, 33+1)):

    url = f'https://www.oliveyoung.co.kr/store/display/getMCategoryList.do?dispCatNo=100000100010008&fltDispCatNo=&prdSort=01&pageIdx={page_nums}&rowsPerPage=24&searchTypeSort=btn_thumb&plusButtonFlag=N&isLoginCnt=0&aShowCnt=0&bShowCnt=0&cShowCnt=0&trackingCd=Cat100000100010008_Small'
    source = requests.get(url).text
    source = bs4.BeautifulSoup(source)

    crawling_products(source)

prd_infos = pd.DataFrame({'brand' : brand_lst, 'item' : prd_lst, 'link' : link_lst})

1-3. 데이터 수집 결과

  • 데이터 형태: 773 x 3

<그림2> Samples of Item_Dataset

 

Comments