juan %!s(int64=6) %!d(string=hai) anos
pai
achega
d1a3054766
Modificáronse 1 ficheiros con 15 adicións e 2 borrados
  1. 15 2
      hgg070_spider/spiders/lanqiu.py

+ 15 - 2
hgg070_spider/spiders/lanqiu.py

@@ -60,10 +60,23 @@ class LanqiuSpider(scrapy.Spider):
                 elif data["showtype"]=="FU":
                     data['lid'], data['sorttype'], data['date'] = lid, 'league', 'all'
                 print('77777777777777777777777777777777777777777777L',data)
-                yield scrapy.FormRequest(url=url,formdata=data,callback=self.detailball,meta=response.meta["data"],dont_filter=True)
+                yield scrapy.FormRequest(url=url,formdata=data,callback=self.detailball,meta={"data":response.meta["data"]},dont_filter=True)
 
     def detailball(self,response):
-        print('******************************************************88',response.text)
+        data=response.meta["data"]
+        url=""
+        #获取联赛id gid
+        game=response.xpath("//game")
+        for g in game:
+            gid=g.xpath("./gid/text()").extract_first()
+            data["gid"]=gid
+            print('wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww',data)
+            yield scrapy.FormRequest(url=url,formdata=data,callback=self.getItem,dont_filter=True)
+
+
+    def getItem(self,response):
+        print('ffffffffffffffffffffffffffffffffffffffffffffffffffffff',response.text)
+