def __init__(self,
                 keyword,
                 hostname,
                 username,
                 password,
                 schema,
                 tablename,
                 search_type=True):
        """
        initializing the WeChat crawler(mainly setup the local db) and input some key params
        :param keyword: the searching words
        :param search_type: the searching method: by_type: True or by_author: False
        """
        Download.__init__(self)
        self.query = keyword
        self.search_type = search_type
        self.headers = {
            'User-Agent':
            'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36'
        }

        #数据库
        self.db = pymysql.connect(str(hostname), str(username), str(password),
                                  str(schema))
        self.tablename = tablename
        cursor = self.db.cursor()
        print('已连接上数据库')

        #登录
        account = input("pls enter ur wechat account: ")
        pwd = input("pls enter ur wechat password: ")
        generator = Generator(account=account, password=pwd)
        generator.generate()
        print('扫码成功,数据生成结束')
 def __init__(self, url, filestat):
     Download.__init__(self, url, filestat)