From 79f4be30a3a6df658b30f82eb676a3db29244ebe Mon Sep 17 00:00:00 2001 From: RPing Date: Thu, 19 Nov 2015 12:48:59 +0800 Subject: [PATCH] [UDNEmbed]modify regex in udn.py --- youtube_dl/extractor/__init__.py | 2 +- youtube_dl/extractor/generic.py | 2 +- youtube_dl/extractor/udn.py | 8 ++------ 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/youtube_dl/extractor/__init__.py b/youtube_dl/extractor/__init__.py index bceaa978f..26e5745d6 100644 --- a/youtube_dl/extractor/__init__.py +++ b/youtube_dl/extractor/__init__.py @@ -706,7 +706,7 @@ from .udemy import ( UdemyIE, UdemyCourseIE ) -from .udn import UDNIE +from .udn import UDNEmbedIE from .ultimedia import UltimediaIE from .unistra import UnistraIE from .urort import UrortIE diff --git a/youtube_dl/extractor/generic.py b/youtube_dl/extractor/generic.py index 619fcfe86..51516a38a 100644 --- a/youtube_dl/extractor/generic.py +++ b/youtube_dl/extractor/generic.py @@ -42,7 +42,7 @@ from .sportbox import SportBoxEmbedIE from .smotri import SmotriIE from .myvi import MyviIE from .condenast import CondeNastIE -from .udn import UDNIE +from .udn import UDNEmbedIE from .senateisvp import SenateISVPIE from .bliptv import BlipTVIE from .svt import SVTIE diff --git a/youtube_dl/extractor/udn.py b/youtube_dl/extractor/udn.py index 346ea13a4..d9dd627db 100644 --- a/youtube_dl/extractor/udn.py +++ b/youtube_dl/extractor/udn.py @@ -10,9 +10,9 @@ from ..utils import ( from ..compat import compat_urlparse -class UDNIE(InfoExtractor): +class UDNEmbedIE(InfoExtractor): IE_DESC = '聯合影音' - _VALID_URL = r'https?://video\.udn\.com/((?:embed|play)/)?news/(?P\d+)' + _VALID_URL = r'(?:https?:)?//video\.udn\.com/(?:embed|play)/news/(?P\d+)' _TESTS = [{ 'url': 'http://video.udn.com/embed/news/300040', 'md5': 'de06b4c90b042c128395a88f0384817e', @@ -32,10 +32,6 @@ class UDNIE(InfoExtractor): }] def _real_extract(self, url): - if "embed" not in url and "play" not in url: - p = url.index("com/") + 4 - url = url[:p] + "embed/" + url[p:] - video_id = self._match_id(url) page = self._download_webpage(url, video_id)