parent
348e30dbd7
commit
dcae430498
|
@ -8,7 +8,7 @@
|
|||
from itemadapter import ItemAdapter
|
||||
import pymysql
|
||||
|
||||
|
||||
# 本地存储管道
|
||||
class DagongwangproPipeline:
|
||||
|
||||
def process_item(self, item, spider):
|
||||
|
@ -24,7 +24,7 @@ class DagongwangproPipeline:
|
|||
|
||||
return item
|
||||
|
||||
|
||||
# 数据库存储管道
|
||||
class mysqlPileLine(object):
|
||||
conn = None
|
||||
cursor = None
|
||||
|
@ -34,7 +34,7 @@ class mysqlPileLine(object):
|
|||
self.cursor = self.conn.cursor()
|
||||
|
||||
try:
|
||||
self.cursor.execute('insert into junshi_news values("%s", "%s", "%s", "%s", "%s")'%(item['title'], item['date'], item['author'], item['content'], item['src']))
|
||||
self.cursor.execute('insert into js_news values("%s", "%s", "%s", "%s", "%s")'%(item['title'], item['date'], item['author'], item['content'], item['src']))
|
||||
self.conn.commit()
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
|
Loading…
Reference in New Issue