Skip to content

Extract timestamp in t.me? #31

@Te-k

Description

@Te-k

Has anyone looked at how to extract timestamps from t.me? I thought it would be trivial as the time is very obvious:

<a class="tgme_widget_message_date" href="https://t.me/URL">
<time datetime="2026-01-15T18:03:17+00:00" class="datetime">Jan 15 at 13:03</time>
</a>

But it turns out the full content of the message is actually in an iframe:

<iframe id="telegram-post-VahidOnline-69929" src="https://t.me/URL?embed=1&amp;mode=tme" width="100%" height="" frameborder="0" scrolling="no" style="overflow: hidden; color-scheme: light dark; border: none; min-width: 320px; height: 818px;"></iframe>

I am not sure if we can attach to an element in the iframe with the current fixer., I tried something like this, it gets the timestamp but doesn't show anything:

const fixer = new Fixer('Telegram', [
  {
    name: 'Post Timestamps',
    selector: 'iframe',
    attachTo: node => node.contentWindow.document.body.querySelectorAll('a.tgme_widget_message_date')[0],
    timestamp: node => node.contentWindow.document.body.querySelectorAll('a.tgme_widget_message_date')[0].firstChild.getAttribute('datetime'),
    url: node => node.contentWindow.document.body.querySelectorAll('a.tgme_widget_message_date')[0].href,
  },
]);

Has anyone looked into this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions