# 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 datetime import datetime
from ..items import ChannelItem, RoomItem
import json
        }
    }

    def parse(self, response):
        room_query_list = []
        for cjson in json.loads(response.text):
            yield ChannelItem({
                'office_id': str(cjson['id']),
                'short': cjson['slug'],
                'name': cjson['name'],
                'image': cjson['image'],
                'url': response.urljoin('/game/{}'.format(cjson['slug'])),
            })
            url = 'https://www.quanmin.tv/json/categories/{}/list{{}}.json'.format(cjson['slug'])
            room_query_list.append({'url': url, 'page': 0, 'channel': cjson['slug']})
        for room_query in room_query_list:
            yield Request(room_query['url'].format(''), callback=self.parse_room_list, meta=room_query)

    def parse_room_list(self, response):
        if response.text:
            room_list = json.loads(response.text)['data']
            if isinstance(room_list, list):
                for rjson in room_list:
                    image_url = rjson['thumb'][:rjson['thumb'].find('?')]
                    if image_url.startswith('http://'):
                        image_url = image_url.replace('http://', 'https://')
                    try:
                        start_time = datetime.utcfromtimestamp(float(rjson['start_time']))
                    except ValueError:
                        start_time = datetime.strptime(rjson['play_at'], '%Y-%m-%d %H:%M:%S')

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

        }
    }

    def parse(self, response):
        room_query_list = []
        for cjson in json.loads(response.text):
            yield ChannelItem({
                'office_id': str(cjson['id']),
                'short': cjson['slug'],
                'name': cjson['name'],
                'image': cjson['image'],
                'url': response.urljoin('/game/{}'.format(cjson['slug'])),
            })
            url = 'https://www.quanmin.tv/json/categories/{}/list{{}}.json'.format(cjson['slug'])
            room_query_list.append({'url': url, 'page': 0, 'channel': cjson['slug']})
        for room_query in room_query_list:
            yield Request(room_query['url'].format(''), callback=self.parse_room_list, meta=room_query)

    def parse_room_list(self, response):
        if response.text:
            room_list = json.loads(response.text)['data']
            if isinstance(room_list, list):
                for rjson in room_list:
                    image_url = rjson['thumb'][:rjson['thumb'].find('?')]
                    if image_url.startswith('http://'):
                        image_url = image_url.replace('http://', 'https://')
                    try:
                        start_time = datetime.utcfromtimestamp(float(rjson['start_time']))
                    except ValueError:
                        start_time = datetime.strptime(rjson['play_at'], '%Y-%m-%d %H:%M:%S')

                    yield RoomItem({