Skip to content

Unable to retrieve media #9

@regystro

Description

@regystro

Hi.

Is there any way to retrieve the media you get with the telegram client receiver?

Trying to get a photo from this data:

            "photo": {
                "flags": 0,
                "hasStickers": false,
                "id": "5981157309243573457",
                "accessHash": "-7494210757570954971",
                "fileReference": {
                    "type": "Buffer",
                    "data": [ "omitted" ]
                },
                "date": 1734349206,
                "sizes": [
                    {
                        "type": "i",
                        "bytes": {
                            "type": "Buffer",
                            "data": [ "omitted" ]
                        },
                        "className": "PhotoStrippedSize"
                    },
                    {
                        "type": "m",
                        "w": 320,
                        "h": 180,
                        "size": 16672,
                        "className": "PhotoSize"
                    },
                    {
                        "type": "x",
                        "w": 800,
                        "h": 450,
                        "size": 64967,
                        "className": "PhotoSize"
                    },
                    {
                        "type": "y",
                        "w": 1280,
                        "h": 720,
                        "sizes": [
                            11140,
                            28451,
                            56290,
                            80415,
                            125431
                        ],
                        "className": "PhotoSizeProgressive"
                    }
                ],
                "videoSizes": null,
                "dcId": 4,
                "className": "Photo"
            }

The data of the fileReference is omitted, for size reasons.

I'm trying to use InputPhotoFileLocation, as stated here: https://gram.js.org/beta/classes/TelegramClient.html#downloadFile, but cannot get it to work: "TypeError: Cannot read properties of undefined (reading 'InputPhotoFileLocation')"

msg.payload = {
    api: "schema",
    func: "InputPhotoFileLocation",
    args: {
        id: photo.id,
        accessHash: photo.accessHash,
        fileReference: photo.fileReference,
        thumbSize: "y"
    }
}
return msg;

Is that part of the API accessible? Is there any way to accomplish what I'm trying to do?

Thank you in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions