diff options
author | Naglis Jonaitis <[email protected]> | 2015-04-09 23:54:53 +0300 |
---|---|---|
committer | Naglis Jonaitis <[email protected]> | 2015-04-09 23:54:53 +0300 |
commit | ce9f47de99f3f607ad940897e457d02ea084795d (patch) | |
tree | 81a7c315ec82f034343ad1b19f5904dea42987cb /youtube_dl/extractor/teamcoco.py | |
parent | 4c4780c25e20d6ad281faff5d6aede3df4b58f66 (diff) | |
download | youtube-dl-ce9f47de99f3f607ad940897e457d02ea084795d.tar.gz youtube-dl-ce9f47de99f3f607ad940897e457d02ea084795d.zip |
[teamcoco] Fix extraction
Diffstat (limited to 'youtube_dl/extractor/teamcoco.py')
-rw-r--r-- | youtube_dl/extractor/teamcoco.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/youtube_dl/extractor/teamcoco.py b/youtube_dl/extractor/teamcoco.py index a46a7ecba..b3cfe4e4f 100644 --- a/youtube_dl/extractor/teamcoco.py +++ b/youtube_dl/extractor/teamcoco.py @@ -4,7 +4,10 @@ import base64 import re from .common import InfoExtractor -from ..utils import qualities +from ..utils import ( + ExtractorError, + qualities, +) class TeamcocoIE(InfoExtractor): @@ -49,14 +52,12 @@ class TeamcocoIE(InfoExtractor): video_id = self._html_search_regex( self._VIDEO_ID_REGEXES, webpage, 'video id') - embed_url = 'http://teamcoco.com/embed/v/%s' % video_id - embed = self._download_webpage( - embed_url, video_id, 'Downloading embed page') - - player_data = self._parse_json(self._search_regex( - r'Y\.Ginger\.Module\.Player(?:;var\s*player\s*=\s*new\s*m)?\((\{.*?\})\);', embed, 'player data'), video_id) + preloads = re.findall(r'"preload":\s*"([^"]+)"', webpage) + if not preloads: + raise ExtractorError('Preload information could not be extracted') + preload = max([(len(p), p) for p in preloads])[1] data = self._parse_json( - base64.b64decode(player_data['preload'].encode('ascii')).decode('utf-8'), video_id) + base64.b64decode(preload.encode('ascii')).decode('utf-8'), video_id) formats = [] get_quality = qualities(['500k', '480p', '1000k', '720p', '1080p']) |