From a22f5301552c8ebe6f2da75565515e439f3b7148 Mon Sep 17 00:00:00 2001 From: John D Date: Wed, 30 Aug 2017 00:14:43 -0700 Subject: [PATCH 1/2] [manyvids] add new extractor --- youtube_dl/extractor/extractors.py | 1 + youtube_dl/extractor/manyvids.py | 37 ++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 youtube_dl/extractor/manyvids.py diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py index 17048fd6e..e51185300 100644 --- a/youtube_dl/extractor/extractors.py +++ b/youtube_dl/extractor/extractors.py @@ -563,6 +563,7 @@ from .mangomolo import ( MangomoloVideoIE, MangomoloLiveIE, ) +from .manyvids import ManyVidsIE from .matchtv import MatchTVIE from .mdr import MDRIE from .mediaset import MediasetIE diff --git a/youtube_dl/extractor/manyvids.py b/youtube_dl/extractor/manyvids.py new file mode 100644 index 000000000..164cc15ad --- /dev/null +++ b/youtube_dl/extractor/manyvids.py @@ -0,0 +1,37 @@ +# coding: utf-8 +from __future__ import unicode_literals + +from .common import InfoExtractor +from ..compat import compat_urllib_parse_unquote + +class ManyVidsIE(InfoExtractor): + _VALID_URL = r'https?://www.manyvids\.com/Video/(?P[0-9]+)' + _TEST = { + 'url': 'https://www.manyvids.com/Video/133957/everthing-about-me/', + 'md5': '03f11bb21c52dd12a05be21a5c7dcc97', + 'info_dict': { + 'id': '133957', + 'ext': 'mp4', + 'title': 'everthing about me', + + } + } + + def _real_extract(self, url): + formats = [] + video_id = self._match_id(url) + webpage = self._download_webpage(url, video_id) + video_url = compat_urllib_parse_unquote(self._search_regex( + r'data-video-filepath=\"(.+?)\"', webpage, 'video URL', default='')) + + title = self._html_search_regex(r'

', + webpage, 'title') + formats.append({ + 'url': video_url + }) + return { + 'id': video_id, + 'title': title, + 'formats': formats, + + } \ No newline at end of file From b722f62c1043eb178cda7e95765737a37dc97a02 Mon Sep 17 00:00:00 2001 From: John D Date: Fri, 1 Sep 2017 16:22:41 -0700 Subject: [PATCH 2/2] fixed coding conventions and enchanced regular expression for title to be more flexible --- youtube_dl/extractor/manyvids.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/youtube_dl/extractor/manyvids.py b/youtube_dl/extractor/manyvids.py index 164cc15ad..ea739ce3f 100644 --- a/youtube_dl/extractor/manyvids.py +++ b/youtube_dl/extractor/manyvids.py @@ -4,6 +4,7 @@ from __future__ import unicode_literals from .common import InfoExtractor from ..compat import compat_urllib_parse_unquote + class ManyVidsIE(InfoExtractor): _VALID_URL = r'https?://www.manyvids\.com/Video/(?P[0-9]+)' _TEST = { @@ -24,8 +25,7 @@ class ManyVidsIE(InfoExtractor): video_url = compat_urllib_parse_unquote(self._search_regex( r'data-video-filepath=\"(.+?)\"', webpage, 'video URL', default='')) - title = self._html_search_regex(r'

', - webpage, 'title') + title = self._html_search_regex(r']+class="m-a-0"[^>]*>([^<]+)', webpage, 'title') formats.append({ 'url': video_url }) @@ -33,5 +33,4 @@ class ManyVidsIE(InfoExtractor): 'id': video_id, 'title': title, 'formats': formats, - - } \ No newline at end of file + }