Page author
The source for this is unknown, seems to be custom-made for services like Twitter.
In official apps this seems to be used as a fallback for description.
Page description
Usually defined by description
or og:description
meta tag
URL to be displayed to the user.
Usually a normal URL with stripped protocol and garbage.
Document inside this webpage preview.
Seems that this is only used for document
previews.
Height of the embed in pixels, 0 if not available.
Embed type.
Now this is actually stupid.
As per official documentation,
embed_type
contains «MIME type of the embedded preview, (e.g., text/html or video/mp4)».
But in fact every time I encountered it it contained a simple string iframe
.
I couldn't find any usage of this field in official apps either.
The embed URL.
Based on my research, Telegram only allows embedding pages from a server-side white-list of domains.
That is, you can't just copy-paste meta tags from YouTube to your own domain and expect Telegram to return a webpage with embed.
IDK why is that, maybe they are concerned about leaking users' IPs to 3rd parties or something (but why allow embedding in the first place then?)
Telegram for Android does not show "play" button for webpages without embeds, and instead treats it like a simple photo (why?).
TDesktop does not support embeds and seems
to use type to determine them, and specifically
checks
for YouTube
in siteName to display YouTube icon.
Width of the embed in pixels, 0 if not available.
Input media TL object generated from this object, to be used inside InputMediaLike and TelegramClient.sendMedia.
WebPage can't provide an input media, since some
can only be auto-generated from a link. This getter
is only provided to allow using msg.media.inputMedia
Type of the preview, taken directly from TL object
Officially documented are:
article, photo, audio, video, document, profile, app
,
but also these are encountered:
telegram_user, telegram_bot, telegram_channel, telegram_megagroup, telegram_story
:
telegram_*
ones seem to be used for t.me
links.article
seems to be used for almost all custom pages with og:*
tagsphoto
, audio
and video
seem to be derived from og:type
,
and the page itself may contain a preview photo and an embed link
for the player. This may not correctly represent actual content type:
Spotify links are audio
, but SoundCloud are video
. YouTube links are video
,
but tweets with video are photo
.document
seem to be used for files downloadable directly from the URL,
like PDFs, audio files, videos, etc. document seem to be
present if type
is document
.profile
doesn't seem to be usedapp
doesn't seem to be usedunknown
is returned if no type is returned in the TL object.
Page title
Usually defined by og:site_name
meta tag or website domain
Page title
Usually defined by og:title
meta tag or <title>
tag
Original page URL
Web page preview.
Warning: Documentation of this class also contains my personal research about how Telegram handles different pages and embeds. By no means this should be considered the definitive source of truth, as this is not documented officially, and only consists of my own observations and experiments.