aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2014-01-27 07:55:30 +0100
committerPhilipp Hagemeister <phihag@phihag.de>2014-01-27 07:55:30 +0100
commitefc867775e09f493cca95fc5cd2986db7b55a71b (patch)
tree1a61f78fefdda39287dc7ec8cff2fe7b72ee32b3
parent5ab772f09c65d258780a88ef44980619d67cd9ca (diff)
[cliphunter] Simplify
-rw-r--r--youtube_dl/extractor/cliphunter.py30
1 files changed, 13 insertions, 17 deletions
diff --git a/youtube_dl/extractor/cliphunter.py b/youtube_dl/extractor/cliphunter.py
index 2d8c09630..42d406820 100644
--- a/youtube_dl/extractor/cliphunter.py
+++ b/youtube_dl/extractor/cliphunter.py
@@ -1,9 +1,10 @@
+from __future__ import unicode_literals
+
import re
import string
from .common import InfoExtractor
from ..utils import (
- determine_ext,
ExtractorError,
)
@@ -23,39 +24,34 @@ translation_table = (
class CliphunterIE(InfoExtractor):
- """Information Extractor for Cliphunter"""
- IE_NAME = u'cliphunter'
+ IE_NAME = 'cliphunter'
_VALID_URL = (r'(?:http://)?(?:www\.)?cliphunter\.com/w/'
'(?P<id>[0-9]+)/'
'(?P<seo>.+?)(?:\?.*)?')
- _TESTS = [{
- u'url': u'http://www.cliphunter.com/w/1012420/Fun_Jynx_Maze_solo',
- u'file': u'1012420.flv',
- u'md5': u'15e7740f30428abf70f4223478dc1225',
- u'info_dict': {
- u'title': u'Fun Jynx Maze solo',
+ _TESTS = {
+ '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)
- if mobj is None:
- raise ExtractorError(u'Unable to extract media URL')
-
video_id = mobj.group('id')
webpage = self._download_webpage(url, video_id)
- pl_fiji = re.search(r'pl_fiji = \'([^\']+)\'', webpage).group(1)
- pl_c_qual = re.search(r'pl_c_qual = "(.)"', webpage).group(1)
- video_title = re.search(r'mediaTitle = "([^"]+)"', webpage).group(1)
+ 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 = string.translate(pl_fiji.encode(), translation_table)
formats = [{
'url': video_url,
- 'ext': determine_ext(video_url),
'format': pl_c_qual,
'format_id': pl_c_qual,
}]