def parse_gmail(case):
     file_path = case.takeout_my_activity_gmail_path
     if os.path.exists(file_path) == False:
         return False
     with open(file_path, 'r', encoding='utf-8') as f:
         file_contents = f.read()
         soup = BeautifulSoup(file_contents, 'lxml')
         list_gmail_logs = TakeoutHtmlParser.find_log(soup)
         if list_gmail_logs != []:
             for i in trange(
                     len(list_gmail_logs),
                     desc=
                     "[Parsing the My Activity -> Gmail data..............]",
                     unit="epoch"):
                 # print("..........................................................................")
                 dic_my_activity_gmail = {
                     'service': "",
                     'type': "",
                     'keyword_url': "",
                     'keyword': "",
                     'timestamp': ""
                 }
                 MyActivityGmail.parse_gmail_log_title(
                     dic_my_activity_gmail, list_gmail_logs[i])
                 MyActivityGmail.parse_gmail_log_body(
                     dic_my_activity_gmail, list_gmail_logs[i])
                 MyActivityGmail.insert_log_info_to_preprocess_db(
                     dic_my_activity_gmail, case.preprocess_db_path)
Пример #2
0
 def parse_maps(case):
     file_path = case.takeout_my_activity_maps_path
     if os.path.exists(file_path) == False:
         return False
     with open(file_path, 'r', encoding='utf-8') as f:
         file_contents = f.read()
         soup = BeautifulSoup(file_contents, 'lxml')
         list_maps_logs = TakeoutHtmlParser.find_log(soup)
         if list_maps_logs != []:
             for i in trange(
                     len(list_maps_logs),
                     desc=
                     "[Parsing the My Activity -> Maps data...............]",
                     unit="epoch"):
                 # print("..........................................................................")
                 dic_my_activity_maps = {'timestamp':"", 'service':"", 'type':"", 'keyword':"", 'keyword_url':"", \
                 'keyword_latitude':"", 'keyword_longitude':"", 'latitude':"", 'longitude':"", 'geodata_description':"", \
                 'used_device':""}
                 MyActivityMaps.parse_maps_log_title(
                     dic_my_activity_maps, list_maps_logs[i])
                 MyActivityMaps.parse_maps_log_body(dic_my_activity_maps,
                                                    list_maps_logs[i])
                 MyActivityMaps.parse_maps_log_caption(
                     dic_my_activity_maps, list_maps_logs[i])
                 MyActivityMaps.insert_log_info_to_preprocess_db(
                     dic_my_activity_maps, case.preprocess_db_path)