From 4fad2788c3239147a67ee40dff7896f3bd6880ed Mon Sep 17 00:00:00 2001 From: theGeekPirate Date: Sat, 26 Mar 2016 05:37:40 -0700 Subject: [PATCH 1/6] [camwithher] Added new extractor --- youtube_dl/extractor/__init__.py | 1 + youtube_dl/extractor/camwithher.py | 65 ++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 youtube_dl/extractor/camwithher.py diff --git a/youtube_dl/extractor/__init__.py b/youtube_dl/extractor/__init__.py index 1e4b078a4..2cf6c4e63 100644 --- a/youtube_dl/extractor/__init__.py +++ b/youtube_dl/extractor/__init__.py @@ -95,6 +95,7 @@ from .camdemy import ( CamdemyIE, CamdemyFolderIE ) +from .camwithher import CamWithHerIE from .canalplus import CanalplusIE from .canalc2 import Canalc2IE from .canvas import CanvasIE diff --git a/youtube_dl/extractor/camwithher.py b/youtube_dl/extractor/camwithher.py new file mode 100644 index 000000000..1932adea3 --- /dev/null +++ b/youtube_dl/extractor/camwithher.py @@ -0,0 +1,65 @@ +from __future__ import unicode_literals + +from .common import InfoExtractor + + +class CamWithHerIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?camwithher\.tv/view_video\.php\?viewkey=*' + + _TESTS = [ + { + 'url': 'http://camwithher.tv/view_video.php?viewkey=6e9a24e2c0e842e1f177&page=&viewtype=&category=', + 'info_dict': { + 'id': '5644', + 'ext': 'mp4', + 'title': 'Periscope Tease', + }, + 'params': { + 'skip_download': True, + } + }, + { + 'url': 'http://camwithher.tv/view_video.php?viewkey=6dfd8b7c97531a459937', + 'info_dict': { + 'id': '5642', + 'ext': 'mp4', + 'title': 'Carmen Bella Tease', + }, + 'params': { + 'skip_download': True, + } + }, + { + 'url': 'http://camwithher.tv/view_video.php?viewkey=b6c3b5bea9515d1a1fc4&page=&viewtype=&category=mv', + 'info_dict': { + 'id': '758', + 'ext': 'flv', + 'title': 'Gisele in the Bath', + }, + 'params': { + 'skip_download': True, + } + }, + ] + + def _real_extract(self, url): + url = self._download_webpage(url, '') + + video_id = self._html_search_regex(r'\s+

(.+?)

', url, 'title') + + return { + 'id': video_id, + 'url': rtmp_url, + 'no_resume': True, + 'ext': ext, + 'title': title, + } From 982246052e3d25ea5e1db904e75dd8eb17976a73 Mon Sep 17 00:00:00 2001 From: theGeekPirate Date: Sat, 26 Mar 2016 14:36:39 -0700 Subject: [PATCH 2/6] Corrected unnecessary test --- youtube_dl/extractor/camwithher.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/youtube_dl/extractor/camwithher.py b/youtube_dl/extractor/camwithher.py index 1932adea3..b12e39ed2 100644 --- a/youtube_dl/extractor/camwithher.py +++ b/youtube_dl/extractor/camwithher.py @@ -20,14 +20,7 @@ class CamWithHerIE(InfoExtractor): }, { 'url': 'http://camwithher.tv/view_video.php?viewkey=6dfd8b7c97531a459937', - 'info_dict': { - 'id': '5642', - 'ext': 'mp4', - 'title': 'Carmen Bella Tease', - }, - 'params': { - 'skip_download': True, - } + 'only_matching': True, }, { 'url': 'http://camwithher.tv/view_video.php?viewkey=b6c3b5bea9515d1a1fc4&page=&viewtype=&category=mv', From 7f9994ad0490a212690ea3aae9204bc59cdec040 Mon Sep 17 00:00:00 2001 From: theGeekPirate Date: Sat, 26 Mar 2016 14:47:06 -0700 Subject: [PATCH 3/6] Sane variable naming --- youtube_dl/extractor/camwithher.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/youtube_dl/extractor/camwithher.py b/youtube_dl/extractor/camwithher.py index b12e39ed2..1eb80b7f1 100644 --- a/youtube_dl/extractor/camwithher.py +++ b/youtube_dl/extractor/camwithher.py @@ -36,9 +36,9 @@ class CamWithHerIE(InfoExtractor): ] def _real_extract(self, url): - url = self._download_webpage(url, '') + webpage = self._download_webpage(url, '') - video_id = self._html_search_regex(r'
2010: rtmp_url = 'rtmp://camwithher.tv/clipshare/mp4:' + video_id + '.mp4' @@ -47,7 +47,7 @@ class CamWithHerIE(InfoExtractor): rtmp_url = 'rtmp://camwithher.tv/clipshare/' + video_id ext = 'flv' - title = self._html_search_regex(r'
\s+

(.+?)

', url, 'title') + title = self._html_search_regex(r'
\s+

(.+?)

', webpage, 'title') return { 'id': video_id, From 75cb2fe4a1f3347c4ae9b8ca043f3c150d4f378f Mon Sep 17 00:00:00 2001 From: theGeekPirate Date: Sat, 26 Mar 2016 20:12:26 -0700 Subject: [PATCH 4/6] RTMP all .flv & url_id for _download_webpage() --- youtube_dl/extractor/camwithher.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/youtube_dl/extractor/camwithher.py b/youtube_dl/extractor/camwithher.py index 1eb80b7f1..fa4ec351f 100644 --- a/youtube_dl/extractor/camwithher.py +++ b/youtube_dl/extractor/camwithher.py @@ -4,7 +4,7 @@ from .common import InfoExtractor class CamWithHerIE(InfoExtractor): - _VALID_URL = r'https?://(?:www\.)?camwithher\.tv/view_video\.php\?viewkey=*' + _VALID_URL = r'https?://(?:www\.)?camwithher\.tv/view_video\.php\?viewkey=(?P\w+).*' _TESTS = [ { @@ -36,16 +36,16 @@ class CamWithHerIE(InfoExtractor): ] def _real_extract(self, url): - webpage = self._download_webpage(url, '') + url_id = self._match_id(url) + + webpage = self._download_webpage(url, url_id) video_id = self._html_search_regex(r'
\s+

(.+?)

', webpage, 'title') @@ -53,6 +53,6 @@ class CamWithHerIE(InfoExtractor): 'id': video_id, 'url': rtmp_url, 'no_resume': True, - 'ext': ext, + 'ext': 'flv', 'title': title, } From 2be5f5fd219033ed3c2d6bc08cb552d7191dfef9 Mon Sep 17 00:00:00 2001 From: theGeekPirate Date: Sat, 26 Mar 2016 21:19:37 -0700 Subject: [PATCH 5/6] Corrected all outstanding issues, next up is a squash! --- youtube_dl/extractor/camwithher.py | 35 ++++++++++++++---------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/youtube_dl/extractor/camwithher.py b/youtube_dl/extractor/camwithher.py index fa4ec351f..eb0a4ec56 100644 --- a/youtube_dl/extractor/camwithher.py +++ b/youtube_dl/extractor/camwithher.py @@ -4,14 +4,14 @@ from .common import InfoExtractor class CamWithHerIE(InfoExtractor): - _VALID_URL = r'https?://(?:www\.)?camwithher\.tv/view_video\.php\?viewkey=(?P\w+).*' + _VALID_URL = r'https?://(?:www\.)?camwithher\.tv/view_video\.php\?.*viewkey=(?P\w+)' _TESTS = [ { 'url': 'http://camwithher.tv/view_video.php?viewkey=6e9a24e2c0e842e1f177&page=&viewtype=&category=', 'info_dict': { 'id': '5644', - 'ext': 'mp4', + 'ext': 'flv', 'title': 'Periscope Tease', }, 'params': { @@ -23,34 +23,31 @@ class CamWithHerIE(InfoExtractor): 'only_matching': True, }, { - 'url': 'http://camwithher.tv/view_video.php?viewkey=b6c3b5bea9515d1a1fc4&page=&viewtype=&category=mv', - 'info_dict': { - 'id': '758', - 'ext': 'flv', - 'title': 'Gisele in the Bath', - }, - 'params': { - 'skip_download': True, - } + 'url': 'http://camwithher.tv/view_video.php?page=&viewkey=6e9a24e2c0e842e1f177&viewtype=&category=', + 'only_matching': True, }, + { + 'url': 'http://camwithher.tv/view_video.php?viewkey=b6c3b5bea9515d1a1fc4&page=&viewtype=&category=mv', + 'only_matching': True, + } ] def _real_extract(self, url): - url_id = self._match_id(url) + video_id = self._match_id(url) - webpage = self._download_webpage(url, url_id) + webpage = self._download_webpage(url, video_id) - video_id = self._html_search_regex(r'
2010: - rtmp_url = 'rtmp://camwithher.tv/clipshare/mp4:' + video_id + '.mp4' - else: - rtmp_url = 'rtmp://camwithher.tv/clipshare/' + video_id + # The number "2010" was reverse-engineered from cwhplayer.swf. + # It appears that they changed their video codec, and hence the RTMP URL + # scheme at that video's ID. + rtmp_url = 'rtmp://camwithher.tv/clipshare/%s' % (('mp4:%s.mp4' % flv_id) if int(flv_id) > 2010 else flv_id) title = self._html_search_regex(r'
\s+

(.+?)

', webpage, 'title') return { - 'id': video_id, + 'id': flv_id, 'url': rtmp_url, 'no_resume': True, 'ext': 'flv', From 7109ffe358a64e5f5ff5460c8e1775acfa27051d Mon Sep 17 00:00:00 2001 From: theGeekPirate Date: Sat, 26 Mar 2016 05:37:40 -0700 Subject: [PATCH 6/6] [camwithher] Added new extractor Corrected unnecessary test Sane variable naming RTMP all .flv & url_id for _download_webpage() Corrected all outstanding issues, next up is a squash! [camwithher] Added new extractor, commits squashed. --- youtube_dl/extractor/__init__.py | 1 + youtube_dl/extractor/camwithher.py | 55 ++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 youtube_dl/extractor/camwithher.py diff --git a/youtube_dl/extractor/__init__.py b/youtube_dl/extractor/__init__.py index 1e4b078a4..2cf6c4e63 100644 --- a/youtube_dl/extractor/__init__.py +++ b/youtube_dl/extractor/__init__.py @@ -95,6 +95,7 @@ from .camdemy import ( CamdemyIE, CamdemyFolderIE ) +from .camwithher import CamWithHerIE from .canalplus import CanalplusIE from .canalc2 import Canalc2IE from .canvas import CanvasIE diff --git a/youtube_dl/extractor/camwithher.py b/youtube_dl/extractor/camwithher.py new file mode 100644 index 000000000..eb0a4ec56 --- /dev/null +++ b/youtube_dl/extractor/camwithher.py @@ -0,0 +1,55 @@ +from __future__ import unicode_literals + +from .common import InfoExtractor + + +class CamWithHerIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?camwithher\.tv/view_video\.php\?.*viewkey=(?P\w+)' + + _TESTS = [ + { + 'url': 'http://camwithher.tv/view_video.php?viewkey=6e9a24e2c0e842e1f177&page=&viewtype=&category=', + 'info_dict': { + 'id': '5644', + 'ext': 'flv', + 'title': 'Periscope Tease', + }, + 'params': { + 'skip_download': True, + } + }, + { + 'url': 'http://camwithher.tv/view_video.php?viewkey=6dfd8b7c97531a459937', + 'only_matching': True, + }, + { + 'url': 'http://camwithher.tv/view_video.php?page=&viewkey=6e9a24e2c0e842e1f177&viewtype=&category=', + 'only_matching': True, + }, + { + 'url': 'http://camwithher.tv/view_video.php?viewkey=b6c3b5bea9515d1a1fc4&page=&viewtype=&category=mv', + 'only_matching': True, + } + ] + + def _real_extract(self, url): + video_id = self._match_id(url) + + webpage = self._download_webpage(url, video_id) + + flv_id = self._html_search_regex(r'
2010 else flv_id) + + title = self._html_search_regex(r'
\s+

(.+?)

', webpage, 'title') + + return { + 'id': flv_id, + 'url': rtmp_url, + 'no_resume': True, + 'ext': 'flv', + 'title': title, + }