13283339616 6 年之前
父節點
當前提交
b3588c05c2
共有 2 個文件被更改,包括 4 次插入4 次删除
  1. 1 1
      xiaowu/spiders/meunSpider.py
  2. 3 3
      xiaowu/spiders/meunSpiderEveryday.py

+ 1 - 1
xiaowu/spiders/meunSpider.py

@@ -66,7 +66,7 @@ class MeunspiderSpider(scrapy.Spider):
66 66
         timestamp = time.mktime(timeArray)
67 67
         materialsStr=''
68 68
         for key in materials:
69
-            materialsStr=materialsStr+","+key+materials[key]+";"
69
+            materialsStr=materialsStr+key+","+materials[key]+";"
70 70
         materials=materialsStr.rstrip(';')
71 71
         sql = "INSERT INTO menu(title,tags,intro,ingredients,url,burden,created_at,origin) VALUES ('%s','%s','%s','%s','%s' ,'%s' ,'%s' ,'%s' )"%(title,outerdescrib,describ,materials,figure,' ',timestamp,filename)
72 72
 

+ 3 - 3
xiaowu/spiders/meunSpiderEveryday.py

@@ -42,8 +42,8 @@ class MeunspiderSpider(scrapy.Spider):
42 42
         #if next_page_url is not None:
43 43
         #    yield scrapy.Request(response.urljoin(next_page_url),callback=self.parse)
44 44
     def doparse(self,response):
45
-        # db = MySQLdb.connect("127.0.0.1","root","Coupon@123","caipu",use_unicode=True,charset="utf8")
46
-        db = MySQLdb.connect("127.0.0.1","root","123456","menu",use_unicode=True,charset="utf8")
45
+        db = MySQLdb.connect("127.0.0.1","root","Coupon@123","caipu",use_unicode=True,charset="utf8")
46
+        # db = MySQLdb.connect("127.0.0.1","root","123456","menu",use_unicode=True,charset="utf8")
47 47
         cursor = db.cursor()
48 48
         title = response.meta['title']
49 49
         outerdescrib = response.meta['outerdescrib']
@@ -69,7 +69,7 @@ class MeunspiderSpider(scrapy.Spider):
69 69
         timestamp = time.mktime(timeArray)
70 70
         materialsStr=''
71 71
         for key in materials:
72
-            materialsStr=materialsStr+","+key+materials[key]+";"
72
+            materialsStr=materialsStr+key+","+materials[key]+";"
73 73
         materials=materialsStr.rstrip(';')
74 74
         sqlone = "SELECT * FROM menu WHERE title = '%s'" % (title)
75 75
         try: