""") try: config = configparser.ConfigParser() config.read("config.ini") channel = config['Telegram']['from_channel'] phone = utils.parse_phone(config['Telegram']['main_phone']) api = read_csv('api.csv')[0] client = TelegramClient(f"sessions/{phone}", *api) client.start(phone) rows = [['ID', 'Name', 'Username', 'Phone']] print("Getting participants...") for participant in client.iter_participants(channel, aggressive=True): print(f"Got {len(rows)}", end='\r') rows.append([ participant.id, utils.get_display_name(participant), participant.username, participant.phone ]) print("\nWriting output") write_csv('users.csv', rows) print("Done!") finally: input()
config.read("config.ini") channel = config['Telegram']['from_channel'] phone = utils.parse_phone(config['Telegram']['main_phone']) api = read_csv('api.csv')[0] client = TelegramClient(f"sessions/{phone}", *api) client.start(phone) rows = [['ID', 'Name', 'Username', 'Phone']] print("Getting members...") for participant in client.iter_participants(channel, aggressive=True): print(f"Got {len(rows)}", end='\r') rows.append([ participant.id, utils.get_display_name(participant), participant.username, participant.phone ]) print("\nWriting output") write_csv('members.csv', rows) print("Successfully exported") print( " Contact :- facebook.com/WhiteHatChannel ~ github.com/WhiteHatChannel ~ t.me/WhitehatTelegram" ) finally: input()