projects
/
youtube-dl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[YoutubeDL] use a more correct terminology in the error message for file:// URLs
[youtube-dl]
/
youtube_dl
/
extractor
/
udn.py
diff --git
a/youtube_dl/extractor/udn.py
b/youtube_dl/extractor/udn.py
index 2b9a733e8d95507d15eeefafe151dc14538fb859..ee35b7227372c0ddc128dfc694577578f9fc6009 100644
(file)
--- a/
youtube_dl/extractor/udn.py
+++ b/
youtube_dl/extractor/udn.py
@@
-4,13
+4,16
@@
from __future__ import unicode_literals
import json
from .common import InfoExtractor
from ..utils import (
import json
from .common import InfoExtractor
from ..utils import (
-
url_infer_protocol
,
- js_to_json
+
js_to_json
,
+ ExtractorError,
)
)
+from ..compat import compat_urlparse
class UDNEmbedIE(InfoExtractor):
class UDNEmbedIE(InfoExtractor):
- _VALID_URL = r'(?:https?:)?//video\.udn\.com/embed/news/(?P<id>\d+)'
+ IE_DESC = '聯合影音'
+ _PROTOCOL_RELATIVE_VALID_URL = r'//video\.udn\.com/(?:embed|play)/news/(?P<id>\d+)'
+ _VALID_URL = r'https?:' + _PROTOCOL_RELATIVE_VALID_URL
_TESTS = [{
'url': 'http://video.udn.com/embed/news/300040',
'md5': 'de06b4c90b042c128395a88f0384817e',
_TESTS = [{
'url': 'http://video.udn.com/embed/news/300040',
'md5': 'de06b4c90b042c128395a88f0384817e',
@@
-21,7
+24,11
@@
class UDNEmbedIE(InfoExtractor):
'thumbnail': 're:^https?://.*\.jpg$',
}
}, {
'thumbnail': 're:^https?://.*\.jpg$',
}
}, {
- 'url': '//video.udn.com/embed/news/300040',
+ 'url': 'https://video.udn.com/embed/news/300040',
+ 'only_matching': True,
+ }, {
+ # From https://video.udn.com/news/303776
+ 'url': 'https://video.udn.com/play/news/303776',
'only_matching': True,
}]
'only_matching': True,
}]
@@
-45,11
+52,14
@@
class UDNEmbedIE(InfoExtractor):
formats = [{
'url': self._download_webpage(
formats = [{
'url': self._download_webpage(
-
url_infer_protocol
(url, api_url), video_id,
+
compat_urlparse.urljoin
(url, api_url), video_id,
'retrieve url for %s video' % video_type),
'format_id': video_type,
'preference': 0 if video_type == 'mp4' else -1,
'retrieve url for %s video' % video_type),
'format_id': video_type,
'preference': 0 if video_type == 'mp4' else -1,
- } for video_type, api_url in video_urls.items()]
+ } for video_type, api_url in video_urls.items() if api_url]
+
+ if not formats:
+ raise ExtractorError('No videos found', expected=True)
self._sort_formats(formats)
self._sort_formats(formats)