박은주

Make func

......@@ -34,8 +34,8 @@ def TextPreprocess(text):
def GetData():
login_info = {
'userID' : 'qdw0313',
'userpw' : 'fejUfrQxHWwtcGcP0'
'userID' : '**********',
'userpw' : '**********'
}
options = webdriver.ChromeOptions()
......@@ -101,23 +101,15 @@ def GetData():
sleeptime()
if not (post_df['title'] == title).any():
# Click('//*[@id="container"]/div[2]/article[{}]'.format(idx))
content = TextPreprocess(content)
post_df = post_df.append(pd.DataFrame([[title, content]],
columns=['title', 'content']))
# print("{0}. {1} : {2}".format(idx, title, content))
if post[1].text <= yesterday:
break
break
post_df.to_csv('data.csv', mode='w', encoding='utf-8-sig', index=False)
print("CVS file saved")
# print(post_df)
# exit()
# post_df.reset_index(drop=True, inplace=True)
# post_df.to_json('data.json')
# # with open('data.json', 'w', encoding='utf-8-sig') as file:
# # post_df.to_json(file, force_ascii=False)
with open('data.json', 'w+', encoding='utf-8-sig') as json_file:
for post in zip(post_df['title'].tolist(), post_df['content'].tolist()):
......@@ -131,7 +123,4 @@ def GetData():
}, json_file, ensure_ascii=False)
print("JSON file saved")
GetData()
######## TODO: JSON으로 저장
######## 형식 : { "document" : { "type" : "PLAIN_TEXT", "content" : "~~" }, "encodingType" : "UTF8" }
######## GOOGLE Sentiment Analyzer 사용을 위해
\ No newline at end of file
GetData()
\ No newline at end of file
......