]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/telegram.py
1 from .common
import InfoExtractor
4 class TelegramEmbedIE(InfoExtractor
):
5 IE_NAME
= 'telegram:embed'
6 _VALID_URL
= r
'https?://t\.me/(?P<channel_name>[^/]+)/(?P<id>\d+)'
8 'url': 'https://t.me/europa_press/613',
12 'title': 'Europa Press',
13 'description': '6ce2d7e8d56eda16d80607b23db7b252',
14 'thumbnail': r
're:^https?:\/\/cdn.*?telesco\.pe\/file\/\w+',
18 def _real_extract(self
, url
):
19 video_id
= self
._match
_id
(url
)
20 webpage
= self
._download
_webpage
(url
, video_id
)
21 webpage_embed
= self
._download
_webpage
(f
'{url}?embed=1', video_id
)
24 'url': self
._proto
_relative
_url
(self
._search
_regex
(
25 '<video[^>]+src="([^"]+)"', webpage_embed
, 'source')),
28 self
._sort
_formats
(formats
)
32 'title': self
._html
_search
_meta
(['og:title', 'twitter:title'], webpage
, fatal
=True),
33 'description': self
._html
_search
_meta
(['og:description', 'twitter:description'], webpage
, fatal
=True),
34 'thumbnail': self
._search
_regex
(r
'tgme_widget_message_video_thumb"[^>]+background-image:url\(\'([^
\']+)\'\
)',
35 webpage_embed, 'thumbnail
'),