aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl
diff options
context:
space:
mode:
authorTRox1972 <TRox1972@users.noreply.github.com>2016-05-21 17:48:17 +0200
committerSergey M․ <dstftw@gmail.com>2016-06-04 16:48:24 +0700
commit7def35712a7047578643f18eaf6dda79fd8c9291 (patch)
tree70316290cbbfe2c0c46a489d1788d70217a52d57 /youtube_dl
parentcad88f96dc8eaa845a458f0b80e92c1ba36c5491 (diff)
[vidio] Add extractor (Closes #7195)
[Vidio] fix fallback value and wrap duration in int_or_none [Vidio] don't use video_id for _html_search_regex()
Diffstat (limited to 'youtube_dl')
-rw-r--r--youtube_dl/extractor/extractors.py1
-rw-r--r--youtube_dl/extractor/vidio.py48
2 files changed, 49 insertions, 0 deletions
diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py
index 3b5143ace..ed4e39574 100644
--- a/youtube_dl/extractor/extractors.py
+++ b/youtube_dl/extractor/extractors.py
@@ -910,6 +910,7 @@ from .videomore import (
)
from .videopremium import VideoPremiumIE
from .videott import VideoTtIE
+from .vidio import VidioIE
from .vidme import (
VidmeIE,
VidmeUserIE,
diff --git a/youtube_dl/extractor/vidio.py b/youtube_dl/extractor/vidio.py
new file mode 100644
index 000000000..d17c663fd
--- /dev/null
+++ b/youtube_dl/extractor/vidio.py
@@ -0,0 +1,48 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+from .common import InfoExtractor
+
+from ..utils import int_or_none
+
+
+class VidioIE(InfoExtractor):
+ _VALID_URL = r'https?://(?:www\.)?vidio\.com/watch/(?P<id>\d{6})-(?P<display_id>[^/?]+)'
+ _TEST = {
+ 'url': 'http://www.vidio.com/watch/165683-dj_ambred-booyah-live-2015',
+ 'info_dict': {
+ 'id': '165683',
+ 'title': 'DJ_AMBRED - Booyah (Live 2015)',
+ 'ext': 'mp4',
+ 'thumbnail': 'https://cdn0-a.production.vidio.static6.com/uploads/video/image/165683/dj_ambred-booyah-live-2015-bfb2ba.jpg',
+ 'description': 'md5:27dc15f819b6a78a626490881adbadf8',
+ 'duration': 149,
+ },
+ 'params': {
+ # m3u8 download
+ 'skip_download': True
+ }
+ }
+
+ def _real_extract(self, url):
+ mobj = re.match(self._VALID_URL, url)
+ video_id, display_id = mobj.group('id', 'display_id')
+
+ webpage = self._download_webpage(url, display_id)
+
+ video_data = self._parse_json(self._html_search_regex(
+ r'data-json-clips\s*=\s*"\[(.+)\]"', webpage, 'video data'), display_id)
+
+ formats = self._extract_m3u8_formats(
+ video_data['sources'][0]['file'],
+ display_id, ext='mp4')
+
+ return {
+ 'id': video_id,
+ 'title': self._og_search_title(webpage),
+ 'formats': formats,
+ 'thumbnail': video_data.get('image'),
+ 'description': self._og_search_description(webpage),
+ 'duration': int_or_none(video_data.get('clip_duration')),
+ }