mirror of
https://github.com/yt-dlp/yt-dlp
synced 2024-12-29 22:24:25 +01:00
86e5f3ed2e
Using https://github.com/asottile/pyupgrade 1. `__future__` imports and `coding: utf-8` were removed 2. Files were rewritten with `pyupgrade --py36-plus --keep-percent-format` 3. f-strings were cherry-picked from `pyupgrade --py36-plus` Extractors are left untouched (except removing header) to avoid unnecessary merge conflicts
30 lines
1.2 KiB
Python
30 lines
1.2 KiB
Python
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)
|