[camdemy] Extract duration properly

This commit is contained in:
Sergey M․ 2016-07-25 22:35:12 +07:00
parent 59eaf69e33
commit 0a147785e8
No known key found for this signature in database
GPG Key ID: 2C393E0F18A9236D

View File

@ -10,6 +10,7 @@
) )
from ..utils import ( from ..utils import (
clean_html, clean_html,
parse_duration,
str_to_int, str_to_int,
unified_strdate, unified_strdate,
) )
@ -27,6 +28,7 @@ class CamdemyIE(InfoExtractor):
'title': 'Ch1-1 Introduction, Signals (02-23-2012)', 'title': 'Ch1-1 Introduction, Signals (02-23-2012)',
'thumbnail': 're:^https?://.*\.jpg$', 'thumbnail': 're:^https?://.*\.jpg$',
'creator': 'ss11spring', 'creator': 'ss11spring',
'duration': 1591,
'upload_date': '20130114', 'upload_date': '20130114',
'view_count': int, 'view_count': int,
} }
@ -42,6 +44,7 @@ class CamdemyIE(InfoExtractor):
'thumbnail': 're:^https?://.*\.jpg$', 'thumbnail': 're:^https?://.*\.jpg$',
'description': 'md5:2a9f989c2b153a2342acee579c6e7db6', 'description': 'md5:2a9f989c2b153a2342acee579c6e7db6',
'creator': 'evercam', 'creator': 'evercam',
'duration': 318,
} }
}, { }, {
# External source (YouTube) # External source (YouTube)
@ -74,6 +77,7 @@ def _real_extract(self, url):
oembed_obj = self._download_json( oembed_obj = self._download_json(
'http://www.camdemy.com/oembed/?format=json&url=' + url, video_id) 'http://www.camdemy.com/oembed/?format=json&url=' + url, video_id)
title = oembed_obj['title']
thumb_url = oembed_obj['thumbnail_url'] thumb_url = oembed_obj['thumbnail_url']
video_folder = compat_urlparse.urljoin(thumb_url, 'video/') video_folder = compat_urlparse.urljoin(thumb_url, 'video/')
file_list_doc = self._download_xml( file_list_doc = self._download_xml(
@ -97,11 +101,11 @@ def _real_extract(self, url):
return { return {
'id': video_id, 'id': video_id,
'url': video_url, 'url': video_url,
'title': oembed_obj['title'], 'title': title,
'thumbnail': thumb_url, 'thumbnail': thumb_url,
'description': description, 'description': description,
'creator': oembed_obj['author_name'], 'creator': oembed_obj.get('author_name'),
'duration': oembed_obj['duration'], 'duration': parse_duration(oembed_obj.get('duration')),
'upload_date': upload_date, 'upload_date': upload_date,
'view_count': view_count, 'view_count': view_count,
} }