about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJohn D <jdong1992@gmail.com>2017-08-30 00:14:43 -0700
committerSergey M․ <dstftw@gmail.com>2017-09-03 17:31:53 +0700
commite9b865267aaa90e3b9e1b0468d20a4df31e13393 (patch)
treebea1a6c8cc4e70c0ab1aa88a39b9f91061a0fc78
parentbc35f075370ed1e67fe71c544e6243a2fc4fa430 (diff)
downloadyoutube-dl-e9b865267aaa90e3b9e1b0468d20a4df31e13393.tar.gz
youtube-dl-e9b865267aaa90e3b9e1b0468d20a4df31e13393.tar.xz
youtube-dl-e9b865267aaa90e3b9e1b0468d20a4df31e13393.zip
[manyvids] Add support for preview videos (closes #14053)
-rw-r--r--youtube_dl/extractor/extractors.py1
-rw-r--r--youtube_dl/extractor/manyvids.py36
2 files changed, 37 insertions, 0 deletions
diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py
index d335f9fff..46a11f3ef 100644
--- a/youtube_dl/extractor/extractors.py
+++ b/youtube_dl/extractor/extractors.py
@@ -564,6 +564,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..ea739ce3f
--- /dev/null
+++ b/youtube_dl/extractor/manyvids.py
@@ -0,0 +1,36 @@
+# 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<id>[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'<h2[^>]+class="m-a-0"[^>]*>([^<]+)', webpage, 'title')
+        formats.append({
+            'url': video_url
+        })
+        return {
+            'id': video_id,
+            'title': title,
+            'formats': formats,
+        }