|
|
@@ -1,7 +1,8 @@
|
|
|
# -*- coding: utf-8 -*-
|
|
|
import scrapy
|
|
|
import re
|
|
|
-
|
|
|
+import copy
|
|
|
+from ..items import LanqiuItem
|
|
|
class LanqiuSpider(scrapy.Spider):
|
|
|
name = 'lanqiu'
|
|
|
allowed_domains = ['m.hgg070.com/']
|
|
|
@@ -32,7 +33,7 @@ class LanqiuSpider(scrapy.Spider):
|
|
|
for item in h_types:
|
|
|
showtype = item
|
|
|
data={
|
|
|
- 'uid': '7554a670e92d06105fe567b75e5b80fe65e6e40167f4979c8d74ca5eaa461d4d',
|
|
|
+ 'uid': '9b9f0dea34ee4e5225990433370a88fea2b37b79c98e266b338152c619a71d2b',
|
|
|
'langx': 'zh-cn',
|
|
|
'ltype': '3',
|
|
|
'gtype': 'BK',
|
|
|
@@ -47,6 +48,7 @@ class LanqiuSpider(scrapy.Spider):
|
|
|
def parse(self, response):
|
|
|
#获取id并判断抓取的球型
|
|
|
data=response.meta["data"]
|
|
|
+ fromdata=copy.deepcopy(data)
|
|
|
league=response.xpath('//league')
|
|
|
url="http://m.hgg070.com/app/member/get_game_list.php"
|
|
|
for le in league:
|
|
|
@@ -59,12 +61,11 @@ 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={"data":response.meta["data"]},dont_filter=True)
|
|
|
+ yield scrapy.FormRequest(url=url,formdata=data,callback=self.detailball,meta={"data":fromdata},dont_filter=True)
|
|
|
|
|
|
def detailball(self,response):
|
|
|
data=response.meta["data"]
|
|
|
- url=""
|
|
|
+ url="http://m.hgg070.com/app/member/get_game_more.php"
|
|
|
#获取联赛id gid
|
|
|
game=response.xpath("//game")
|
|
|
for g in game:
|
|
|
@@ -75,7 +76,18 @@ class LanqiuSpider(scrapy.Spider):
|
|
|
|
|
|
|
|
|
def getItem(self,response):
|
|
|
- print('ffffffffffffffffffffffffffffffffffffffffffffffffffffff',response.text)
|
|
|
+ data=response.xpath("//game")
|
|
|
+ for item in data:
|
|
|
+ obj=LanqiuItem()
|
|
|
+ obj['id']=item.xpath("./gid")
|
|
|
+ obj['league'] = item.xpath("./league")
|
|
|
+ obj['team_h'] = item.xpath("./team_h")
|
|
|
+ obj['team_c'] = item.xpath("./team_c")
|
|
|
+ # obj['ratio'] = item.xpath("./ratio")
|
|
|
+ # obj['ior_RH'] = item.xpath("./ior_RH")
|
|
|
+ # obj['ior_RC'] = item.xpath("./ior_RC")
|
|
|
+ yield obj
|
|
|
+
|
|
|
|
|
|
|
|
|
|