Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to retrieve media #9

Open
regystro opened this issue Dec 16, 2024 · 1 comment
Open

Unable to retrieve media #9

regystro opened this issue Dec 16, 2024 · 1 comment

Comments

@regystro
Copy link

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.

@windkh
Copy link
Owner

windkh commented Dec 16, 2024

Did you try one of the examples yet?

You can not use something from gramjs here... it wont simply work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants