1
0
mirror of https://github.com/l1ving/youtube-dl synced 2020-11-18 19:53:54 -08:00

[ikshow] Add new extractor

This commit is contained in:
buo 2015-11-18 10:53:14 +09:00
parent 312a3f389b
commit 61d2c36f18
2 changed files with 51 additions and 0 deletions

View File

@ -244,6 +244,7 @@ from .huffpost import HuffPostIE
from .hypem import HypemIE from .hypem import HypemIE
from .iconosquare import IconosquareIE from .iconosquare import IconosquareIE
from .ign import IGNIE, OneUPIE from .ign import IGNIE, OneUPIE
from .ikshow import IkshowIE
from .imdb import ( from .imdb import (
ImdbIE, ImdbIE,
ImdbListIE ImdbListIE

View File

@ -0,0 +1,50 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import re
import base64
from .common import InfoExtractor
from ..utils import js_to_json
class IkshowIE(InfoExtractor):
IE_NAME = 'ikshow.net'
_VALID_URL = r'http://ikshow\.net/shows/(?P<show_id>[^/]+)/(?P<episode_id>[^/]+)'
_TEST = {
'url': 'http://ikshow.net/shows/running-man/episode-273/',
'info_dict': {
'id': 'running-man-episode-273',
'ext': 'mp4',
'title': 'Running Man Ep 273 English Subtitle',
'description': 'Free to watch and download Running Man Episode 273 with Eng Sub',
}
}
def _extract_id(self, url):
mobj = re.match(self._VALID_URL, url)
return '%s-%s' % (mobj.group('show_id'), mobj.group('episode_id'))
def _real_extract(self, url):
video_id = self._extract_id(url)
webpage = self._download_webpage(url, video_id)
params = self._search_regex(
r'''(?s)jwplayer\("mediaplayer"\)\.setup\((\{.*?\})\);''',
webpage, 'video url')
params = re.sub(r'window\.atob\(("[a-zA-Z0-9+/=]+")\)', '\\1', params)
params = self._parse_json(params, video_id, transform_source=js_to_json)
formats = [{
'url': base64.b64decode(s['file']).decode('utf-8'),
'ext': s['type'],
} for s in params['sources']]
self._sort_formats(formats)
return {
'id': video_id,
'title': self._og_search_title(webpage),
'description': self._html_search_meta('description', webpage),
'formats': formats,
}