김건

3차 개발사항 일부 기능 함수 추가

......@@ -120,16 +120,6 @@ def download_comments(youtube_id, sleep=1):
yield comment
time.sleep(sleep)
def goto_Menu(result_List) :
for i in range (len(result_List)) :
a = str(result_List[i]['text'])
if('상무' in a) :
print((result_List)[i]['text'])
else :
print('Not Found')
## input video 값 parsing
def video_id(value):
query = urlparse(value)
......@@ -174,7 +164,6 @@ def main():
raise ValueError('올바른 입력 값을 입력하세요')
print('Downloading Youtube comments for video:', youtube_id)
count = 0
Number = input(' 저장 - 0 저장 안함- 1 : ')
if Number == '0' :
Output1 = input('결과를 받을 파일 입력 :')
......@@ -198,14 +187,22 @@ def main():
break
else :
count = 0
i = 0
limit = 40
for comment in download_comments(youtube_id):
result_List.append(comment)
dic = {}
dic['cid'] = comment['cid']
dic['text'] = comment['text']
dic['time'] = comment['time']
dic['author'] = comment['author']
result_List.append(dic)
count += 1
i += 1
if limit and count >= limit:
if limit == count :
print(' Comment Thread 생성 완료')
print ('\n\n\n\n\n\n\n')
break
print('\nDone!')
return result_List
#goto_Menu(result_List)
......
import downloader
from time import sleep
def print_result(Comment_List) :
for var in Comment_List :
print(var)
print('******* 검색 완료 *******')
print('\n\n\n')
def search_by_author(Comment_List,author_name) :
result_List = []
for var in Comment_List :
if (var['author'] == author_name) :
result_List.append(var)
return result_List
def search_by_keyword(Comment_List,keyword) :
result_List = []
for var in Comment_List :
print(var['text'])
if ( keyword in var['text']) :
result_List.append(var)
return result_List
def call_main ():
print(' Comment Thread 생성중 \n')
......@@ -13,6 +35,10 @@ def call_main ():
print(' **************************************************************')
print(' **************************************************************')
a = downloader.main()
author_results = search_by_author(a,'광고제거기')
text_resutls = search_by_keyword(a,'지현')
print_result(author_results)
print_result(text_resutls)
return a
CommentList = call_main()
......
Youtube Comment Threads를 받아오는 코드 2차 수정 사항
Youtube 3차 수정 사항
-----------------------------------------------------
1차에서 추가적으로 구현 할 사항
......@@ -20,4 +20,17 @@ Youtube Comment Threads를 받아오는 코드 2차 수정 사항
1. Module 분리 (List 반환 모듈, Main 부분) -> 굳이 분리하지 않을 경우
추가적으로 함수를 구현해야함
2. 본격적으로 Data Set을 어떤 식으로 분리하여 제공 할지에 대한 추가적인 기능 구현 필요
\ No newline at end of file
2. 본격적으로 Data Set을 어떤 식으로 분리하여 제공 할지에 대한 추가적인 기능 구현 필요
-----------------------------------------------------
1. 2차 개발사항에서 오류가 있던 부분을 수정하였음
2. 가져온 Comment를 가공하여 처리할 수 있도록 일부 함수 구현
(1) 키워드를 통해 검색할 수 있도록 함수 구현
(2) 작성자 이름을 통해 검색할 수 있도록 함수 구현
-----------------------------------------------------
추가 구현 사항
1. konlpy (http://konlpy.org/ko/latest/)를 통하여 명사 추출 후 keyword 분석하기
2. 시간대를 추출하여 시간대 별로 Comment 정리하기
......