aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey M. <dstftw@gmail.com>2014-09-14 04:56:32 +0700
committerSergey M. <dstftw@gmail.com>2014-09-14 04:56:32 +0700
commitb8d61935a0f42ae40e57e059214ffa50044d9158 (patch)
treeb7c941c7b247a74e5b83202cae6d9668f2ca0b21
parente5a93354bc6df76ed07c2e77a68203374b7ddf5b (diff)
parent20ff802c9bcff954ac10b10e9254078f308f037d (diff)
downloadyoutube-dl-b8d61935a0f42ae40e57e059214ffa50044d9158.tar.xz
Merge pull request #3744 from naglis/cloudy
[cloudy] Add new extractor
-rw-r--r--youtube_dl/extractor/__init__.py1
-rw-r--r--youtube_dl/extractor/cloudy.py67
2 files changed, 68 insertions, 0 deletions
diff --git a/youtube_dl/extractor/__init__.py b/youtube_dl/extractor/__init__.py
index 1bf5c51b4..48683ebcc 100644
--- a/youtube_dl/extractor/__init__.py
+++ b/youtube_dl/extractor/__init__.py
@@ -46,6 +46,7 @@ from .cinemassacre import CinemassacreIE
from .clipfish import ClipfishIE
from .cliphunter import CliphunterIE
from .clipsyndicate import ClipsyndicateIE
+from .cloudy import CloudyIE
from .clubic import ClubicIE
from .cmt import CMTIE
from .cnet import CNETIE
diff --git a/youtube_dl/extractor/cloudy.py b/youtube_dl/extractor/cloudy.py
new file mode 100644
index 000000000..73c6e3d49
--- /dev/null
+++ b/youtube_dl/extractor/cloudy.py
@@ -0,0 +1,67 @@
+# coding: utf-8
+from __future__ import unicode_literals
+
+import re
+
+from .common import InfoExtractor
+from ..utils import (
+ ExtractorError,
+ compat_parse_qs,
+ compat_urllib_parse,
+)
+
+
+class CloudyIE(InfoExtractor):
+ _VALID_URL = r'''(?x)
+ https?://(?:www\.)?cloudy\.ec/
+ (?: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',
+ }
+ }
+
+ def _real_extract(self, url):
+ mobj = re.match(self._VALID_URL, url)
+ video_id = mobj.group('id')
+
+ url = 'http://www.cloudy.ec/embed.php?id=%s' % 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({
+ 'file': video_id,
+ 'key': file_key,
+ })
+ player_data = self._download_webpage(
+ data_url, video_id, 'Downloading player data')
+ data = compat_parse_qs(player_data)
+
+ if 'error' in data:
+ raise ExtractorError(
+ '%s error: %s' % (self.IE_NAME, ' '.join(data['error_msg'])),
+ expected=True)
+
+ title = data.get('title', [None])[0]
+ if title:
+ title = title.replace('&asdasdas', '').strip()
+
+ formats = []
+ formats.append({
+ 'format_id': 'sd',
+ 'url': data.get('url', [None])[0],
+ })
+
+ return {
+ 'id': video_id,
+ 'title': title,
+ 'formats': formats,
+ }