mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-09-08 21:45:05 +00:00
[cliphunter] Simplify
This commit is contained in:
parent
5ab772f09c
commit
efc867775e
|
@ -1,9 +1,10 @@
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import string
|
import string
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
determine_ext,
|
|
||||||
ExtractorError,
|
ExtractorError,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -23,39 +24,34 @@ translation_table = (
|
||||||
|
|
||||||
|
|
||||||
class CliphunterIE(InfoExtractor):
|
class CliphunterIE(InfoExtractor):
|
||||||
"""Information Extractor for Cliphunter"""
|
IE_NAME = 'cliphunter'
|
||||||
IE_NAME = u'cliphunter'
|
|
||||||
|
|
||||||
_VALID_URL = (r'(?:http://)?(?:www\.)?cliphunter\.com/w/'
|
_VALID_URL = (r'(?:http://)?(?:www\.)?cliphunter\.com/w/'
|
||||||
'(?P<id>[0-9]+)/'
|
'(?P<id>[0-9]+)/'
|
||||||
'(?P<seo>.+?)(?:\?.*)?')
|
'(?P<seo>.+?)(?:\?.*)?')
|
||||||
_TESTS = [{
|
_TESTS = {
|
||||||
u'url': u'http://www.cliphunter.com/w/1012420/Fun_Jynx_Maze_solo',
|
'url': 'http://www.cliphunter.com/w/1012420/Fun_Jynx_Maze_solo',
|
||||||
u'file': u'1012420.flv',
|
'file': '1012420.flv',
|
||||||
u'md5': u'15e7740f30428abf70f4223478dc1225',
|
'md5': '15e7740f30428abf70f4223478dc1225',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u'title': u'Fun Jynx Maze solo',
|
'title': 'Fun Jynx Maze solo',
|
||||||
}
|
}
|
||||||
}]
|
}
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, 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')
|
video_id = mobj.group('id')
|
||||||
|
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
pl_fiji = re.search(r'pl_fiji = \'([^\']+)\'', webpage).group(1)
|
pl_fiji = self._search_regex(r'pl_fiji = \'([^\']+)\'', webpage, 'video data')
|
||||||
pl_c_qual = re.search(r'pl_c_qual = "(.)"', webpage).group(1)
|
pl_c_qual = self._search_regex(r'pl_c_qual = "(.)"', webpage, 'video quality')
|
||||||
video_title = re.search(r'mediaTitle = "([^"]+)"', webpage).group(1)
|
video_title = self._search_regex(r'mediaTitle = "([^"]+)"', webpage, 'title')
|
||||||
|
|
||||||
video_url = string.translate(pl_fiji.encode(), translation_table)
|
video_url = string.translate(pl_fiji.encode(), translation_table)
|
||||||
|
|
||||||
formats = [{
|
formats = [{
|
||||||
'url': video_url,
|
'url': video_url,
|
||||||
'ext': determine_ext(video_url),
|
|
||||||
'format': pl_c_qual,
|
'format': pl_c_qual,
|
||||||
'format_id': pl_c_qual,
|
'format_id': pl_c_qual,
|
||||||
}]
|
}]
|
||||||
|
|
Loading…
Reference in a new issue