about summary refs log tree commit diff
path: root/youtube_dl/extractor/tunein.py
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2016-03-23 20:45:39 +0600
committerSergey M․ <dstftw@gmail.com>2016-03-23 20:45:39 +0600
commit882c6992967914c245e086ddaacde9d595cd6ed9 (patch)
tree290dd995d1db3c13b179065812189d49e4da8c35 /youtube_dl/extractor/tunein.py
parentefbed08dc20c530fe428256e4dcbea4dc4423d0d (diff)
downloadyoutube-dl-882c6992967914c245e086ddaacde9d595cd6ed9.tar.gz
youtube-dl-882c6992967914c245e086ddaacde9d595cd6ed9.tar.xz
youtube-dl-882c6992967914c245e086ddaacde9d595cd6ed9.zip
[tunein] Fix stream data extraction (Closes #8899, closes #8924)
Diffstat (limited to 'youtube_dl/extractor/tunein.py')
-rw-r--r--youtube_dl/extractor/tunein.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/youtube_dl/extractor/tunein.py b/youtube_dl/extractor/tunein.py
index 8322cc14d..ae4cfaec2 100644
--- a/youtube_dl/extractor/tunein.py
+++ b/youtube_dl/extractor/tunein.py
@@ -1,7 +1,7 @@
 # coding: utf-8
 from __future__ import unicode_literals
 
-import json
+import re
 
 from .common import InfoExtractor
 from ..utils import ExtractorError
@@ -27,10 +27,9 @@ class TuneInBaseIE(InfoExtractor):
         if not streams_url.startswith('http://'):
             streams_url = compat_urlparse.urljoin(url, streams_url)
 
-        stream_data = self._download_webpage(
-            streams_url, content_id, note='Downloading stream data')
-        streams = json.loads(self._search_regex(
-            r'\((.*)\);', stream_data, 'stream info'))['Streams']
+        streams = self._download_json(
+            streams_url, content_id, note='Downloading stream data',
+            transform_source=lambda s: re.sub(r'^\s*\((.*)\);\s*$', r'\1', s))['Streams']
 
         is_live = None
         formats = []