# -*- coding: utf-8 -*-
import scrapy
import time
import json
import redis
# from .items import Che168MasterSpider Item

pool = redis.ConnectionPool(host='192.168.1.241', port=6379, db=14)
con = redis.Redis(connection_pool=pool)
c = con.client()


class Che168MasterSpider(scrapy.Spider):
    name = 'che168_master'
    # allowed_domains = ['che168.com']
    start_urls = ['http://che168.com/']

    @classmethod
    def update_settings(cls, settings):
        settings.setdict(getattr(cls, 'custom_debug_settings' if getattr(cls, 'is_debug', False) else 'custom_settings', None) or {}, priority='spider')

    def __init__(self, **kwargs):
        super(Che168MasterSpider, self).__init__(**kwargs)
        self.counts = 0
        self.c = con.client()
        self.headers = {'Referer': 'https://www.che168.com',
                        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36"}
        self.cities = [{'name': '合肥', 'py': 'hefei'}, {'name': '芜湖', 'py': 'wuhu'}, {'name': '安庆', 'py': 'anqing'},
                       {'name': '阜阳', 'py': 'fu_yang'}, {'name': '亳州', 'py': 'bozhou'}, {'name': '蚌埠', 'py': 'bangbu'},
                       {'name': '池州', 'py': 'chizhou'}, {'name': '滁州', 'py': 'chuzhou'},
                       {'name': '黄山', 'py': 'huangshan'},
                       {'name': '淮北', 'py': 'huaibei'}, {'name': '淮南', 'py': 'huainan'}, {'name': '六安', 'py': 'liuan'},
                       {'name': '马鞍山', 'py': 'maanshan'}, {'name': '宿州', 'py': 'su_zhou'},
                       {'name': '铜陵', 'py': 'tongling'},
                       {'name': '宣城', 'py': 'xuancheng'},
                       {'name': '北京', 'py': 'beijing'}, {'name': '重庆', 'py': 'chongqing'},
                       {'name': '福州', 'py': 'fuzhou'}, {'name': '厦门', 'py': 'xiamen'}, {'name': '泉州', 'py': 'quanzhou'},
                       {'name': '龙岩', 'py': 'longyan'}, {'name': '宁德', 'py': 'ningde'}, {'name': '南平', 'py': 'nanping'},
                       {'name': '莆田', 'py': 'putian'}, {'name': '三明', 'py': 'sanming'},
                       {'name': '漳州', 'py': 'zhangzhou'},
                       {'name': '广州', 'py': 'guangzhou'}, {'name': '韶关', 'py': 'shaoguan'},
                       {'name': '深圳', 'py': 'shenzhen'},
                       {'name': '珠海', 'py': 'zhuhai'}, {'name': '汕头', 'py': 'shantou'}, {'name': '佛山', 'py': 'foshan'},
                       {'name': '江门', 'py': 'jiangmen'}, {'name': '惠州', 'py': 'huizhou'},
                       {'name': '东莞', 'py': 'dongguan'},
                       {'name': '中山', 'py': 'zhongshan'}, {'name': '潮州', 'py': 'chaozhou'},
                       {'name': '河源', 'py': 'heyuan'},
                       {'name': '揭阳', 'py': 'jieyang'}, {'name': '梅州', 'py': 'meizhou'},
                       {'name': '茂名', 'py': 'maoming'},
                       {'name': '清远', 'py': 'qingyuan'}, {'name': '汕尾', 'py': 'shanwei'}, {'name': '云浮', 'py': 'yunfu'},
                       {'name': '阳江', 'py': 'yangjiang'}, {'name': '湛江', 'py': 'zhanjiang'},
                       {'name': '肇庆', 'py': 'zhaoqing'},
                       {'name': '南宁', 'py': 'nanning'}, {'name': '柳州', 'py': 'liuzhou'}, {'name': '桂林', 'py': 'guilin'},
                       {'name': '北海', 'py': 'beihai'}, {'name': '百色', 'py': 'baise'}, {'name': '崇左', 'py': 'chongzuo'},
                       {'name': '防城港', 'py': 'fangchenggang'}, {'name': '贵港', 'py': 'guigang'},
                       {'name': '贺州', 'py': 'hezhou'}, {'name': '河池', 'py': 'hechi'}, {'name': '来宾', 'py': 'laibin'},
                       {'name': '钦州', 'py': 'qinzhou'}, {'name': '梧州', 'py': 'wuzhou'}, {'name': '玉林', 'py': 'yu_lin'},
                       {'name': '贵阳', 'py': 'guiyang'}, {'name': '遵义', 'py': 'zunyi'}, {'name': '安顺', 'py': 'anshun'},
                       {'name': '毕节', 'py': 'bijie'}, {'name': '六盘水', 'py': 'liupanshui'},
                       {'name': '黔西南', 'py': 'qianxinan'}, {'name': '黔东南', 'py': 'qiandongnan'},
                       {'name': '黔南', 'py': 'qiannan'}, {'name': '铜仁', 'py': 'tongren'},
                       {'name': '兰州', 'py': 'lanzhou'},
                       {'name': '白银', 'py': 'baiyin'}, {'name': '定西', 'py': 'dingxi'}, {'name': '甘南', 'py': 'gannan'},
                       {'name': '酒泉', 'py': 'jiuquan'}, {'name': '嘉峪关', 'py': 'jiayuguan'},
                       {'name': '金昌', 'py': 'jinchang'},
                       {'name': '陇南', 'py': 'longnan'}, {'name': '临夏', 'py': 'linxia'},
                       {'name': '平凉', 'py': 'pingliang'},
                       {'name': '庆阳', 'py': 'qingyang'}, {'name': '天水', 'py': 'tianshui'},
                       {'name': '武威', 'py': 'wuwei'},
                       {'name': '张掖', 'py': 'zhangye'},
                       {'name': '海口', 'py': 'haikou'}, {'name': '白沙', 'py': 'baisha'}, {'name': '保亭', 'py': 'baoting'},
                       {'name': '昌江', 'py': 'changjiang'}, {'name': '澄迈', 'py': 'chengmai'},
                       {'name': '东方', 'py': 'dongfang'}, {'name': '定安', 'py': 'dingan'},
                       {'name': '儋州', 'py': 'danzhou'},
                       {'name': '临高', 'py': 'lingao'}, {'name': '乐东', 'py': 'ledong'}, {'name': '陵水', 'py': 'lingshui'},
                       {'name': '琼中', 'py': 'qiongzhong'}, {'name': '琼海', 'py': 'qionghai'},
                       {'name': '三亚', 'py': 'sanya'},
                       {'name': '三沙', 'py': 'sansha'}, {'name': '屯昌', 'py': 'tunchang'},
                       {'name': '文昌', 'py': 'wenchang'},
                       {'name': '万宁', 'py': 'wanning'}, {'name': '五指山', 'py': 'wuzhishan'},
                       {'name': '郑州', 'py': 'zhengzhou'}, {'name': '开封', 'py': 'kaifeng'},
                       {'name': '洛阳', 'py': 'luoyang'},
                       {'name': '平顶山', 'py': 'pingdingshan'}, {'name': '安阳', 'py': 'anyang'},
                       {'name': '新乡', 'py': 'xinxiang'}, {'name': '焦作', 'py': 'jiaozuo'},
                       {'name': '濮阳', 'py': 'puyang'},
                       {'name': '许昌', 'py': 'xuchang'}, {'name': '南阳', 'py': 'nanyang'},
                       {'name': '商丘', 'py': 'shangqiu'},
                       {'name': '信阳', 'py': 'xinyang'}, {'name': '周口', 'py': 'zhoukou'},
                       {'name': '驻马店', 'py': 'zhumadian'},
                       {'name': '鹤壁', 'py': 'hebi'}, {'name': '济源', 'py': 'jiyuan'}, {'name': '漯河', 'py': 'luohe'},
                       {'name': '三门峡', 'py': 'sanmenxia'},
                       {'name': '武汉', 'py': 'wuhan'}, {'name': '十堰', 'py': 'shiyan'}, {'name': '宜昌', 'py': 'yichang'},
                       {'name': '襄阳', 'py': 'xiangyang'}, {'name': '鄂州', 'py': 'ezhou'}, {'name': '恩施', 'py': 'enshi'},
                       {'name': '黄冈', 'py': 'huanggang'}, {'name': '黄石', 'py': 'huangshi'},
                       {'name': '荆门', 'py': 'jingmen'},
                       {'name': '荆州', 'py': 'jingzhou'}, {'name': '潜江', 'py': 'qianjiang'},
                       {'name': '神农架', 'py': 'shennongjia'}, {'name': '随州', 'py': 'suizhou'},
                       {'name': '天门', 'py': 'tianmen'}, {'name': '孝感', 'py': 'xiaogan'},
                       {'name': '咸宁', 'py': 'xianning'},
                       {'name': '仙桃', 'py': 'xiantao'},
                       {'name': '长沙', 'py': 'changsha'}, {'name': '株洲', 'py': 'zhuzhou'},
                       {'name': '湘潭', 'py': 'xiangtan'},
                       {'name': '衡阳', 'py': 'hengyang'}, {'name': '常德', 'py': 'changde'},
                       {'name': '郴州', 'py': 'chenzhou'},
                       {'name': '怀化', 'py': 'huaihua'}, {'name': '娄底', 'py': 'loudi'}, {'name': '邵阳', 'py': 'shaoyang'},
                       {'name': '湘西', 'py': 'xiangxi'}, {'name': '永州', 'py': 'yongzhou'},
                       {'name': '岳阳', 'py': 'yueyang'},
                       {'name': '益阳', 'py': 'yiyang'}, {'name': '张家界', 'py': 'zhangjiajie'},
                       {'name': '石家庄', 'py': 'shijiazhuang'}, {'name': '唐山', 'py': 'tangshan'},
                       {'name': '秦皇岛', 'py': 'qinhuangdao'}, {'name': '邯郸', 'py': 'handan'},
                       {'name': '邢台', 'py': 'xingtai'},
                       {'name': '保定', 'py': 'baoding'}, {'name': '张家口', 'py': 'zhangjiakou'},
                       {'name': '承德', 'py': 'chengde'}, {'name': '沧州', 'py': 'cangzhou'},
                       {'name': '廊坊', 'py': 'langfang'},
                       {'name': '衡水', 'py': 'hengshui'},
                       {'name': '哈尔滨', 'py': 'haerbin'}, {'name': '齐齐哈尔', 'py': 'qiqihaer'},
                       {'name': '大庆', 'py': 'daqing'},
                       {'name': '大兴安岭', 'py': 'daxinganling'}, {'name': '黑河', 'py': 'heihe'},
                       {'name': '鹤岗', 'py': 'hegang'},
                       {'name': '鸡西', 'py': 'jixi'}, {'name': '佳木斯', 'py': 'jiamusi'},
                       {'name': '牡丹江', 'py': 'mudanjiang'},
                       {'name': '七台河', 'py': 'qitaihe'}, {'name': '双鸭山', 'py': 'shuangyashan'},
                       {'name': '绥化', 'py': 'suihua'}, {'name': '伊春', 'py': 'yichun'},
                       {'name': '南京', 'py': 'nanjing'}, {'name': '无锡', 'py': 'wuxi'}, {'name': '徐州', 'py': 'xuzhou'},
                       {'name': '常州', 'py': 'changzhou'}, {'name': '苏州', 'py': 'suzhou'},
                       {'name': '南通', 'py': 'nantong'},
                       {'name': '连云港', 'py': 'lianyungang'}, {'name': '淮安', 'py': 'huaian'},
                       {'name': '盐城', 'py': 'yancheng'}, {'name': '扬州', 'py': 'yangzhou'},
                       {'name': '镇江', 'py': 'zhenjiang'},
                       {'name': '泰州', 'py': 'tai_zhou'}, {'name': '宿迁', 'py': 'suqian'},
                       {'name': '南昌', 'py': 'nanchang'}, {'name': '九江', 'py': 'jiujiang'},
                       {'name': '赣州', 'py': 'ganzhou'},
                       {'name': '上饶', 'py': 'shangrao'}, {'name': '抚州', 'py': 'fu_zhou'}, {'name': '吉安', 'py': 'jian'},
                       {'name': '景德镇', 'py': 'jingdezhen'}, {'name': '萍乡', 'py': 'ping_xiang'},
                       {'name': '新余', 'py': 'xinyu'}, {'name': '鹰潭', 'py': 'yingtan'}, {'name': '宜春', 'py': 'yi_chun'},
                       {'name': '长春', 'py': 'changchun'}, {'name': '吉林', 'py': 'jilinshi'},
                       {'name': '白山', 'py': 'baishan'},
                       {'name': '白城', 'py': 'baicheng'}, {'name': '辽源', 'py': 'liaoyuan'},
                       {'name': '松原', 'py': 'songyuan'},
                       {'name': '四平', 'py': 'siping'}, {'name': '通化', 'py': 'tonghua'}, {'name': '延边', 'py': 'yanbian'},
                       {'name': '沈阳', 'py': 'shenyang'}, {'name': '大连', 'py': 'dalian'}, {'name': '鞍山', 'py': 'anshan'},
                       {'name': '营口', 'py': 'yingkou'}, {'name': '本溪', 'py': 'benxi'}, {'name': '朝阳', 'py': 'chaoyang'},
                       {'name': '丹东', 'py': 'dandong'}, {'name': '抚顺', 'py': 'fushun'}, {'name': '阜新', 'py': 'fuxin'},
                       {'name': '葫芦岛', 'py': 'huludao'}, {'name': '锦州', 'py': 'jinzhou'},
                       {'name': '辽阳', 'py': 'liaoyang'},
                       {'name': '盘锦', 'py': 'panjin'}, {'name': '铁岭', 'py': 'tieling'},
                       {'name': '呼和浩特', 'py': 'huhehaote'}, {'name': '包头', 'py': 'baotou'},
                       {'name': '赤峰', 'py': 'chifeng'},
                       {'name': '通辽', 'py': 'tongliao'}, {'name': '鄂尔多斯', 'py': 'eerduosi'},
                       {'name': '阿拉善盟', 'py': 'alashanmeng'}, {'name': '巴彦淖尔', 'py': 'bayannaoer'},
                       {'name': '呼伦贝尔', 'py': 'hulunbeier'}, {'name': '兴安盟', 'py': 'xinganmeng'},
                       {'name': '乌兰察布', 'py': 'wulanchabu'}, {'name': '乌海', 'py': 'wuhai'},
                       {'name': '锡林郭勒盟', 'py': 'xilinguolemeng'},
                       {'name': '银川', 'py': 'yinchuan'}, {'name': '固原', 'py': 'guyuan'},
                       {'name': '石嘴山', 'py': 'shizuishan'},
                       {'name': '吴忠', 'py': 'wuzhong'}, {'name': '中卫', 'py': 'zhongwei'},
                       {'name': '西宁', 'py': 'xining'},
                       {'name': '果洛', 'py': 'guoluo'}, {'name': '海西', 'py': 'haixi'}, {'name': '海东', 'py': 'haidong'},
                       {'name': '海北', 'py': 'haibei'}, {'name': '黄南', 'py': 'huangnan'},
                       {'name': '海南', 'py': 'hai_nan'},
                       {'name': '玉树', 'py': 'yushu'},
                       {'name': '西安', 'py': 'xian'}, {'name': '榆林', 'py': 'yulin'}, {'name': '安康', 'py': 'ankang'},
                       {'name': '宝鸡', 'py': 'baoji'}, {'name': '汉中', 'py': 'hanzhong'},
                       {'name': '商洛', 'py': 'shangluo'},
                       {'name': '铜川', 'py': 'tongchuan'}, {'name': '渭南', 'py': 'weinan'},
                       {'name': '咸阳', 'py': 'xianyang'},
                       {'name': '西咸新区', 'py': 'xixianxinqu'}, {'name': '延安', 'py': 'yanan'},
                       {'name': '成都', 'py': 'chengdu'}, {'name': '德阳', 'py': 'deyang'},
                       {'name': '绵阳', 'py': 'mianyang'},
                       {'name': '南充', 'py': 'nanchong'}, {'name': '阿坝', 'py': 'aba'}, {'name': '巴中', 'py': 'bazhong'},
                       {'name': '达州', 'py': 'dazhou'}, {'name': '广元', 'py': 'guangyuan'},
                       {'name': '广安', 'py': 'guangan'},
                       {'name': '甘孜', 'py': 'ganzi'}, {'name': '凉山', 'py': 'liangshan'}, {'name': '乐山', 'py': 'leshan'},
                       {'name': '泸州', 'py': 'luzhou'}, {'name': '眉山', 'py': 'meishan'},
                       {'name': '内江', 'py': 'neijiang'},
                       {'name': '攀枝花', 'py': 'panzhihua'}, {'name': '遂宁', 'py': 'suining'},
                       {'name': '宜宾', 'py': 'yibin'},
                       {'name': '雅安', 'py': 'yaan'}, {'name': '资阳', 'py': 'ziyang'}, {'name': '自贡', 'py': 'zigong'},
                       {'name': '上海', 'py': 'shanghai'},
                       {'name': '太原', 'py': 'taiyuan'}, {'name': '大同', 'py': 'datong'},
                       {'name': '长治', 'py': 'zhangzhi'},
                       {'name': '晋城', 'py': 'jincheng'}, {'name': '晋中', 'py': 'jinzhong'},
                       {'name': '运城', 'py': 'yuncheng'},
                       {'name': '临汾', 'py': 'linfen'}, {'name': '吕梁', 'py': 'lvliang'},
                       {'name': '朔州', 'py': 'shuozhou'},
                       {'name': '忻州', 'py': 'xinzhou'}, {'name': '阳泉', 'py': 'yangquan'},
                       {'name': '济南', 'py': 'jinan'}, {'name': '青岛', 'py': 'qingdao'}, {'name': '淄博', 'py': 'zibo'},
                       {'name': '枣庄', 'py': 'zaozhuang'}, {'name': '东营', 'py': 'dongying'},
                       {'name': '烟台', 'py': 'yantai'},
                       {'name': '潍坊', 'py': 'weifang'}, {'name': '济宁', 'py': 'jining'}, {'name': '泰安', 'py': 'taian'},
                       {'name': '威海', 'py': 'weihai'}, {'name': '日照', 'py': 'rizhao'}, {'name': '莱芜', 'py': 'laiwu'},
                       {'name': '临沂', 'py': 'linyi'}, {'name': '德州', 'py': 'dezhou'}, {'name': '聊城', 'py': 'liaocheng'},
                       {'name': '滨州', 'py': 'binzhou'}, {'name': '菏泽', 'py': 'heze'}, {'name': '天津', 'py': 'tianjin'},
                       {'name': '乌鲁木齐', 'py': 'wulumuqi'}, {'name': '阿克苏', 'py': 'akesu'},
                       {'name': '阿勒泰', 'py': 'aletai'},
                       {'name': '阿拉尔', 'py': 'aral'}, {'name': '北屯', 'py': 'beitun'},
                       {'name': '博尔塔拉', 'py': 'boertala'},
                       {'name': '巴音郭楞', 'py': 'bayinguoleng'}, {'name': '昌吉', 'py': 'changji'},
                       {'name': '哈密', 'py': 'hami'},
                       {'name': '和田', 'py': 'hetian'}, {'name': '伊犁', 'py': 'yili'}, {'name': '克拉玛依', 'py': 'kelamayi'},
                       {'name': '克孜勒苏', 'py': 'kezilesu'}, {'name': '喀什', 'py': 'kashen'},
                       {'name': '可克达拉', 'py': 'kokdala'},
                       {'name': '昆玉', 'py': 'kunyu'}, {'name': '塔城', 'py': 'tacheng'}, {'name': '石河子', 'py': 'shihezi'},
                       {'name': '双河', 'py': 'shuanghe'}, {'name': '铁门关', 'py': 'tiemenguan'},
                       {'name': '图木舒克', 'py': 'tumxuk'}, {'name': '吐鲁番', 'py': 'turpan'},
                       {'name': '五家渠', 'py': 'wujiaqu'},
                       {'name': '拉萨', 'py': 'lasa'}, {'name': '林芝', 'py': 'nyingchi'}, {'name': '那曲', 'py': 'naqu'},
                       {'name': '阿里', 'py': 'ali'}, {'name': '昌都', 'py': 'qamdo'}, {'name': '日喀则', 'py': 'rikaze'},
                       {'name': '山南', 'py': 'shannan'},
                       {'name': '昆明', 'py': 'kunming'}, {'name': '曲靖', 'py': 'qujing'}, {'name': '保山', 'py': 'baoshan'},
                       {'name': '楚雄', 'py': 'chuxiong'}, {'name': '大理', 'py': 'dali'}, {'name': '德宏', 'py': 'dehong'},
                       {'name': '迪庆', 'py': 'diqing'}, {'name': '红河', 'py': 'honghe'}, {'name': '临沧', 'py': 'lincang'},
                       {'name': '丽江', 'py': 'lijiang'}, {'name': '怒江', 'py': 'nujiang'}, {'name': '普洱', 'py': 'puer'},
                       {'name': '文山', 'py': 'wenshan'}, {'name': '西双版纳', 'py': 'xishuangbanna'},
                       {'name': '玉溪', 'py': 'yuxi'}, {'name': '昭通', 'py': 'zhaotong'},
                       {'name': '杭州', 'py': 'hangzhou'}, {'name': '宁波', 'py': 'ningbo'},
                       {'name': '温州', 'py': 'wenzhou'},
                       {'name': '嘉兴', 'py': 'jiaxing'}, {'name': '湖州', 'py': 'huzhou'},
                       {'name': '绍兴', 'py': 'shaoxing'},
                       {'name': '金华', 'py': 'jinhua'}, {'name': '衢州', 'py': 'quzhou'}, {'name': '台州', 'py': 'taizhou'},
                       {'name': '丽水', 'py': 'lishui'}, {'name': '舟山', 'py': 'zhoushan'},
                       {'name': '舟山群岛新区', 'py': 'zhoushanxinqu'}]
        self.brand_dic = {'aodi': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=33&prov=0&safe=0',
                          'asidunmading': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=35&prov=0&safe=0',
                          'aerfaluomiou': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=34&prov=0&safe=0',
                          'alpina': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=276&prov=0&safe=0',
                          'acschnitzer': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=117&prov=0&safe=0',
                          'ankaikeche': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=221&prov=0&safe=0',
                          'auxunaoxuan': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=378&prov=0&safe=0',
                          'aichi': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=327&prov=0&safe=0',
                          'baoma': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=15&prov=0&safe=0',
                          'benchi': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=36&prov=0&safe=0',
                          'bentian': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=14&prov=0&safe=0',
                          'baoshijie': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=40&prov=0&safe=0',
                          'bieke': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=38&prov=0&safe=0',
                          'biaozhi': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=13&prov=0&safe=0',
                          'biyadi': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=75&prov=0&safe=0',
                          'binli': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=39&prov=0&safe=0',
                          'baojun': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=120&prov=0&safe=0',
                          'beijing': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=27&prov=0&safe=0',
                          'benteng': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=95&prov=0&safe=0',
                          'beiqizhizao': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=154&prov=0&safe=0',
                          'beiqixinnengyuan': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=208&prov=0&safe=0',
                          'beijingqiche': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=173&prov=0&safe=0',
                          'babosi': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=140&prov=0&safe=0',
                          'baowo': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=231&prov=0&safe=0',
                          'beiqihuansu': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=203&prov=0&safe=0',
                          'beiqiweiwang': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=143&prov=0&safe=0',
                          'beiqichanghe': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=79&prov=0&safe=0',
                          'bisuqiche': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=271&prov=0&safe=0',
                          'bujiadi': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=37&prov=0&safe=0',
                          'beiqidaoda': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=301&prov=0&safe=0',
                          'bochi': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=392&prov=0&safe=0',
                          'bidewenqiche': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=387&prov=0&safe=0',
                          'baoqiqiche': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=351&prov=0&safe=0',
                          'changan': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=76&prov=0&safe=0',
                          'changcheng': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=77&prov=0&safe=0',
                          'changanoushang': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=163&prov=0&safe=0',
                          'changanqingxingche': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=294&prov=0&safe=0',
                          'changankuayue': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=299&prov=0&safe=0',
                          'chechiqiche': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=366&prov=0&safe=0',
                          'chenggongqiche': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=196&prov=0&safe=0',
                          'dazhong': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=1&prov=0&safe=0',
                          'dongfengfengxing': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=165&prov=0&safe=0',
                          'daoqi': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=41&prov=0&safe=0',
                          'ds': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=169&prov=0&safe=0',
                          'dongnan': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=81&prov=0&safe=0',
                          'dongfengfengshen': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=113&prov=0&safe=0',
                          'dongfeng': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=32&prov=0&safe=0',
                          'dongfengfengguang': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=259&prov=0&safe=0',
                          'dongfengxiaokang': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=142&prov=0&safe=0',
                          'dongfengfengdu': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=187&prov=0&safe=0',
                          'dafa': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=92&prov=0&safe=0',
                          'dianka': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=280&prov=0&safe=0',
                          'dachengqiche': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=341&prov=0&safe=0',
                          'dongfengruitaite': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=326&prov=0&safe=0',
                          'fengtian': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=3&prov=0&safe=0',
                          'fute': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=8&prov=0&safe=0',
                          'falali': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=42&prov=0&safe=0',
                          'feiyate': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=11&prov=0&safe=0',
                          'futian': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=96&prov=0&safe=0',
                          'fudi': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=141&prov=0&safe=0',
                          'fuqiqiteng': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=197&prov=0&safe=0',
                          'guangqichuanqi': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=82&prov=0&safe=0',
                          'gmc': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=112&prov=0&safe=0',
                          'guanzhi': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=152&prov=0&safe=0',
                          'guanggang': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=116&prov=0&safe=0',
                          'guangqijiao': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=108&prov=0&safe=0',
                          'guangqixinnengyuan': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=313&prov=0&safe=0',
                          'guangqijituan': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=329&prov=0&safe=0',
                          'guojizhijun': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=369&prov=0&safe=0',
                          'guojinqiche': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=304&prov=0&safe=0',
                          'hafu': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=181&prov=0&safe=0',
                          'hongqi': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=91&prov=0&safe=0',
                          'hanma': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=43&prov=0&safe=0',
                          'haima': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=86&prov=0&safe=0',
                          'huatai': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=87&prov=0&safe=0',
                          'hantengqiche': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=267&prov=0&safe=0',
                          'hafei': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=24&prov=0&safe=0',
                          'huanghai': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=97&prov=0&safe=0',
                          'huasong': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=220&prov=0&safe=0',
                          'huapu': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=85&prov=0&safe=0',
                          'haige': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=150&prov=0&safe=0',
                          'huataixinnengyuan': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=260&prov=0&safe=0',
                          'huaqi': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=184&prov=0&safe=0',
                          'hongxingqiche': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=336&prov=0&safe=0',
                          'hengtian': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=164&prov=0&safe=0',
                          'huakai': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=245&prov=0&safe=0',
                          'hanlongqiche': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=386&prov=0&safe=0',
                          'huali': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=237&prov=0&safe=0',
                          'icona': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=188&prov=0&safe=0',
                          'jeep': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=46&prov=0&safe=0',
                          'jiebao': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=44&prov=0&safe=0',
                          'jiliqiche': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=25&prov=0&safe=0',
                          'jianghuai': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=84&prov=0&safe=0',
                          'jinbei': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=83&prov=0&safe=0',
                          'jiangling': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=119&prov=0&safe=0',
                          'jiulong': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=151&prov=0&safe=0',
                          'jietu': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=319&prov=0&safe=0',
                          'jinlong': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=145&prov=0&safe=0',
                          'jinlv': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=175&prov=0&safe=0',
                          'jianglingjituanxinnengyuan': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=270&prov=0&safe=0',
                          'junmaqiche': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=297&prov=0&safe=0',
                          'jienisaisi': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=371&prov=0&safe=0',
                          'jiheqiche': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=373&prov=0&safe=0',
                          'juntian': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=356&prov=0&safe=0',
                          'jieda': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=358&prov=0&safe=0',
                          'kaidilake': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=47&prov=0&safe=0',
                          'kelaisile': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=9&prov=0&safe=0',
                          'kenisaike': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=100&prov=0&safe=0',
                          'kaiyi': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=214&prov=0&safe=0',
                          'kaersen': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=156&prov=0&safe=0',
                          'kairui': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=101&prov=0&safe=0',
                          'ktm': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=109&prov=0&safe=0',
                          'kawei': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=199&prov=0&safe=0',
                          'kasheng': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=224&prov=0&safe=0',
                          'kaiwoqiche': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=213&prov=0&safe=0',
                          'leikesasi': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=52&prov=0&safe=0',
                          'luhu': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=49&prov=0&safe=0',
                          'lingmu': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=53&prov=0&safe=0',
                          'lanbojini': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=48&prov=0&safe=0',
                          'laosilaisi': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=54&prov=0&safe=0',
                          'linken': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=51&prov=0&safe=0',
                          'lingke': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=279&prov=0&safe=0',
                          'liebaoqiche': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=78&prov=0&safe=0',
                          'leinuo': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=10&prov=0&safe=0',
                          'lufeng': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=88&prov=0&safe=0',
                          'lutesi': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=50&prov=0&safe=0',
                          'lifanqiche': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=80&prov=0&safe=0',
                          'lianhuaqiche': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=89&prov=0&safe=0',
                          'linian': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=124&prov=0&safe=0',
                          'lorinser': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=118&prov=0&safe=0',
                          'localmotors': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=241&prov=0&safe=0',
                          'lite': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=335&prov=0&safe=0',
                          'lingtuqiche': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=343&prov=0&safe=0',
                          'luofuhate': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=346&prov=0&safe=0',
                          'ludifangzhou': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=204&prov=0&safe=0',
                          'lixiangqiche': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=345&prov=0&safe=0',
                          'leiding': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=215&prov=0&safe=0',
                          'lingpaoqiche': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=318&prov=0&safe=0',
                          'mazida': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=58&prov=0&safe=0',
                          'mingjue': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=20&prov=0&safe=0',
                          'mashaladi': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=57&prov=0&safe=0',
                          'mini': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=56&prov=0&safe=0',
                          'maikailun': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=129&prov=0&safe=0',
                          'maibahe': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=55&prov=0&safe=0',
                          'mogen': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=168&prov=0&safe=0',
                          'maisharui': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=374&prov=0&safe=0',
                          'maimai': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=381&prov=0&safe=0',
                          'nazhijie': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=130&prov=0&safe=0',
                          'nazhaqiche': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=309&prov=0&safe=0',
                          'ouge': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=60&prov=0&safe=0',
                          'oubao': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=59&prov=0&safe=0',
                          'oula': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=331&prov=0&safe=0',
                          'oulang': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=146&prov=0&safe=0',
                          'pajiani': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=61&prov=0&safe=0',
                          'polestarjixing': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=308&prov=0&safe=0',
                          'qiya': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=62&prov=0&safe=0',
                          'qirui': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=26&prov=0&safe=0',
                          'qichen': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=122&prov=0&safe=0',
                          'qiaozhibadun': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=222&prov=0&safe=0',
                          'qiantu': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=235&prov=0&safe=0',
                          'quanqiuying': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=219&prov=0&safe=0',
                          'qinglingqiche': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=312&prov=0&safe=0',
                          'qilingqiche': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=210&prov=0&safe=0',
                          'richan': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=63&prov=0&safe=0',
                          'rongwei': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=19&prov=0&safe=0',
                          'ruiqi': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=103&prov=0&safe=0',
                          'ruichixinnengyuan': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=296&prov=0&safe=0',
                          'ruhu': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=174&prov=0&safe=0',
                          'rongdazhizao': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=337&prov=0&safe=0',
                          'sanling': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=68&prov=0&safe=0',
                          'sikeda': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=67&prov=0&safe=0',
                          'sibalu': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=65&prov=0&safe=0',
                          'smart': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=45&prov=0&safe=0',
                          'shangqimaxus': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=155&prov=0&safe=0',
                          'sabo': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=64&prov=0&safe=0',
                          'shuanglong': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=69&prov=0&safe=0',
                          'siming': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=162&prov=0&safe=0',
                          'swmsiweiqiche': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=269&prov=0&safe=0',
                          'shuanghuan': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=90&prov=0&safe=0',
                          'sailin': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=205&prov=0&safe=0',
                          'shijue': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=66&prov=0&safe=0',
                          'sidataike': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=238&prov=0&safe=0',
                          'srmxinyuan': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=306&prov=0&safe=0',
                          'sihao': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=330&prov=0&safe=0',
                          'shelby': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=388&prov=0&safe=0',
                          'shang喆': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=402&prov=0&safe=0',
                          'shanqitongjia': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=149&prov=0&safe=0',
                          'tesila': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=133&prov=0&safe=0',
                          'tengshi': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=161&prov=0&safe=0',
                          'taikate': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=202&prov=0&safe=0',
                          'woerwo': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=70&prov=0&safe=0',
                          'wulingqiche': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=114&prov=0&safe=0',
                          'wey': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=283&prov=0&safe=0',
                          'wushiling': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=167&prov=0&safe=0',
                          'weilai': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=284&prov=0&safe=0',
                          'weilin': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=102&prov=0&safe=0',
                          'weimaqiche': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=291&prov=0&safe=0',
                          'weichaiyingzhi': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=192&prov=0&safe=0',
                          'weiziman': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=99&prov=0&safe=0',
                          'weichaiqiche': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=393&prov=0&safe=0',
                          'xiandai': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=12&prov=0&safe=0',
                          'xuefolan': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=71&prov=0&safe=0',
                          'xuetielong': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=72&prov=0&safe=0',
                          'xiyate': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=98&prov=0&safe=0',
                          'xiaopengqiche': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=275&prov=0&safe=0',
                          'xinteqiche': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=324&prov=0&safe=0',
                          'xingtu': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=350&prov=0&safe=0',
                          'xinkai': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=185&prov=0&safe=0',
                          'xinbaojun': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=396&prov=0&safe=0',
                          'yingfeinidi': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=73&prov=0&safe=0',
                          'yiweike': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=144&prov=0&safe=0',
                          'yiqi': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=110&prov=0&safe=0',
                          'yusheng': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=263&prov=0&safe=0',
                          'yemaqiche': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=111&prov=0&safe=0',
                          'yongyuan': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=93&prov=0&safe=0',
                          'yujie': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=232&prov=0&safe=0',
                          'yutongkeche': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=298&prov=0&safe=0',
                          'yundu': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=286&prov=0&safe=0',
                          'yunqueqiche': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=317&prov=0&safe=0',
                          'yuanchengqiche': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=382&prov=0&safe=0',
                          'yinlongxinnengyuan': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=375&prov=0&safe=0',
                          'yulu': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=307&prov=0&safe=0',
                          'yiqilinghe': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=399&prov=0&safe=0',
                          'zhongtai': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=94&prov=0&safe=0',
                          'zhonghua': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=22&prov=0&safe=0',
                          'zhidou': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=206&prov=0&safe=0',
                          'zhongxing': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=74&prov=0&safe=0',
                          'zhinuo': 'https://m.che168.com/carlist/FilterSeries.aspx?brandid=182&prov=0&safe=0'}

    is_debug = True
    custom_debug_settings = {
        'MYSQL_SERVER': '192.168.1.94',
        'MYSQL_DB': 'usedcar_update',
        'MYSQL_TABLE': 'che168_master',
        'MONGODB_SERVER': '192.168.1.94',
        'MONGODB_DB': 'usedcar_update',
        'MONGODB_COLLECTION': 'che168_master',
        'CONCURRENT_REQUESTS': 8,
        'DOWNLOAD_DELAY': 0,
        'LOG_LEVEL': 'DEBUG',

    }

    def start_requests(self):
        url = "https://www.che168.com/china/list/"
        yield scrapy.Request(
            url=url,
            dont_filter=True,
        )

    def parse(self, response):
        # for brand_pinyin, url in self.brand_dic.items():
        #     yield scrapy.Request(
        #         url=url,
        #         meta={"brand_pinyin": brand_pinyin},
        #         callback=self.parse_brand,
        #         headers=self.headers
        #     )
        for brand_pinyin in self.brand_dic.keys():
            for city_dic in self.cities:
                city_pinyin = city_dic["py"]
                brand_url = f"https://www.che168.com/{city_pinyin}/{brand_pinyin}/"
                # print(brand_url)
                # print("*"*100)
                yield scrapy.Request(
                    url=brand_url,
                    callback=self.list_parse,
                    headers=self.headers,
                    dont_filter=True
                )

    # def parse_brand(self, response):
    #     brand_pinyin = response.meta["brand_pinyin"]
    #     series_pinyin_list = response.xpath("//span[@class='carseries']/@data-pinyin").getall()
    #     if len(series_pinyin_list) > 0:
    #         for series in series_pinyin_list:
    #             series_url = f"https://www.che168.com/china/{brand_pinyin}/{series}/a0_0msdgscncgpi1lto8cspexx0/"
    #             # print(series_url)
    #             yield scrapy.Request(
    #                 url=series_url,
    #                 callback=self.list_parse,
    #                 headers=self.headers
    #             )

    def list_parse(self, response):
        car_list = response.xpath('//*[@class="viewlist_ul"]/li')
        if car_list:
            print("*"*100)
            print(len(car_list))
            for href in response.xpath('//*[@class="viewlist_ul"]/li'):
                urlbase = href.xpath("./a/@href").get()
                url = response.urljoin(urlbase)
                self.c.lpush('che168:start_urls', url)
                print(url)

            # next page
            next_page = response.xpath('//a[@class="page-item-next"]/@href')
            if next_page:
                url_next = response.urljoin(next_page.get())
                yield scrapy.Request(
                    url_next,
                    self.list_parse,
                    headers=self.headers,
                    dont_filter=True
                )
        else:
            print("-"*100)
            print(response.url)

