summary refs log tree commit diff
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2013-01-08 00:57:46 -0800
committerPhilipp Hagemeister <phihag@phihag.de>2013-01-08 00:57:46 -0800
commitdc1c479a6fcac0bcf13e2d1725f030298817536c (patch)
tree2da4196033494f3ab5f231f0088fbd84f4ce1734
parent814eed0ea1f91815cec645d9eb6f79c841d541fb (diff)
parent119d536e07b01aa96636509d3a8394a44640dc39 (diff)
downloadyoutube-dl-dc1c479a6fcac0bcf13e2d1725f030298817536c.tar.gz
youtube-dl-dc1c479a6fcac0bcf13e2d1725f030298817536c.tar.xz
youtube-dl-dc1c479a6fcac0bcf13e2d1725f030298817536c.zip
Merge pull request #621 from atomizer/master
justin.tv tweaks
-rwxr-xr-xyoutube_dl/InfoExtractors.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/youtube_dl/InfoExtractors.py b/youtube_dl/InfoExtractors.py
index 136e4183e..4f87eeb39 100755
--- a/youtube_dl/InfoExtractors.py
+++ b/youtube_dl/InfoExtractors.py
@@ -3524,17 +3524,23 @@ class JustinTVIE(InfoExtractor):
             return
 
         response = json.loads(webpage)
+        if type(response) != list:
+            error_text = response.get('error', 'unknown error')
+            self._downloader.trouble(u'ERROR: Justin.tv API: %s' % error_text)
+            return
         info = []
         for clip in response:
             video_url = clip['video_file_url']
             if video_url:
                 video_extension = os.path.splitext(video_url)[1][1:]
-                video_date = re.sub('-', '', clip['created_on'][:10])
+                video_date = re.sub('-', '', clip['start_time'][:10])
+                video_uploader_id = clip.get('user_id', clip.get('channel_id'))
                 info.append({
                     'id': clip['id'],
                     'url': video_url,
                     'title': clip['title'],
-                    'uploader': clip.get('user_id', clip.get('channel_id')),
+                    'uploader': clip.get('channel_name', video_uploader_id),
+                    'uploader_id': video_uploader_id,
                     'upload_date': video_date,
                     'ext': video_extension,
                 })
@@ -3553,7 +3559,7 @@ class JustinTVIE(InfoExtractor):
             paged = True
             api += '/channel/archives/%s.json'
         else:
-            api += '/clip/show/%s.json'
+            api += '/broadcast/by_archive/%s.json'
         api = api % (video_id,)
 
         self.report_extraction(video_id)