4 from .common
import InfoExtractor
5 from .youtube
import YoutubeTabIE
6 from ..utils
import parse_qs
, smuggle_url
, traverse_obj
9 class EmbedlyIE(InfoExtractor
):
10 _VALID_URL
= r
'https?://(?:www|cdn\.)?embedly\.com/widgets/media\.html\?(?:[^#]*?&)?(?:src|url)=(?:[^#&]+)'
12 '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',
14 'id': 'UUGLim4T2loE5rwCMdpCIPVg',
15 'modified_date': '20221225',
17 'uploader_url': 'https://www.youtube.com/@TraciHinesMusic',
18 'channel_id': 'UCGLim4T2loE5rwCMdpCIPVg',
19 'uploader': 'TraciJHines',
20 'channel_url': 'https://www.youtube.com/@TraciHinesMusic',
21 'channel': 'TraciJHines',
22 'availability': 'public',
23 'uploader_id': 'UCGLim4T2loE5rwCMdpCIPVg',
26 'title': 'Uploads from TraciJHines',
28 'playlist_mincount': 10,
30 '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',
31 'params': {'noplaylist': True},
35 'title': 'I\'m on Patreon!',
37 'categories': ['Entertainment'],
38 'thumbnail': 'https://i.ytimg.com/vi_webp/SU4fj_aEMVw/maxresdefault.webp',
39 'live_status': 'not_live',
40 'playable_in_embed': True,
41 'channel': 'TraciJHines',
42 'uploader_id': 'TraciJHines',
43 'channel_url': 'https://www.youtube.com/channel/UCGLim4T2loE5rwCMdpCIPVg',
44 'uploader_url': 'http://www.youtube.com/user/TraciJHines',
45 'upload_date': '20150211',
47 'availability': 'public',
48 'channel_follower_count': int,
52 'channel_id': 'UCGLim4T2loE5rwCMdpCIPVg',
54 'uploader': 'TraciJHines',
55 'description': 'md5:8af6425f50bd46fbf29f3db0fc3a8364',
60 'url': 'https://cdn.embedly.com/widgets/media.html?src=https://player.vimeo.com/video/1234567?h=abcdefgh',
61 'only_matching': True,
65 'url': 'http://www.permacultureetc.com/2022/12/comment-greffer-facilement-les-arbres-fruitiers.html',
69 'title': 'Comment greffer facilement les arbres fruitiers ? (mois par mois)',
70 'description': 'md5:d3a876995e522f138aabb48e040bfb4c',
72 'upload_date': '20221210',
74 'live_status': 'not_live',
75 'channel_id': 'UCsM4_jihNFYe4CtSkXvDR-Q',
76 'channel_follower_count': int,
77 'tags': ['permaculture', 'jardinage', 'dekarz', 'autonomie', 'greffe', 'fruitiers', 'arbres', 'jardin forêt', 'forêt comestible', 'damien'],
78 'playable_in_embed': True,
79 'uploader': 'permaculture agroécologie etc...',
80 'channel': 'permaculture agroécologie etc...',
81 'thumbnail': 'https://i.ytimg.com/vi/pfUK_ADTvgY/sddefault.jpg',
83 'channel_url': 'https://www.youtube.com/channel/UCsM4_jihNFYe4CtSkXvDR-Q',
85 'uploader_id': 'permacultureetc',
87 'uploader_url': 'http://www.youtube.com/user/permacultureetc',
88 'categories': ['Education'],
89 'availability': 'public',
94 def _extract_from_webpage(cls
, url
, webpage
):
95 # Bypass "ie=cls" and suitable check
96 for mobj
in re
.finditer(r
'class=["\']embedly
-card
["\'][^>]href=["\'](?P
<url
>[^
"\']+)', webpage):
97 yield cls.url_result(mobj.group('url'))
99 for mobj in re.finditer(r'class=["\']embedly
-embed
["\'][^>]src=["\'][^
"\']*url=(?P<url>[^&]+)', webpage):
100 yield cls.url_result(urllib.parse.unquote(mobj.group('url')))
102 def _real_extract(self, url):
104 src = urllib.parse.unquote(traverse_obj(qs, ('url', 0)) or '')
105 if src and YoutubeTabIE.suitable(src):
106 return self.url_result(src, YoutubeTabIE)
107 return self.url_result(smuggle_url(
108 urllib.parse.unquote(traverse_obj(qs, ('src', 0), ('url', 0))),