def __init__(self, use_redis=False, debug=False, analysis=True, recover=False, username='', mood_begin=0, mood_num=-1, stop_time='-1', from_web=False, nickname='', no_delete=True, cookie_text='', export_excel=False, export_csv=True, pool_flag='127.0.0.1', download_small_image=False, download_big_image=False, download_mood_detail=True, download_like_detail=True, download_like_names=True): """ :param use_redis: 是否使用redis :param debug: 是否开启debug模式 :param analysis: 如果为true, 会执行爬虫程序,再执行分析程序,如果为false,只执行分析程序 """ QQZoneSpider.__init__(self, use_redis, debug, recover=recover, username=username, mood_num=mood_num, mood_begin=mood_begin, stop_time=stop_time, from_web=from_web, nickname=nickname, no_delete=no_delete, cookie_text=cookie_text, pool_flag=pool_flag, download_small_image=download_small_image, download_big_image=download_big_image, download_mood_detail=download_mood_detail, download_like_detail=download_like_detail, download_like_names=download_like_names) if self.g_tk == 0 and analysis == False: self.login() self.friend_detail = [] self.friend_list = [] self.friend_df = pd.DataFrame() self.re = self.connect_redis() self.friend_thread_list = [] self.export_excel = export_excel self.export_csv = export_csv self.error_friend_num = 0
def __init__(self, use_redis=False, debug=False, analysis=True, recover=False, username='', mood_begin=0, mood_num=-1, stop_time='-1', from_web=False, nickname='', no_delete=True, cookie_text='', export_excel=False, export_csv=True, pool_flag='127.0.0.1'): """ :param use_redis: 是否使用redis :param debug: 是否开启debug模式 :param analysis: 如果为true, 会执行爬虫程序,再执行分析程序,如果为false,只执行分析程序 """ QQZoneSpider.__init__(self, use_redis, debug, recover=recover, username=username, mood_num=mood_num, mood_begin=mood_begin, stop_time=stop_time, from_web=from_web, nickname=nickname, no_delete=no_delete, cookie_text=cookie_text, pool_flag=pool_flag) if self.g_tk == 0 and analysis == False: self.login() USER_BASE_DIR = BASE_DIR + self.username + '/' util.check_dir_exist(USER_BASE_DIR) FRIEND_DIR_HEAD = USER_BASE_DIR + 'friend/' self.FRIEND_LIST_FILE_NAME = FRIEND_DIR_HEAD + 'friend_list.json' self.FRIEND_DETAIL_FILE_NAME = FRIEND_DIR_HEAD + 'friend_detail.json' self.FRIEND_DETAIL_LIST_FILE_NAME = FRIEND_DIR_HEAD + 'friend_detail_list.csv' self.FRIEND_DETAIL_EXCEL_FILE_NAME = FRIEND_DIR_HEAD + 'friend_detail_list.xlsx' # 头像下载到web的static文件夹,以便在web中调用 self.FRIEND_HEADER_IMAGE_PATH = BASE_PATH + '/src/web/static/image/header/' + self.username + '/' util.check_dir_exist(USER_BASE_DIR + 'friend/') util.check_dir_exist(self.FRIEND_HEADER_IMAGE_PATH) self.friend_detail = [] self.friend_list = [] self.friend_df = pd.DataFrame() self.re = self.connect_redis() self.friend_thread_list = [] self.export_excel = export_excel self.export_csv = export_csv
def __init__(self, use_redis=False, debug=False, mood_begin=0, mood_num=-1, stop_time='-1', download_small_image=False, download_big_image=False, download_mood_detail=True, download_like_detail=True, download_like_names=True, recover=False): QQZoneSpider.__init__(self, use_redis=use_redis, debug=debug, mood_begin=mood_begin, mood_num=mood_num, stop_time=stop_time, download_small_image=download_small_image, download_big_image=download_big_image, download_mood_detail=download_mood_detail, download_like_detail=download_like_detail, download_like_names=download_like_names, recover=recover) self.friend_name_list = self.get_friend_username() self.base_dir = ''