diff options
author | TRox1972 <TRox1972@users.noreply.github.com> | 2016-06-12 03:18:56 +0200 |
---|---|---|
committer | Sergey M․ <dstftw@gmail.com> | 2016-06-26 16:52:52 +0700 |
commit | 3c9c088f9c51cce86d3df878feba1884c0234df5 (patch) | |
tree | cb4723ac07c81549ae1119292c53660d662455ed /youtube_dl | |
parent | fc3996bfe15deae02f4d8f1f4dc34a89fb8bfb03 (diff) |
[Vidbit] Add new extractor
Diffstat (limited to 'youtube_dl')
-rw-r--r-- | youtube_dl/extractor/extractors.py | 1 | ||||
-rw-r--r-- | youtube_dl/extractor/vidbit.py | 36 |
2 files changed, 37 insertions, 0 deletions
diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py index 9f98a1490..5ccac7c0c 100644 --- a/youtube_dl/extractor/extractors.py +++ b/youtube_dl/extractor/extractors.py @@ -916,6 +916,7 @@ from .vice import ( ViceIE, ViceShowIE, ) +from .vidbit import VidbitIE from .viddler import ViddlerIE from .videodetective import VideoDetectiveIE from .videofyme import VideofyMeIE diff --git a/youtube_dl/extractor/vidbit.py b/youtube_dl/extractor/vidbit.py new file mode 100644 index 000000000..39d508962 --- /dev/null +++ b/youtube_dl/extractor/vidbit.py @@ -0,0 +1,36 @@ +# coding: utf-8 +from __future__ import unicode_literals + +import re + +from .common import InfoExtractor +from ..utils import url_basename +from ..compat import compat_urlparse + + +class VidbitIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?vidbit\.co/watch\?v=(?P<id>[\w-]+)' + _TEST = { + 'url': 'http://www.vidbit.co/watch?v=MrM7LeaMJq', + 'md5': 'f1a579a93282a78de7e1c53220ef0f12', + 'info_dict': { + 'id': 'MrM7LeaMJq', + 'ext': 'mp4', + 'title': 'RoboCop (1987) - Dick You\'re Fired', + 'thumbnail': 'http://www.vidbit.co/thumbnails/MrM7LeaMJq.jpg', + } + } + + def _real_extract(self, url): + video_id = self._match_id(url) + webpage = self._download_webpage(url, video_id) + + return { + 'id': video_id, + 'title': self._html_search_regex(r'<h1>(.+)</h1>', webpage, 'title'), + 'url': compat_urlparse.urljoin(url, self._html_search_regex(r'file:\s*(["\'])((?:(?!\1).)+)\1', + webpage, 'video URL', group=2)), + 'thumbnail': self._og_search_thumbnail(webpage), + 'description': self._html_search_regex(r'description:(["\'])((?:(?!\1).)+)\1', + webpage, 'description', None, group=2), + } |