Corrected all outstanding issues, next up is a squash!

This commit is contained in:
theGeekPirate 2016-03-26 21:19:37 -07:00
parent 75cb2fe4a1
commit 2be5f5fd21

View File

@ -4,14 +4,14 @@ from .common import InfoExtractor
class CamWithHerIE(InfoExtractor): class CamWithHerIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?camwithher\.tv/view_video\.php\?viewkey=(?P<id>\w+).*' _VALID_URL = r'https?://(?:www\.)?camwithher\.tv/view_video\.php\?.*viewkey=(?P<id>\w+)'
_TESTS = [ _TESTS = [
{ {
'url': 'http://camwithher.tv/view_video.php?viewkey=6e9a24e2c0e842e1f177&page=&viewtype=&category=', 'url': 'http://camwithher.tv/view_video.php?viewkey=6e9a24e2c0e842e1f177&page=&viewtype=&category=',
'info_dict': { 'info_dict': {
'id': '5644', 'id': '5644',
'ext': 'mp4', 'ext': 'flv',
'title': 'Periscope Tease', 'title': 'Periscope Tease',
}, },
'params': { 'params': {
@ -23,34 +23,31 @@ class CamWithHerIE(InfoExtractor):
'only_matching': True, 'only_matching': True,
}, },
{ {
'url': 'http://camwithher.tv/view_video.php?viewkey=b6c3b5bea9515d1a1fc4&page=&viewtype=&category=mv', 'url': 'http://camwithher.tv/view_video.php?page=&viewkey=6e9a24e2c0e842e1f177&viewtype=&category=',
'info_dict': { 'only_matching': True,
'id': '758',
'ext': 'flv',
'title': 'Gisele in the Bath',
},
'params': {
'skip_download': True,
}
}, },
{
'url': 'http://camwithher.tv/view_video.php?viewkey=b6c3b5bea9515d1a1fc4&page=&viewtype=&category=mv',
'only_matching': True,
}
] ]
def _real_extract(self, url): 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'<a href="/download/\?v=(.+?)\.', webpage, 'id') flv_id = self._html_search_regex(r'<a href="/download/\?v=(\d+)', webpage, 'id')
if int(video_id) > 2010: # The number "2010" was reverse-engineered from cwhplayer.swf.
rtmp_url = 'rtmp://camwithher.tv/clipshare/mp4:' + video_id + '.mp4' # It appears that they changed their video codec, and hence the RTMP URL
else: # scheme at that video's ID.
rtmp_url = 'rtmp://camwithher.tv/clipshare/' + video_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'<div style="float:left">\s+<h2>(.+?)</h2>', webpage, 'title') title = self._html_search_regex(r'<div style="float:left">\s+<h2>(.+?)</h2>', webpage, 'title')
return { return {
'id': video_id, 'id': flv_id,
'url': rtmp_url, 'url': rtmp_url,
'no_resume': True, 'no_resume': True,
'ext': 'flv', 'ext': 'flv',