# 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
# -*- coding: utf-8 -*-




class DouyuSpider(Spider):
    name = 'douyu'
    allowed_domains = ['douyucdn.cn']
    start_urls = [
        'http://open.douyucdn.cn/api/RoomApi/game'
    ]
    custom_settings = {
        'SITE': {
            'code': 'douyu',
            'name': '斗鱼',
            'description': '斗鱼-全民直播平台',
            'url': 'http://www.douyu.com',
            'image': 'http://staticlive.douyutv.com/common/douyu/images/logo_zb.png',
            'show_seq': 1
        }
    }

    def parse(self, response):
        room_query_list = []
        for cjson in json.loads(response.text)['data']:

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

# -*- coding: utf-8 -*-




class DouyuSpider(Spider):
    name = 'douyu'
    allowed_domains = ['douyucdn.cn']
    start_urls = [
        'http://open.douyucdn.cn/api/RoomApi/game'
    ]
    custom_settings = {
        'SITE': {
            'code': 'douyu',
            'name': '斗鱼',
            'description': '斗鱼-全民直播平台',
            'url': 'http://www.douyu.com',
            'image': 'http://staticlive.douyutv.com/common/douyu/images/logo_zb.png',
            'show_seq': 1
        }
    }

    def parse(self, response):
        room_query_list = []
        for cjson in json.loads(response.text)['data']:

            yield ChannelItem({