# Path: crawler/gather/items.py
# class ChannelItem(Item):
#     office_id = Field()
#     short = Field()
#     name = Field()
#     image = Field()
#     url = Field()
# 
# class RoomItem(Item):
#     office_id = Field()
#     name = Field()
#     image = Field()
#     url = Field()
#     online = Field()
#     host = Field()
#     channel = Field()
#     followers = Field()
#     description = Field()
#     announcement = Field()
#     start_time = Field()


from scrapy import Spider, Request
from ..items import ChannelItem, RoomItem
import json
        'SITE': {
            'code': 'zhanqi',
            'name': '战旗',
            'description': '战旗直播_高清流畅的游戏直播平台',
            'url': 'https://www.zhanqi.tv',
            'image': 'https://static.zhanqi.tv/assets/web/static/i/index/skin/logo.png',
            'show_seq': 6
        }
    }

    def parse(self, response):
        room_query_list = []
        for cjson in json.loads(response.text)['data']['games']:
            yield ChannelItem({
                'office_id': cjson['id'],
                'short': cjson['gameKey'],
                'name': cjson['name'],
                'image': cjson['spic'],
                'url': response.urljoin(cjson['url'])
            })
            url = 'https://www.zhanqi.tv/api/static/game.lives/{}/110-{{}}.json'.format(cjson['id'])
            room_query_list.append({'url': url, 'channel': cjson['gameKey'], 'page': 1})
        for room_query in room_query_list:
            yield Request(room_query['url'].format(str(room_query['page'])), callback=self.parse_room_list,
                          meta=room_query)

    def parse_room_list(self, response):
        room_list = json.loads(response.text)['data']['rooms']
        if isinstance(room_list, list):
            for rjson in room_list:

# Path: crawler/gather/items.py
# class ChannelItem(Item):
#     office_id = Field()
#     short = Field()
#     name = Field()
#     image = Field()
#     url = Field()
# 
# class RoomItem(Item):
#     office_id = Field()
#     name = Field()
#     image = Field()
#     url = Field()
#     online = Field()
#     host = Field()
#     channel = Field()
#     followers = Field()
#     description = Field()
#     announcement = Field()
#     start_time = Field()


# Path: crawler/gather/spiders/zhanqi.py
from scrapy import Spider, Request
from ..items import ChannelItem, RoomItem
import json

        'SITE': {
            'code': 'zhanqi',
            'name': '战旗',
            'description': '战旗直播_高清流畅的游戏直播平台',
            'url': 'https://www.zhanqi.tv',
            'image': 'https://static.zhanqi.tv/assets/web/static/i/index/skin/logo.png',
            'show_seq': 6
        }
    }

    def parse(self, response):
        room_query_list = []
        for cjson in json.loads(response.text)['data']['games']:
            yield ChannelItem({
                'office_id': cjson['id'],
                'short': cjson['gameKey'],
                'name': cjson['name'],
                'image': cjson['spic'],
                'url': response.urljoin(cjson['url'])
            })
            url = 'https://www.zhanqi.tv/api/static/game.lives/{}/110-{{}}.json'.format(cjson['id'])
            room_query_list.append({'url': url, 'channel': cjson['gameKey'], 'page': 1})
        for room_query in room_query_list:
            yield Request(room_query['url'].format(str(room_query['page'])), callback=self.parse_room_list,
                          meta=room_query)

    def parse_room_list(self, response):
        room_list = json.loads(response.text)['data']['rooms']
        if isinstance(room_list, list):
            for rjson in room_list:

                yield RoomItem({