]> jfr.im git - yt-dlp.git/blame - yt_dlp/extractor/unity.py
[ie/getcourseru] Add extractors (#8873)
[yt-dlp.git] / yt_dlp / extractor / unity.py
CommitLineData
ca1c9f26
PV
1from .common import InfoExtractor
2from .youtube import YoutubeIE
3
4
5class UnityIE(InfoExtractor):
6 _VALID_URL = r'https?://(?:www\.)?unity3d\.com/learn/tutorials/(?:[^/]+/)*(?P<id>[^/?#&]+)'
7 _TESTS = [{
8 'url': 'https://unity3d.com/learn/tutorials/topics/animation/animate-anything-mecanim',
9 'info_dict': {
10 'id': 'jWuNtik0C8E',
11 'ext': 'mp4',
12 'title': 'Live Training 22nd September 2014 - Animate Anything',
13 'description': 'md5:e54913114bd45a554c56cdde7669636e',
14 'duration': 2893,
15 'uploader': 'Unity',
16 'uploader_id': 'Unity3D',
17 'upload_date': '20140926',
18 }
19 }, {
20 'url': 'https://unity3d.com/learn/tutorials/projects/2d-ufo-tutorial/following-player-camera?playlist=25844',
21 'only_matching': True,
22 }]
23
24 def _real_extract(self, url):
25 video_id = self._match_id(url)
26 webpage = self._download_webpage(url, video_id)
27 youtube_id = self._search_regex(
28 r'data-video-id="([_0-9a-zA-Z-]+)"',
29 webpage, 'youtube ID')
30 return self.url_result(youtube_id, ie=YoutubeIE.ie_key(), video_id=video_id)