diff options
| author | Orn <orngudjonsson@gmail.com> | 2017-06-15 22:29:27 +0000 | 
|---|---|---|
| committer | Sergey M․ <dstftw@gmail.com> | 2017-06-19 23:45:45 +0700 | 
| commit | a1de83e5f01cc220fa45caee80b9159cc555609d (patch) | |
| tree | 93661fbf2b5a1ba90ae795691b9cbc1ce6030461 /youtube_dl/extractor/ruv.py | |
| parent | fee00b3884922f6cb44926349df788d0fc589811 (diff) | |
[ruv] Add extractor
Diffstat (limited to 'youtube_dl/extractor/ruv.py')
| -rw-r--r-- | youtube_dl/extractor/ruv.py | 31 | 
1 files changed, 31 insertions, 0 deletions
| diff --git a/youtube_dl/extractor/ruv.py b/youtube_dl/extractor/ruv.py new file mode 100644 index 000000000..518fb5027 --- /dev/null +++ b/youtube_dl/extractor/ruv.py @@ -0,0 +1,31 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor + + +class RuvIE(InfoExtractor): +    _VALID_URL = r'https?://(?:www\.)?ruv\.is/sarpurinn/ruv/\w+/(?P<id>[0-9]+)' +    _TEST = { +        'url': 'http://ruv.is/sarpurinn/ruv/frettir/20170614', +        'md5': 'a07ea1ebaba64082d90323b1c96f264b', +        'info_dict': { +            'id': '20170614', +            'ext': 'mp4', +            'title': 'Fréttir', +        } +    } + +    def _real_extract(self, url): +        video_id = self._match_id(url) +        webpage = self._download_webpage(url, video_id) + +        title = self._og_search_title(webpage) +        video_url = self._html_search_regex(r'video\.src\s*=\s*["\'](.+?)["\']', webpage, 'video URL') + +        return { +            'id': video_id, +            'title': title, +            'url': video_url, +            'ext': 'mp4' +        } | 
