projects
/
youtube-dl
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
b08cc74
)
[telequebec] Fix description extraction and update test (closes #12399)
author
Sergey M․
<dstftw@gmail.com>
Wed, 8 Mar 2017 11:25:04 +0000
(18:25 +0700)
committer
Sergey M․
<dstftw@gmail.com>
Wed, 8 Mar 2017 11:25:59 +0000
(18:25 +0700)
youtube_dl/extractor/telequebec.py
patch
|
blob
|
history
diff --git
a/youtube_dl/extractor/telequebec.py
b/youtube_dl/extractor/telequebec.py
index 82d73c31d55c55dfb7cdf40f593265806f3fdb89..fafaa826fe91e2eaddc2fe9b700c7e0367797807 100644
(file)
--- a/
youtube_dl/extractor/telequebec.py
+++ b/
youtube_dl/extractor/telequebec.py
@@
-2,15
+2,17
@@
from __future__ import unicode_literals
from .common import InfoExtractor
from __future__ import unicode_literals
from .common import InfoExtractor
+from ..compat import compat_str
from ..utils import (
int_or_none,
smuggle_url,
from ..utils import (
int_or_none,
smuggle_url,
+ try_get,
)
class TeleQuebecIE(InfoExtractor):
_VALID_URL = r'https?://zonevideo\.telequebec\.tv/media/(?P<id>\d+)'
)
class TeleQuebecIE(InfoExtractor):
_VALID_URL = r'https?://zonevideo\.telequebec\.tv/media/(?P<id>\d+)'
- _TEST
=
{
+ _TEST
S = [
{
'url': 'http://zonevideo.telequebec.tv/media/20984/le-couronnement-de-new-york/couronnement-de-new-york',
'md5': 'fe95a0957e5707b1b01f5013e725c90f',
'info_dict': {
'url': 'http://zonevideo.telequebec.tv/media/20984/le-couronnement-de-new-york/couronnement-de-new-york',
'md5': 'fe95a0957e5707b1b01f5013e725c90f',
'info_dict': {
@@
-18,10
+20,14
@@
class TeleQuebecIE(InfoExtractor):
'ext': 'mp4',
'title': 'Le couronnement de New York',
'description': 'md5:f5b3d27a689ec6c1486132b2d687d432',
'ext': 'mp4',
'title': 'Le couronnement de New York',
'description': 'md5:f5b3d27a689ec6c1486132b2d687d432',
- 'upload_date': '201
60220
',
- 'timestamp': 14
55965438
,
+ 'upload_date': '201
70201
',
+ 'timestamp': 14
85972222
,
}
}
- }
+ }, {
+ # no description
+ 'url': 'http://zonevideo.telequebec.tv/media/30261',
+ 'only_matching': True,
+ }]
def _real_extract(self, url):
media_id = self._match_id(url)
def _real_extract(self, url):
media_id = self._match_id(url)
@@
-31,9
+37,13
@@
class TeleQuebecIE(InfoExtractor):
return {
'_type': 'url_transparent',
'id': media_id,
return {
'_type': 'url_transparent',
'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'),
- 'duration': int_or_none(media_data.get('durationInMilliseconds'), 1000),
+ 'description': try_get(
+ 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',
}