4 from .common
import InfoExtractor
5 from ..utils
import make_archive_id
, unescapeHTML
8 class HTML5MediaEmbedIE(InfoExtractor
):
13 'url': 'https://html.com/media/',
15 'title': 'HTML5 Media',
16 'description': 'md5:933b2d02ceffe7a7a0f3c8326d91cc2a',
22 def _extract_from_webpage(self
, url
, webpage
):
23 video_id
, title
= self
._generic
_id
(url
), self
._generic
_title
(url
, webpage
)
24 entries
= self
._parse
_html
5_media
_entries
(url
, webpage
, video_id
, m3u8_id
='hls') or []
25 for num
, entry
in enumerate(entries
, start
=1):
27 'id': f
'{video_id}-{num}',
28 'title': f
'{title} ({num})',
30 make_archive_id('generic', f
'{video_id}-{num}' if len(entries
) > 1 else video_id
),
36 class QuotedHTMLIE(InfoExtractor
):
37 """For common cases of quoted/escaped html parts in the webpage"""
39 IE_NAME
= 'generic:quoted-html'
40 IE_DESC
= False # Do not list
42 # 2 YouTube embeds in data-html
43 'url': 'https://24tv.ua/bronetransporteri-ozbroyenni-zsu-shho-vidomo-pro-bronovik-wolfhound_n2167966',
45 'id': 'bronetransporteri-ozbroyenni-zsu-shho-vidomo-pro-bronovik-wolfhound_n2167966',
46 'title': 'Броньовик Wolfhound: гігант, який допомагає ЗСУ знищувати окупантів на фронті',
47 'thumbnail': r
're:^https?://.*\.jpe?g',
50 'description': 'md5:6816e1e5a65304bd7898e4c7eb1b26f7',
55 # Generic iframe embed of TV24UAPlayerIE within data-html
56 'url': 'https://24tv.ua/harkivyani-zgaduyut-misto-do-viyni-shhemlive-video_n1887584',
60 'title': 'Харків\'яни згадують місто до війни: щемливе відео',
61 'thumbnail': r
're:^https?://.*\.jpe?g',
63 'params': {'skip_download': True}
65 # YouTube embeds on Squarespace (data-html): https://github.com/ytdl-org/youtube-dl/issues/21294
66 'url': 'https://www.harvardballetcompany.org/past-productions',
68 'id': 'past-productions',
69 'title': 'Productions — Harvard Ballet Company',
71 'description': 'Past Productions',
73 'playlist_mincount': 26
75 # Squarespace video embed, 2019-08-28, data-html
76 'url': 'http://ootboxford.com',
79 'title': 'Out of the Blue, at Childish Things 10',
81 'description': 'md5:a83d0026666cf5ee970f8bd1cfd69c7f',
82 'uploader_id': 'helendouglashouse',
83 'uploader': 'Helen & Douglas House',
84 'upload_date': '20140328',
85 'availability': 'public',
87 'channel': 'Helen & Douglas House',
89 'uploader_url': 'http://www.youtube.com/user/helendouglashouse',
91 'channel_url': 'https://www.youtube.com/channel/UCTChGezrZVmlYlpMlkmulPA',
92 'playable_in_embed': True,
94 'channel_follower_count': int,
95 'channel_id': 'UCTChGezrZVmlYlpMlkmulPA',
97 'categories': ['Nonprofits & Activism'],
99 'thumbnail': 'https://i.ytimg.com/vi/Tc7b_JGdZfw/hqdefault.jpg',
102 'skip_download': True,
106 def _extract_from_webpage(self
, url
, webpage
):
108 for _
, html
in re
.findall(r
'(?s)\bdata-html=(["\'])((?
:(?
!\
1).)+)\
1', webpage):
109 # unescapeHTML can handle " etc., unquote can handle percent encoding
110 unquoted_html = unescapeHTML(urllib.parse.unquote(html))
111 if unquoted_html != html:
112 combined += unquoted_html
114 yield from self._extract_generic_embeds(url, combined)