Toggle navigation
Toggle navigation
This project
Loading...
Sign in
万朱浩
/
Venue-Ops
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
YYL469
2024-07-03 19:49:32 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
1edb52a52b794ff51ec309b66e19ea1915ed4f8d
1edb52a5
1 parent
4fae040c
修复爬虫bug
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
4 additions
and
5 deletions
spider/__pycache__/spiderComments.cpython-38.pyc
spider/__pycache__/spiderContent.cpython-38.pyc
spider/article.csv
spider/saveData.py
spider/__pycache__/spiderComments.cpython-38.pyc
View file @
1edb52a
No preview for this file type
spider/__pycache__/spiderContent.cpython-38.pyc
View file @
1edb52a
No preview for this file type
spider/article.csv
deleted
100644 → 0
View file @
4fae040
id,likeNum,commentsLen,reposts_count,region,content,contentLen,created_at,type,detailUrl,authorAvatar,authorName,authorDetail,isVip
spider/saveData.py
View file @
1edb52a
...
...
@@ -20,13 +20,13 @@ def save_to_sql():
concatArticlePd
.
to_sql
(
'article'
,
con
=
engine
,
if_exists
=
'replace'
,
index
=
False
)
concatCommentsPd
.
to_sql
(
'comments'
,
con
=
engine
,
if_exists
=
'replace'
,
index
=
False
)
except
:
articleNewPd
=
pd
.
read_csv
(
'articleData.csv'
)
commentNewPd
=
pd
.
read_csv
(
'articleComments.csv'
)
articleNewPd
=
pd
.
read_csv
(
'article.csv'
)
commentNewPd
=
pd
.
read_csv
(
'comments.csv'
)
articleNewPd
.
to_sql
(
'article'
,
con
=
engine
,
if_exists
=
'replace'
,
index
=
False
)
commentNewPd
.
to_sql
(
'comments'
,
con
=
engine
,
if_exists
=
'replace'
,
index
=
False
)
os
.
remove
(
'./articleData.csv'
)
os
.
remove
(
'./articleComments.csv'
)
os
.
remove
(
'./article.csv'
)
os
.
remove
(
'./comments.csv'
)
if
__name__
==
'__main__'
:
save_to_sql
()
\ No newline at end of file
...
...
Please
register
or
login
to post a comment