diff options
| author | Remita Amine <remitamine@gmail.com> | 2016-11-03 12:50:25 +0100 | 
|---|---|---|
| committer | Remita Amine <remitamine@gmail.com> | 2016-11-03 12:50:41 +0100 | 
| commit | b47ecd0b74010cdd4b16049c33ef048b72cf6207 (patch) | |
| tree | 501e414eff7d128c6dace5b796620c18daf59acb | |
| parent | 3a86b2c51e508c11502fcf7b74c470c68fd5bcd6 (diff) | |
[vzaar] Add new extractor(closes #11093)
| -rw-r--r-- | youtube_dl/extractor/extractors.py | 1 | ||||
| -rw-r--r-- | youtube_dl/extractor/vzaar.py | 55 | 
2 files changed, 56 insertions, 0 deletions
diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py index f30ac5aaf..499239a22 100644 --- a/youtube_dl/extractor/extractors.py +++ b/youtube_dl/extractor/extractors.py @@ -1101,6 +1101,7 @@ from .vrt import VRTIE  from .vube import VubeIE  from .vuclip import VuClipIE  from .vyborymos import VyboryMosIE +from .vzaar import VzaarIE  from .walla import WallaIE  from .washingtonpost import (      WashingtonPostIE, diff --git a/youtube_dl/extractor/vzaar.py b/youtube_dl/extractor/vzaar.py new file mode 100644 index 000000000..b270f08d1 --- /dev/null +++ b/youtube_dl/extractor/vzaar.py @@ -0,0 +1,55 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor +from ..utils import ( +    int_or_none, +    float_or_none, +) + + +class VzaarIE(InfoExtractor): +    _VALID_URL = r'https?://(?:(?:www|view)\.)?vzaar\.com/(?:videos/)?(?P<id>\d+)' +    _TESTS = [{ +        'url': 'https://vzaar.com/videos/1152805', +        'md5': 'bde5ddfeb104a6c56a93a06b04901dbf', +        'info_dict': { +            'id': '1152805', +            'ext': 'mp4', +            'title': 'sample video (public)', +        }, +    }, { +        'url': 'https://view.vzaar.com/27272/player', +        'md5': '3b50012ac9bbce7f445550d54e0508f2', +        'info_dict': { +            'id': '27272', +            'ext': 'mp3', +            'title': 'MP3', +        }, +    }] + +    def _real_extract(self, url): +        video_id = self._match_id(url) +        video_data = self._download_json( +            'http://view.vzaar.com/v2/%s/video' % video_id, video_id) +        source_url = video_data['sourceUrl'] + +        info = { +            'id': video_id, +            'title': video_data['videoTitle'], +            'url': source_url, +            'thumbnail': self._proto_relative_url(video_data.get('poster')), +            'duration': float_or_none(video_data.get('videoDuration')), +        } +        if 'audio' in source_url: +            info.update({ +                'vcodec': 'none', +                'ext': 'mp3', +            }) +        else: +            info.update({ +                'width': int_or_none(video_data.get('width')), +                'height': int_or_none(video_data.get('height')), +                'ext': 'mp4', +            }) +        return info  | 
