def summary(self): return_summary_list = [] genre = None runningTime = None openingDate = None nation = None director = None grade = None accumulate_audience = None summary_text = driver.find_element_by_xpath("//dl[@class='info_spec']") #필요없는 데이터 제거(속도 저하 방지) 및 summary_text 전처리 if summary_text.text.find("더보기") != -1: summary_text_modify = summary_text.text.replace("\n더보기", "") else: summary_list = summary_text.text.split('\n') if summary_text.text.find("누적관객누적관객 도움말") != -1: summary_text_modify_2 = summary_text_modify.replace( "\n누적관객누적관객 도움말", "") summary_list = summary_text_modify_2.split('\n') else: summary_list = summary_text.text.split('\n') ###개요 정보 ##전처리 outline = summary_list[0] outline_modify = outline.replace(", ", ",") outline_modify_2 = outline_modify.replace(" .", ".") outline_modify_3 = outline_modify_2.replace(" 개봉", "개봉") outline_modify_4 = outline_modify_3.replace(" ,", ",") outline_list = outline_modify_4.split(' ') ##장르 / 국적 / 러닝타임 / 개봉날짜 구분 for index in range(0, len(outline_list)): #장르 구분 if outline_list[index].find("공포") != -1: genre = outline_list[index] #print("장르 : " + genre) #러닝타임 구분 elif outline_list[index].find("분") != -1: runningTime = outline_list[index] #print("러닝타임 : " + runningTime.replace("분", "")) #개봉날짜 구분 elif outline_list[index].find("개봉") != -1: openingDate = outline_list[index] #print("개봉날짜 : " + openingDate.replace("개봉", "")) else: nation = outline_list[index] #print("국적 : " + nation) #감독 구분 director = summary_list[1] #print("감독 : " + director) #개요, 감독 정보 삭제(속도 저하 방지) del summary_list[0:1] ##등급 / 누적관객 수 구분 for index in range(0, len(summary_list)): if summary_list[index].find( "[국내]") != -1 or summary_list[index].find("[해외]") != -1: grade = summary_list[index] #print("등급 : " + grade) elif summary_list[index].find("명") != -1: accumulate_audience = summary_list[index] #print("누적관객 수 : " + accumulate_audience) return_summary_list.append(genre) return_summary_list.append(runningTime) return_summary_list.append(openingDate) return_summary_list.append(nation) return_summary_list.append(director) return_summary_list.append(grade) return_summary_list.append(accumulate_audience) return return_summary_list
def adultLogin(): _id = driver.find_element_by_id("id") _id.send_keys("####") #개인정보 문제로 블락 _pwd = driver.find_element_by_id("pw") _pwd.send_keys("####") #개인정보 문제로 블락 driver.find_element_by_xpath("//input[@type='submit']").click()
def agency(self): return_agency_list = [] producer = None importer = None distributor = None try: agency_name = driver.find_element_by_xpath( "//dl[@class='agency_name']") agency_text = agency_name.text #제작사 / 수입사 / 배급사 정보 존재 유무 확인 (없으면 None) try: producer_text = driver.find_elements_by_class_name( "agency_sub0") if producer_text == []: producer_text = None except NoSuchElementException: #print("제작사 없음") producer_text = None try: importer_text = driver.find_element_by_class_name( "agency_sub1") if importer_text == []: importer_text = None except NoSuchElementException: #print("수입사 없음") importer_text = None try: distributor_text = driver.find_element_by_class_name( "agency_sub2") if distributor_text == []: distributor_text = None except NoSuchElementException: #print("배급사 없음") distributor_text = None #제작사 / 수입사 / 배급사 데이터 저장 if producer_text is not None and importer_text is None and distributor_text is not None: producer = agency_text.split('\n')[0] distributor = agency_text.split('\n')[1] #print("제작사 : " + producer) #print("배급사: " + distributor) elif producer_text is not None and importer_text is not None and distributor_text is None: producer = agency_text.split('\n')[0] importer = agency_text.split('\n')[1] #print("제작사 : " + producer) #print("수입사 : " + importer) elif producer_text is None and importer_text is not None and distributor_text is not None: importer = agency_text.split('\n')[0] distributor = agency_text.split('\n')[1] #print("수입사 : " + importer) #print("배급사 : " + distributor) elif producer_text is not None and importer_text is not None and distributor_text is not None: producer = agency_text.split('\n')[0] importer = agency_text.split('\n')[1] distributor = agency_text.split('\n')[2] #print("제작사 : " + producer) #print("수입사 : " + importer) #print("배급사 : " + distributor) elif producer_text is not None and importer_text is None and distributor_text is None: producer = agency_text #print("제작사 : " + producer) elif producer_text is None and importer_text is not None and distributor_text is None: importer = agency_text #print("수입사 : " + importer) elif producer_text is None and importer_text is None and distributor_text is not None: distributor = agency_text #print("배급사 : " + distributor) else: print("정보 없음") except NoSuchElementException: print('정보 없음') return_agency_list.append(producer) return_agency_list.append(importer) return_agency_list.append(distributor) return return_agency_list
def audienceScore(): driver.find_element_by_xpath( "//div[@class='title_area grade_tit']").click()
def audienceGenderAndAge(): driver.find_element_by_xpath("//a[@id='actual_group']").click()
def netizenGenderAndAge(): driver.find_element_by_xpath("//a[@id='netizen_group']").click()
def scoreTab(): driver.find_element_by_xpath("//a[@title='평점']").click()
def actorTab(): driver.find_element_by_xpath("//a[@title='배우/제작진']").click()
def mainInformationTab(): driver.find_element_by_xpath("//a[@title='주요정보']").click()
def autoCompletementList(movieName): driver.implicitly_wait(5) element = driver.find_element_by_xpath("//li[@data-title='" + movieName + "']") element.click()