mirror of
https://github.com/l1ving/youtube-dl
synced 2024-12-31 01:12:51 +08:00
[telequebec] Fix description extraction and update test (closes #12399)
This commit is contained in:
parent
b08cc749d6
commit
d7344d33b1
@ -2,15 +2,17 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
from ..compat import compat_str
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
int_or_none,
|
int_or_none,
|
||||||
smuggle_url,
|
smuggle_url,
|
||||||
|
try_get,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class TeleQuebecIE(InfoExtractor):
|
class TeleQuebecIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://zonevideo\.telequebec\.tv/media/(?P<id>\d+)'
|
_VALID_URL = r'https?://zonevideo\.telequebec\.tv/media/(?P<id>\d+)'
|
||||||
_TEST = {
|
_TESTS = [{
|
||||||
'url': 'http://zonevideo.telequebec.tv/media/20984/le-couronnement-de-new-york/couronnement-de-new-york',
|
'url': 'http://zonevideo.telequebec.tv/media/20984/le-couronnement-de-new-york/couronnement-de-new-york',
|
||||||
'md5': 'fe95a0957e5707b1b01f5013e725c90f',
|
'md5': 'fe95a0957e5707b1b01f5013e725c90f',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
@ -18,10 +20,14 @@ class TeleQuebecIE(InfoExtractor):
|
|||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': 'Le couronnement de New York',
|
'title': 'Le couronnement de New York',
|
||||||
'description': 'md5:f5b3d27a689ec6c1486132b2d687d432',
|
'description': 'md5:f5b3d27a689ec6c1486132b2d687d432',
|
||||||
'upload_date': '20160220',
|
'upload_date': '20170201',
|
||||||
'timestamp': 1455965438,
|
'timestamp': 1485972222,
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}, {
|
||||||
|
# no description
|
||||||
|
'url': 'http://zonevideo.telequebec.tv/media/30261',
|
||||||
|
'only_matching': True,
|
||||||
|
}]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
media_id = self._match_id(url)
|
media_id = self._match_id(url)
|
||||||
@ -31,9 +37,13 @@ class TeleQuebecIE(InfoExtractor):
|
|||||||
return {
|
return {
|
||||||
'_type': 'url_transparent',
|
'_type': 'url_transparent',
|
||||||
'id': media_id,
|
'id': media_id,
|
||||||
'url': smuggle_url('limelight:media:' + media_data['streamInfo']['sourceId'], {'geo_countries': ['CA']}),
|
'url': smuggle_url(
|
||||||
|
'limelight:media:' + media_data['streamInfo']['sourceId'],
|
||||||
|
{'geo_countries': ['CA']}),
|
||||||
'title': media_data['title'],
|
'title': media_data['title'],
|
||||||
'description': media_data.get('descriptions', [{'text': None}])[0].get('text'),
|
'description': try_get(
|
||||||
'duration': int_or_none(media_data.get('durationInMilliseconds'), 1000),
|
media_data, lambda x: x['descriptions'][0]['text'], compat_str),
|
||||||
|
'duration': int_or_none(
|
||||||
|
media_data.get('durationInMilliseconds'), 1000),
|
||||||
'ie_key': 'LimelightMedia',
|
'ie_key': 'LimelightMedia',
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user