async def _main_loop(client): own_name = await get_own_name(client) data = await list_dialogs(client, own_name) log.info('{:,} messages parsed.'.format(len(data))) if len(data) < 1: log.info('Nothing to save.') exit(0) log.info('Converting to DataFrame...') df = pd.DataFrame(data, columns=config['ALL_COLUMNS']) df['platform'] = 'telegram' log.info('Detecting languages...') df = detect_language(df) export_dataframe(df, config['telegram']['OUTPUT_PICKLE_NAME']) log.info('Done.')
def main(own_name, file_path, max_exported_messages): global MAX_EXPORTED_MESSAGES MAX_EXPORTED_MESSAGES = max_exported_messages log.info('Parsing Facebook messenger data...') if len(glob.glob(os.path.join(file_path, '**', '*.json'))) == 0: log.error(f'No input files found under {file_path}') exit(0) if own_name is None: own_name = infer_own_name(file_path) data = parse_messages(file_path, own_name) log.info('{:,} messages parsed.'.format(len(data))) if len(data) < 1: log.info('Nothing to save.') exit(0) log.info('Converting to DataFrame...') df = pd.DataFrame(data, columns=config['ALL_COLUMNS']) df['platform'] = 'messenger' log.info('Detecting languages...') df = detect_language(df) export_dataframe(df, config['messenger']['OUTPUT_PICKLE_NAME']) log.info('Done.')
def main(own_name, file_path, max_exported_messages, infer_datetime): global MAX_EXPORTED_MESSAGES MAX_EXPORTED_MESSAGES = max_exported_messages log.info('Parsing Whatsapp data...') files = glob.glob(os.path.join(file_path, '*.txt')) if len(files) == 0: log.error(f'No input files found under {file_path}') exit(0) if own_name is None: own_name = infer_own_name(files) data = parse_messages(files, own_name, infer_datetime) log.info('{:,} messages parsed.'.format(len(data))) if len(data) < 1: log.info('Nothing to save.') exit(0) df = pd.DataFrame(data, columns=config['ALL_COLUMNS']) df['platform'] = 'whatsapp' log.info('Detecting languages...') df = detect_language(df) # Export export_dataframe(df, config['whatsapp']['OUTPUT_PICKLE_NAME']) log.info('Done.')
def main(own_name, file_path, max_exported_messages): global MAX_EXPORTED_MESSAGES MAX_EXPORTED_MESSAGES = max_exported_messages log.info('Parsing Google Hangouts data...') if not os.path.isfile(file_path): log.error(f'No input file under {file_path}') exit(0) archive = read_archive(file_path) if own_name is None: own_name = infer_own_name(archive) data = parse_messages(archive, own_name) log.info('{:,} messages parsed.'.format(len(data))) if len(data) < 1: log.info('Nothing to save.') exit(0) log.info('Converting to DataFrame...') df = pd.DataFrame(data, columns=config['ALL_COLUMNS']) df['platform'] = 'hangouts' log.info('Detecting languages...') df = detect_language(df) export_dataframe(df, config['hangouts']['OUTPUT_PICKLE_NAME']) log.info('Done.')