Toggle navigation
Toggle navigation
This project
Loading...
Sign in
박은주
/
Todays_Issue
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
박은주
2021-06-08 10:32:16 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
c5d6ab41356b9d94d7a9ee975c558353ecb9479e
c5d6ab41
1 parent
f0a13f1e
Make func
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
14 deletions
content.py
content.py
View file @
c5d6ab4
...
...
@@ -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
...
...
Please
register
or
login
to post a comment