diff options
author | Jaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com> | 2014-01-27 12:45:59 +0100 |
---|---|---|
committer | Jaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com> | 2014-01-27 12:45:59 +0100 |
commit | e2ba07024f36b683d186a46d6c9542edb4e748b1 (patch) | |
tree | 420ec72bdb751629ef002d3c1027fe98a90da997 /youtube_dl | |
parent | 9b05bd42e590ee21daba80ec7fd3fd79991a3bca (diff) | |
parent | b6d3a99678052bb85a187268dbd50e35fbde109c (diff) |
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'youtube_dl')
-rw-r--r-- | youtube_dl/extractor/__init__.py | 1 | ||||
-rw-r--r-- | youtube_dl/extractor/cliphunter.py | 59 |
2 files changed, 60 insertions, 0 deletions
diff --git a/youtube_dl/extractor/__init__.py b/youtube_dl/extractor/__init__.py index 192baa9b8..1e8556124 100644 --- a/youtube_dl/extractor/__init__.py +++ b/youtube_dl/extractor/__init__.py @@ -27,6 +27,7 @@ from .cbs import CBSIE from .channel9 import Channel9IE from .cinemassacre import CinemassacreIE from .clipfish import ClipfishIE +from .cliphunter import CliphunterIE from .clipsyndicate import ClipsyndicateIE from .cmt import CMTIE from .cnn import CNNIE diff --git a/youtube_dl/extractor/cliphunter.py b/youtube_dl/extractor/cliphunter.py new file mode 100644 index 000000000..d891fa301 --- /dev/null +++ b/youtube_dl/extractor/cliphunter.py @@ -0,0 +1,59 @@ +from __future__ import unicode_literals + +import re +import string + +from .common import InfoExtractor +from ..utils import ( + ExtractorError, +) + +translation_table = { + 'a': 'h', 'd': 'e', 'e': 'v', 'f': 'o', 'g': 'f', 'i': 'd', 'l': 'n', + 'm': 'a', 'n': 'm', 'p': 'u', 'q': 't', 'r': 's', 'v': 'p', 'x': 'r', + 'y': 'l', 'z': 'i', + '$': ':', '&': '.', '(': '=', '^': '&', '=': '/', +} + + +class CliphunterIE(InfoExtractor): + IE_NAME = 'cliphunter' + + _VALID_URL = r'''(?x)http://(?:www\.)?cliphunter\.com/w/ + (?P<id>[0-9]+)/ + (?P<seo>.+?)(?:$|[#\?]) + ''' + _TEST = { + 'url': 'http://www.cliphunter.com/w/1012420/Fun_Jynx_Maze_solo', + 'file': '1012420.flv', + 'md5': '15e7740f30428abf70f4223478dc1225', + 'info_dict': { + 'title': 'Fun Jynx Maze solo', + } + } + + def _real_extract(self, url): + mobj = re.match(self._VALID_URL, url) + video_id = mobj.group('id') + + webpage = self._download_webpage(url, video_id) + + pl_fiji = self._search_regex( + r'pl_fiji = \'([^\']+)\'', webpage, 'video data') + pl_c_qual = self._search_regex( + r'pl_c_qual = "(.)"', webpage, 'video quality') + video_title = self._search_regex( + r'mediaTitle = "([^"]+)"', webpage, 'title') + + video_url = ''.join(translation_table.get(c, c) for c in pl_fiji) + + formats = [{ + 'url': video_url, + 'format_id': pl_c_qual, + }] + + return { + 'id': video_id, + 'title': video_title, + 'formats': formats, + } |