diff options
author | Sergey M․ <dstftw@gmail.com> | 2014-09-14 05:17:21 +0700 |
---|---|---|
committer | Sergey M․ <dstftw@gmail.com> | 2014-09-14 05:17:21 +0700 |
commit | 98676c08a1c4977f945f8e83c31c227f337176ca (patch) | |
tree | 50efaf279d305940344285379c33838cec2a3c6a | |
parent | 5dbf3b5c60e99585697cea95a34aa8fd6c109827 (diff) |
[cloudy] Add support for videoraj.ch
-rw-r--r-- | youtube_dl/extractor/cloudy.py | 40 |
1 files changed, 27 insertions, 13 deletions
diff --git a/youtube_dl/extractor/cloudy.py b/youtube_dl/extractor/cloudy.py index 95eda2e58..bfdfbcfe6 100644 --- a/youtube_dl/extractor/cloudy.py +++ b/youtube_dl/extractor/cloudy.py @@ -13,35 +13,49 @@ from ..utils import ( class CloudyIE(InfoExtractor): + _IE_DESC = 'cloudy.ec and videoraj.ch' _VALID_URL = r'''(?x) - https?://(?:www\.)?cloudy\.ec/ + https?://(?:www\.)?(?P<host>cloudy\.ec|videoraj\.ch)/ (?:v/|embed\.php\?id=) (?P<id>[A-Za-z0-9]+) ''' - _API_URL = 'http://www.cloudy.ec/api/player.api.php?%s' - _TEST = { - 'url': 'https://www.cloudy.ec/v/af511e2527aac', - 'md5': '5cb253ace826a42f35b4740539bedf07', - 'info_dict': { - 'id': 'af511e2527aac', - 'ext': 'flv', - 'title': 'Funny Cats and Animals Compilation june 2013', + _EMBED_URL = 'http://www.%s/embed.php?id=%s' + _API_URL = 'http://www.%s/api/player.api.php?%s' + _TESTS = [ + { + 'url': 'https://www.cloudy.ec/v/af511e2527aac', + 'md5': '5cb253ace826a42f35b4740539bedf07', + 'info_dict': { + 'id': 'af511e2527aac', + 'ext': 'flv', + 'title': 'Funny Cats and Animals Compilation june 2013', + } + }, + { + 'url': 'http://www.videoraj.ch/v/47f399fd8bb60', + 'md5': '7d0f8799d91efd4eda26587421c3c3b0', + 'info_dict': { + 'id': '47f399fd8bb60', + 'ext': 'flv', + 'title': 'Burning a New iPhone 5 with Gasoline - Will it Survive?', + } } - } + ] def _real_extract(self, url): mobj = re.match(self._VALID_URL, url) + video_host = mobj.group('host') video_id = mobj.group('id') - url = 'http://www.cloudy.ec/embed.php?id=%s' % video_id + url = self._EMBED_URL % (video_host, video_id) webpage = self._download_webpage(url, video_id) file_key = self._search_regex( r'filekey\s*=\s*"([^"]+)"', webpage, 'file_key') - data_url = self._API_URL % compat_urllib_parse.urlencode({ + data_url = self._API_URL % (video_host, compat_urllib_parse.urlencode({ 'file': video_id, 'key': file_key, - }) + })) player_data = self._download_webpage( data_url, video_id, 'Downloading player data') data = compat_parse_qs(player_data) |