# 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
        }
    }

    def parse(self, response):
        room_query_list = []
        for cjson in json.loads(response.text)['data']:
            yield ChannelItem({
                'short': cjson['ename'],
                'name': cjson['cname'],
                'image': cjson['img'],
                'url': 'http://www.panda.tv/cate/' + cjson['ename']
            })
            url = 'http://www.panda.tv/ajax_sort?classification={}&pagenum=120'.format(cjson['ename'])
            room_query_list.append({'url': url, 'channel': cjson['ename'], 'pageno': 1})
        for room_query in room_query_list:
            yield Request('{}&pageno=1'.format(room_query['url']), callback=self.parse_room_list, meta=room_query)

    def parse_room_list(self, response):
        room_list = json.loads(response.text)['data']['items']
        if isinstance(room_list, list):
            for rjson in room_list:
                yield RoomItem({
                    'office_id': rjson['id'],
                    'name': rjson['name'],
                    'image': rjson['pictures']['img'],
                    'url': response.urljoin(rjson['id']),
                    'online': int(rjson['person_num']) if rjson['person_num'].isdigit() else 0,
                    'host': rjson['userinfo']['nickName'],
                    'channel': response.meta['channel']
                })

# 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/panda.py
from scrapy import Spider, Request
from ..items import ChannelItem, RoomItem
import json

        }
    }

    def parse(self, response):
        room_query_list = []
        for cjson in json.loads(response.text)['data']:
            yield ChannelItem({
                'short': cjson['ename'],
                'name': cjson['cname'],
                'image': cjson['img'],
                'url': 'http://www.panda.tv/cate/' + cjson['ename']
            })
            url = 'http://www.panda.tv/ajax_sort?classification={}&pagenum=120'.format(cjson['ename'])
            room_query_list.append({'url': url, 'channel': cjson['ename'], 'pageno': 1})
        for room_query in room_query_list:
            yield Request('{}&pageno=1'.format(room_query['url']), callback=self.parse_room_list, meta=room_query)

    def parse_room_list(self, response):
        room_list = json.loads(response.text)['data']['items']
        if isinstance(room_list, list):
            for rjson in room_list:
                yield RoomItem({
                    'office_id': rjson['id'],
                    'name': rjson['name'],
                    'image': rjson['pictures']['img'],
                    'url': response.urljoin(rjson['id']),
                    'online': int(rjson['person_num']) if rjson['person_num'].isdigit() else 0,
                    'host': rjson['userinfo']['nickName'],
                    'channel': response.meta['channel']
                })

            if len(room_list) > 0: