Ejemplo n.º 1
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',
              download_small_image=False,
              download_big_image=False,
              download_mood_detail=True,
              download_like_detail=True,
              download_like_names=True):
     QQZoneFriendSpider.__init__(self,
                                 use_redis=use_redis,
                                 debug=debug,
                                 username=username,
                                 export_csv=export_csv,
                                 mood_begin=mood_begin,
                                 mood_num=mood_num,
                                 stop_time=stop_time,
                                 from_web=from_web,
                                 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,
                                 nickname=nickname,
                                 no_delete=no_delete,
                                 cookie_text=cookie_text,
                                 recover=recover,
                                 export_excel=export_excel,
                                 pool_flag=pool_flag,
                                 analysis=analysis)
     if not self.from_web:
         self.friend_name_list = self.get_friend_username()
     else:
         self.friend_name_list = []
     self.base_dir = ''
Ejemplo n.º 2
0
    def __init__(self,
                 use_redis=False,
                 debug=False,
                 username='',
                 analysis_friend=False,
                 mood_begin=0,
                 mood_num=-1,
                 stop_time='-1',
                 from_web=True,
                 nickname='',
                 no_delete=True,
                 cookie_text='',
                 pool_flag='127.0.0.1'):

        QQZoneFriendSpider.__init__(self,
                                    use_redis,
                                    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=True,
                                    export_csv=False,
                                    pool_flag=pool_flag)
        self.mood_data = []
        self.mood_data_df = pd.DataFrame()
        self.like_detail_df = []
        self.like_list_names_df = []
        self.file_name_head = username
        self.analysis_friend = analysis_friend
        self.has_clean_data = False
        self.friend_dir = BASE_DIR + self.file_name_head + '/friend/' + 'friend_detail_list.csv'
        self.history_like_agree_file_name = BASE_DIR + self.file_name_head + '/friend/' + 'history_like_list.json'

        self.av = Average(use_redis=False,
                          file_name_head=username,
                          analysis=True,
                          debug=debug)
        self.init_analysis_path()
Ejemplo n.º 3
0
 def __init__(self, file_name_head=""):
     QQZoneFriendSpider.__init__(self, analysis=True)
     if file_name_head != "":
         self.file_name_head = file_name_head
         self.FRIEND_DETAIL_LIST_FILE_NAME = 'friend/' + self.file_name_head + '_friend_detail_list.csv'
     self.data = pd.read_csv(self.FRIEND_DETAIL_LIST_FILE_NAME)
     self.remove_waste_index()
     print("获取文件:", self.FRIEND_DETAIL_LIST_FILE_NAME)
     self.SOURCE_TARGET_FILE_NAME = '../data/' + self.file_name_head + '_source_targets.csv'
     self.NODE_FILE_NAME = '../data/' + self.file_name_head + '_node.csv'
     self.RELATION_FILE_NAME = '../data/' + self.file_name_head + '_relation.csv'
     name = self.data['common_group_names']
     group_name = pd.DataFrame([name])
     self.people_name = self.data['nick_name'].values
     self.gravity = self.data['common_friend_num'].values
     self.add_friend_time = self.data['add_friend_time'].values
     self.common_group_names = group_name.T
     self.group_name_set = set()
     self.edge_list = []
     self.change_image_url()
     self.calculate()
     self.format_output()
Ejemplo n.º 4
0
 def test_init(self):
     QQZoneFriendSpider()
Ejemplo n.º 5
0
 def test_download_friend_header(self):
     fs = QQZoneFriendSpider(use_redis=True, analysis=True)
     fs.download_head_image()
     print("spend time to wait:", fs.image_thread_pool.time_spend)
Ejemplo n.º 6
0
 def test_get_first_friend_info(self):
     fs = QQZoneFriendSpider(use_redis=False, analysis=True)
     fs.get_first_friend_info()
     print(fs.user_info.first_friend, fs.user_info.first_friend_time)
Ejemplo n.º 7
0
 def test_clean_friend_data(self):
     fs = QQZoneFriendSpider(use_redis=False,
                             analysis=True,
                             export_csv=False)
     fs.clean_friend_data()
     print("friend df:", fs.friend_df.shape)
Ejemplo n.º 8
0
 def test_get_friend_detail(self):
     fs = QQZoneFriendSpider(use_redis=False, analysis=False, debug=True)
     fs.get_friend_detail()
Ejemplo n.º 9
0
 def test_get_friend_list(self):
     fs = QQZoneFriendSpider(use_redis=False, analysis=False)
     fs.get_friend_list()