def parse(self, response): """ hatype="dota2" vkey="longzhu" root_path='//div[@class="list-con"]/a' title_path='./h3[@class="listcard-caption"]/text()' href_path='.//@href' img_path='.//img/@src' author_path='.//strong/text()' audian_path='.//span[@class="livecard-meta-item-text"]/text()' url_prefix="" SpiderPathUrl.process(response,root_path,title_path,href_path,img_path,author_path,audian_path,url_prefix,hatype,vkey) """ responseStr = response.body_as_unicode() tripResponse = responseStr.replace("_callbacks_._36bxu1(", '') index = tripResponse.rfind(")") print("zuihou ) weizhi : " + str(index) + "\n") tripResponse = tripResponse[0:index] #print(tripResponse +"\n") #print("tripResponse:"+tripResponse) resultJson = json.loads(tripResponse) title_j = "channel.name" href_j = "channel.url" img_j = "preview" author_j = "channel.status" audian_j = "viewers" vkey = "channel.domain" url_prefix = "" vType_j = "game.0.name" SpiderPathUrl.processJSON(resultJson["data"]["items"], title_j, href_j, img_j, author_j, audian_j, url_prefix, vType_j, vkey, "longzhu", "")
def parse(self, response): #hatype="dota2" #vkey="panda" #root_path='//ul[@class="video-list clearfix"]/li' #root_path='//div[@class="list-container"]/ul/li' """title_path='.//div[@class="video-title"]/text()' href_path='.//a/@href' img_path='.//img/@data-original' author_path='.//span[@class="video-nickname"]/text()' audian_path='.//span[@class="video-number"]/text()' url_prefix="http://www.panda.tv" SpiderPathUrl.process(response,root_path,title_path,href_path,img_path,author_path,audian_path,url_prefix,hatype,vkey)""" resultJson = json.loads(response.body_as_unicode()) title_j = "name" href_j = "id" img_j = "pictures.img" author_j = "userinfo.nickName" audian_j = "person_num" vkey = "id" url_prefix = "http://www.panda.tv/" vType_j = "classification.cname" SpiderPathUrl.processJSON(resultJson["data"]["items"], title_j, href_j, img_j, author_j, audian_j, url_prefix, vType_j, vkey, "panda", "")
def parse(self, response): """hatype="dota2" vkey="zhanqi" root_path='//div[@class="live-list-tabc active"]/ul/li' #root_path='//div[@class="live-list-tabc tabc js-room-list-tabc"]/ul/li' title_path='.//span[@class="name"]/text()' href_path='.//a/@href' img_path='.//img/@src' author_path='.//span[@class="anchor anchor-to-cut dv"]/text()' audian_path='.//span[@class="dv"]/text()' url_prefix="http://www.zhanqi.tv" SpiderPathUrl.process(response,root_path,title_path,href_path,img_path,author_path,audian_path,url_prefix,hatype,vkey)""" resultJson = json.loads(response.body_as_unicode()) root_j = "rooms" title_j = "title" href_j = "url" img_j = "bpic" author_j = "nickname" audian_j = "online" vkey = "id" url_prefix = "http://www.zhanqi.tv" vType_j = "gameName" SpiderPathUrl.processJSON(resultJson["data"]["rooms"], title_j, href_j, img_j, author_j, audian_j, url_prefix, vType_j, vkey, "zhanqi", "")
def parse(self, response): resultJson= json.loads(response.body_as_unicode()) title_j="title" href_j="slug" img_j="thumb" author_j="nick" audian_j="view" vkey="slug"#uid vType_j="category_name" url_prefix="http://www.quanmin.tv/v/" SpiderPathUrl.processJSON(resultJson["data"],title_j,href_j,img_j,author_j,audian_j,url_prefix,vType_j,vkey,"quanming","")