aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYen Chi Hsuan <yan12125@gmail.com>2015-04-16 17:04:53 +0800
committerYen Chi Hsuan <yan12125@gmail.com>2015-04-16 17:04:53 +0800
commitd0eb724e22dc2e48f206dac45f9db9c17dcb26e1 (patch)
tree7e26972a9a206eea45b4698b2aaa6eff1feda7ff
parent9fc03aa87c74cb199f9e1e146ac5cb71b166d3e7 (diff)
[UDNEmbed] Enhance error checking and extend _VALID_URL
-rw-r--r--youtube_dl/extractor/udn.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/youtube_dl/extractor/udn.py b/youtube_dl/extractor/udn.py
index bba25bb58..c08428acf 100644
--- a/youtube_dl/extractor/udn.py
+++ b/youtube_dl/extractor/udn.py
@@ -3,12 +3,15 @@ from __future__ import unicode_literals
import json
from .common import InfoExtractor
-from ..utils import js_to_json
+from ..utils import (
+ js_to_json,
+ ExtractorError,
+)
from ..compat import compat_urlparse
class UDNEmbedIE(InfoExtractor):
- _VALID_URL = r'(?:https?:)?//video\.udn\.com/embed/news/(?P<id>\d+)'
+ _VALID_URL = r'https?://video\.udn\.com/(?:embed|play)/news/(?P<id>\d+)'
_TESTS = [{
'url': 'http://video.udn.com/embed/news/300040',
'md5': 'de06b4c90b042c128395a88f0384817e',
@@ -19,7 +22,11 @@ class UDNEmbedIE(InfoExtractor):
'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,
}]
@@ -47,7 +54,10 @@ class UDNEmbedIE(InfoExtractor):
'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)