У меня есть id фото и мне нужно её вытащить из telegram. Я пользуюсь telethon, но её документация это какой то ад. Я правда пытался понять, но без примеров очень туго. Помогите пожалуйста примером (или хотя бы советом, где его искать). Сам я наваял вот это
def get_data(user):
with TelegramClient('anon', api_id, api_hash) as client:
result = client(functions.photos.GetUserPhotosRequest(
user_id=user,
offset=0,
max_id=0,
limit=0
))
client.flood_sleep_threshold = 24 * 60 * 60
array_of_photos = result.photos
for photo in array_of_photos:
file_reference = photo.file_reference
file_id = photo.id
access_hash = photo.access_hash
return file_reference, file_id, access_hash
file_reference, file_id, access_hash = get_data('user')
with TelegramClient(name, api_id, api_hash) as client:
result = client(functions.upload.GetFileRequest(
location=types.InputFileLocation(
volume_id=-12398745604826,
local_id=42,
secret=-12398745604826,
file_reference=b'arbitrary\x7f data \xfa here'
),
offset=42,
limit=100,
precise=True,
cdn_supported=True
))
print(result.stringify())
Но работать оно отказывается. Самим input photo я тоже пытался пользоваться, но telethon ругается и говорит, что нельзя вызывать типы