修复爬虫bug
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -1 +0,0 @@
|
||||
id,likeNum,commentsLen,reposts_count,region,content,contentLen,created_at,type,detailUrl,authorAvatar,authorName,authorDetail,isVip
|
||||
|
+4
-4
@@ -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()
|
||||
Reference in New Issue
Block a user