[ok] Extract start time

This commit is contained in:
Sergey M․ 2016-04-25 22:15:15 +06:00
parent 749b0046a8
commit c9fd530670
No known key found for this signature in database
GPG key ID: 2C393E0F18A9236D

View file

@ -2,7 +2,11 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from .common import InfoExtractor from .common import InfoExtractor
from ..compat import compat_urllib_parse_unquote from ..compat import (
compat_parse_qs,
compat_urllib_parse_unquote,
compat_urllib_parse_urlparse,
)
from ..utils import ( from ..utils import (
ExtractorError, ExtractorError,
unified_strdate, unified_strdate,
@ -32,7 +36,7 @@ class OdnoklassnikiIE(InfoExtractor):
'skip': 'Video has been blocked', 'skip': 'Video has been blocked',
}, { }, {
# metadataUrl # metadataUrl
'url': 'http://ok.ru/video/63567059965189-0', 'url': 'http://ok.ru/video/63567059965189-0?fromTime=5',
'md5': '9676cf86eff5391d35dea675d224e131', 'md5': '9676cf86eff5391d35dea675d224e131',
'info_dict': { 'info_dict': {
'id': '63567059965189-0', 'id': '63567059965189-0',
@ -44,6 +48,7 @@ class OdnoklassnikiIE(InfoExtractor):
'uploader': '☭ Андрей Мещанинов ☭', 'uploader': '☭ Андрей Мещанинов ☭',
'like_count': int, 'like_count': int,
'age_limit': 0, 'age_limit': 0,
'start_time': 5,
}, },
}, { }, {
# YouTube embed (metadataUrl, provider == USER_YOUTUBE) # YouTube embed (metadataUrl, provider == USER_YOUTUBE)
@ -94,6 +99,9 @@ class OdnoklassnikiIE(InfoExtractor):
}] }]
def _real_extract(self, url): def _real_extract(self, url):
start_time = int_or_none(compat_parse_qs(
compat_urllib_parse_urlparse(url).query).get('fromTime', [None])[0])
video_id = self._match_id(url) video_id = self._match_id(url)
webpage = self._download_webpage( webpage = self._download_webpage(
@ -158,6 +166,7 @@ class OdnoklassnikiIE(InfoExtractor):
'uploader_id': uploader_id, 'uploader_id': uploader_id,
'like_count': like_count, 'like_count': like_count,
'age_limit': age_limit, 'age_limit': age_limit,
'start_time': start_time,
} }
if provider == 'USER_YOUTUBE': if provider == 'USER_YOUTUBE':