]>
Commit | Line | Data |
---|---|---|
1 | import re | |
2 | import urllib.parse | |
3 | from .common import InfoExtractor | |
4 | from ..compat import compat_urllib_parse_unquote | |
5 | ||
6 | ||
7 | class EmbedlyIE(InfoExtractor): | |
8 | _VALID_URL = r'https?://(?:www|cdn\.)?embedly\.com/widgets/media\.html\?(?:[^#]*?&)?url=(?P<id>[^#&]+)' | |
9 | _TESTS = [{ | |
10 | 'url': 'https://cdn.embedly.com/widgets/media.html?src=http%3A%2F%2Fwww.youtube.com%2Fembed%2Fvideoseries%3Flist%3DUUGLim4T2loE5rwCMdpCIPVg&url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DSU4fj_aEMVw%26list%3DUUGLim4T2loE5rwCMdpCIPVg&image=http%3A%2F%2Fi.ytimg.com%2Fvi%2FSU4fj_aEMVw%2Fhqdefault.jpg&key=8ee8a2e6a8cc47aab1a5ee67f9a178e0&type=text%2Fhtml&schema=youtube&autoplay=1', | |
11 | 'only_matching': True, | |
12 | }] | |
13 | ||
14 | @classmethod | |
15 | def _extract_embed_urls(cls, url, webpage): | |
16 | # Bypass suitable check | |
17 | for mobj in re.finditer(r'class=["\']embedly-card["\'][^>]href=["\'](?P<url>[^"\']+)', webpage): | |
18 | yield mobj.group('url') | |
19 | ||
20 | for mobj in re.finditer(r'class=["\']embedly-embed["\'][^>]src=["\'][^"\']*url=(?P<url>[^&]+)', webpage): | |
21 | yield urllib.parse.unquote(mobj.group('url')) | |
22 | ||
23 | def _real_extract(self, url): | |
24 | return self.url_result(compat_urllib_parse_unquote(self._match_id(url))) |