def __init__(self, use_redis=False, debug=False, username='', analysis_friend=False, mood_begin=0, mood_num=-1, stop_time='-1', from_web=False, nickname='', no_delete=True, cookie_text='', pool_flag='127.0.0.1', exprot_excel=True, export_csv=False): """ :param use_redis: :param debug: :param username: :param analysis_friend: 是否要分析好友数据(比如最早的好友、共同好友数量最多的好友),如果要分析该类指标,必须已经获取了好友数据 :param mood_begin: :param mood_num: :param stop_time: :param from_web: :param nickname: :param no_delete: :param cookie_text: :param pool_flag: :param exprot_excel: :param export_csv: """ QQZoneFriendMoodSpider.__init__(self, use_redis=use_redis, debug=debug, recover=False, 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, analysis=True, export_excel=exprot_excel, export_csv=export_csv, pool_flag=pool_flag) self.mood_data = [] self.mood_data_df = pd.DataFrame() self.like_detail_df = [] self.like_list_names_df = [] self.analysis_friend = analysis_friend self.has_clean_data = False self.cmt_df = None self.like_uin_df = None self.av = Average(use_redis=False, file_name_head=username, analysis=True, debug=debug) self.cmt_friend_set = set() # 用于绘制词云图的字体,请更改为自己电脑上任意一款支持中文的字体,否则将无法显示中文 self.system_font = SYSTEM_FONT
def __init__(self, use_redis=False, debug=False, username='', analysis_friend=False, mood_begin=0, mood_num=-1, stop_time='-1', from_web=False, nickname='', no_delete=True, cookie_text='', pool_flag='127.0.0.1', exprot_excel=True, export_csv=False): QQZoneFriendMoodSpider.__init__(self, use_redis=use_redis, debug=debug, recover=False, 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, analysis=True, export_excel=exprot_excel, export_csv=export_csv, pool_flag=pool_flag) self.mood_data = [] self.mood_data_df = pd.DataFrame() self.like_detail_df = [] self.like_list_names_df = [] self.analysis_friend = analysis_friend self.has_clean_data = False self.av = Average(use_redis=False, file_name_head=username, analysis=True, debug=debug) # 用于绘制词云图的字体,请更改为自己电脑上任意一款支持中文的字体,否则将无法显示中文 self.system_font = SYSTEM_FONT
def test_change_name(self): fms = QQZoneFriendMoodSpider(mood_num=20) fms.change_username("120000", "test") assert fms.raw_username != fms.username
def test_init(self): QQZoneFriendMoodSpider()
def test_get_friend_mood(self): fms = QQZoneFriendMoodSpider(mood_num=20) fms.get_friend_mood()