[Unity] Add new extractor
This commit is contained in:
parent
9bb2c7673e
commit
f1a5b546e8
@ -1138,6 +1138,7 @@ from .udn import UDNEmbedIE
|
|||||||
from .uktvplay import UKTVPlayIE
|
from .uktvplay import UKTVPlayIE
|
||||||
from .digiteka import DigitekaIE
|
from .digiteka import DigitekaIE
|
||||||
from .unistra import UnistraIE
|
from .unistra import UnistraIE
|
||||||
|
from .unity import UnityIE
|
||||||
from .uol import UOLIE
|
from .uol import UOLIE
|
||||||
from .uplynk import (
|
from .uplynk import (
|
||||||
UplynkIE,
|
UplynkIE,
|
||||||
|
35
youtube_dl/extractor/unity.py
Normal file
35
youtube_dl/extractor/unity.py
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
from .youtube import YoutubeIE
|
||||||
|
from ..utils import (
|
||||||
|
ExtractorError
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class UnityIE(InfoExtractor):
|
||||||
|
_VALID_URL = r'https?://(?:www\.)?unity3d\.com/learn/tutorials/(?:.*)/(?P<id>[0-9a-zA-Z-]+)'
|
||||||
|
_TEST = {
|
||||||
|
'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:7752f2b827ce39a5acc648b53593dfbf',
|
||||||
|
'duration': 2893,
|
||||||
|
'uploader': 'Unity',
|
||||||
|
'uploader_id': 'Unity3D',
|
||||||
|
'upload_date': '20140926',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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', default=None)
|
||||||
|
if not youtube_id:
|
||||||
|
raise ExtractorError('Unable to extract youtube ID', expected=True)
|
||||||
|
youtube_url = 'https://youtu.be/%s' % youtube_id
|
||||||
|
return self.url_result(youtube_url, ie=YoutubeIE.ie_key())
|
Loading…
x
Reference in New Issue
Block a user