# 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
            'url': 'https://www.huomao.com',
            'image': 'https://www.huomao.com/static/web/images/logo.jpg',
            'show_seq': 8
        }
    }

    def parse(self, response):
        for a_element in response.xpath('//div[@class="game-smallbox"]/a'):
            url = a_element.xpath('@href').extract_first()
            img_element = a_element.xpath('img')[0]
            image = img_element.xpath('@data-original').extract_first()
            if 'channellabel/showChannelLabel' in url:
                continue
            elif 'gamecollection/gameCollectionDetail' in url:
                yield Request(url, callback=self.parse_collection)
            else:
                short = url[url.rfind('/') + 1:]
                name = a_element.xpath('p/text()').extract_first()
                yield ChannelItem({
                    'short': short,
                    'name': name,
                    'image': image,
                    'url': url
                })
                url = 'https://www.huomao.com/channels/channel.json?page_size=120&game_url_rule={}'.format(short)
                yield Request('{}&page=1'.format(url), callback=self.parse_room_list, meta={'url': url, 'page': 1})

    def parse_collection(self, response):
        for a_element in response.xpath('//div[@id="game_label"]/li/a')[1:]:
            short = a_element.xpath('@id').extract_first()

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

            'url': 'https://www.huomao.com',
            'image': 'https://www.huomao.com/static/web/images/logo.jpg',
            'show_seq': 8
        }
    }

    def parse(self, response):
        for a_element in response.xpath('//div[@class="game-smallbox"]/a'):
            url = a_element.xpath('@href').extract_first()
            img_element = a_element.xpath('img')[0]
            image = img_element.xpath('@data-original').extract_first()
            if 'channellabel/showChannelLabel' in url:
                continue
            elif 'gamecollection/gameCollectionDetail' in url:
                yield Request(url, callback=self.parse_collection)
            else:
                short = url[url.rfind('/') + 1:]
                name = a_element.xpath('p/text()').extract_first()
                yield ChannelItem({
                    'short': short,
                    'name': name,
                    'image': image,
                    'url': url
                })
                url = 'https://www.huomao.com/channels/channel.json?page_size=120&game_url_rule={}'.format(short)
                yield Request('{}&page=1'.format(url), callback=self.parse_room_list, meta={'url': url, 'page': 1})

    def parse_collection(self, response):
        for a_element in response.xpath('//div[@id="game_label"]/li/a')[1:]:
            short = a_element.xpath('@id').extract_first()

            yield ChannelItem({