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