diff options
author | Parmjit Virk <pvirk@mts.net> | 2017-10-18 16:46:06 -0500 |
---|---|---|
committer | Sergey M <dstftw@gmail.com> | 2017-10-19 04:46:06 +0700 |
commit | ca1c9f26fa8277c0ea75c1d91a74f454cc9aaac5 (patch) | |
tree | 68615ee3806faa4c136b6cc9ba3bc5506bb772ae /youtube_dl/extractor/unity.py | |
parent | 6f3b4a98c96c54eb0e3933b3cd6b4e6848582a02 (diff) |
[unity] Add extractor (fixes #14528)
Diffstat (limited to 'youtube_dl/extractor/unity.py')
-rw-r--r-- | youtube_dl/extractor/unity.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/youtube_dl/extractor/unity.py b/youtube_dl/extractor/unity.py new file mode 100644 index 000000000..73daacf29 --- /dev/null +++ b/youtube_dl/extractor/unity.py @@ -0,0 +1,32 @@ +from __future__ import unicode_literals + +from .common import InfoExtractor +from .youtube import YoutubeIE + + +class UnityIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?unity3d\.com/learn/tutorials/(?:[^/]+/)*(?P<id>[^/?#&]+)' + _TESTS = [{ + 'url': 'https://unity3d.com/learn/tutorials/topics/animation/animate-anything-mecanim', + 'info_dict': { + 'id': 'jWuNtik0C8E', + 'ext': 'mp4', + 'title': 'Live Training 22nd September 2014 - Animate Anything', + 'description': 'md5:e54913114bd45a554c56cdde7669636e', + 'duration': 2893, + 'uploader': 'Unity', + 'uploader_id': 'Unity3D', + 'upload_date': '20140926', + } + }, { + 'url': 'https://unity3d.com/learn/tutorials/projects/2d-ufo-tutorial/following-player-camera?playlist=25844', + 'only_matching': True, + }] + + def _real_extract(self, url): + video_id = self._match_id(url) + webpage = self._download_webpage(url, video_id) + youtube_id = self._search_regex( + r'data-video-id="([_0-9a-zA-Z-]+)"', + webpage, 'youtube ID') + return self.url_result(youtube_id, ie=YoutubeIE.ie_key(), video_id=video_id) |