ValueError: Невозможно найти какой-либо объект, соответствующий «GTT — анализ и сигналы». Я удалил идентификатор API и хеш.
Код: Выделить всё
import openai
import pandas as pd
from telethon.sync import TelegramClient
import configparser
import datetime
config = configparser.ConfigParser()
config.read('telethon.config')
teleapi_id = 'telegramapi_id here'
teleapi_hash = 'telegramapihash_here'
client = TelegramClient('none', teleapi_id, teleapi_hash)
#for dialog in client.iter_dialogs():
# if dialog.is_channel:
# print(f'{dialog.id}:{dialog.title}')
df = pd.DataFrame()
chats = ['GTT - Analysis & Signals']
for chat in chats:
with TelegramClient('test', teleapi_id, teleapi_hash) as client:
for message in client.iter_messages(chat, offset_date=datetime.date.today() , reverse=False):
print(message)
data = { "group" : chat, "sender" : message.sender_id, "text" : message.text, "date" : message.date}
temp_df = pd.DataFrame(data, index=[1])
df = df.append(temp_df)
df['date'] = df['date'].dt.tz_localize(None)
df.to_excel("C:TelegramCopier.xlsx".format(datetime.date.today()), index=False)
Код: Выделить всё
for dialog in client.iter_dialogs():
if dialog.is_channel:
print(f'{dialog.id}:{dialog.title}')
Подробнее здесь: https://stackoverflow.com/questions/759 ... eiving-err
Мобильная версия