From 9834e0818198c7df8e6642434225099f0ffab3ee Mon Sep 17 00:00:00 2001 From: slocum Date: Sun, 26 Feb 2017 12:22:22 +0100 Subject: [PATCH] [vshare.io] new extractor --- youtube_dl/extractor/extractors.py | 1 + youtube_dl/extractor/vshare.py | 36 ++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 youtube_dl/extractor/vshare.py diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py index 40a5c9842..6bfb4314b 100644 --- a/youtube_dl/extractor/extractors.py +++ b/youtube_dl/extractor/extractors.py @@ -1177,6 +1177,7 @@ from .vporn import VpornIE from .vrt import VRTIE from .vrak import VrakIE from .medialaan import MedialaanIE +from .vshare import VShareIE from .vube import VubeIE from .vuclip import VuClipIE from .vvvvid import VVVVIDIE diff --git a/youtube_dl/extractor/vshare.py b/youtube_dl/extractor/vshare.py new file mode 100644 index 000000000..5ddcedceb --- /dev/null +++ b/youtube_dl/extractor/vshare.py @@ -0,0 +1,36 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor + + +class VShareIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?vshare\.io/(?:(?:d)|(?Pv))/(?P.+)(?(v)/width-\d+/height-\d+/\d+)' + _TESTS = [{ + 'url': 'https://vshare.io/d/0f64ce6', + 'md5': '16d7b8fef58846db47419199ff1ab3e7', + 'info_dict': { + 'id': '0f64ce6', + 'title': 'vl14062007715967', + 'ext': 'mp4', + } + }, { + 'url': 'https://vshare.io/v/0f64ce6/width-650/height-430/1', + 'only_matching': True, + }] + + def _real_extract(self, url): + video_id = self._match_id(url) + i = url.find('/v/') + if not i == -1: + url = url[:i] + '/d/' + video_id + webpage = self._download_webpage(url, video_id) + + title = self._html_search_regex(r'
\s*
]+>\s*(.+?)
', webpage, 'title') + video_url = self._search_regex(r']+href="(https?://s\d+\.vshare\.io/download.+?)">Click here', webpage, 'video url') + + return { + 'id': video_id, + 'title': title, + 'url': video_url, + }