aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2012-12-04 10:59:38 +0100
committerPhilipp Hagemeister <phihag@phihag.de>2012-12-04 10:59:38 +0100
commite387eb5aba241e55e38e8bd5b57cc76b082ac6b9 (patch)
treec80d62c31a7427ce71fdde23f37aadcb6a05dc6c
parent4083bf81a01f2e580f84f5db0274dd5585705ad6 (diff)
Let youtube IE handle IDs starting with PL (Closes #572)
-rw-r--r--test/test_utils.py2
-rw-r--r--test/test_youtube_playlist_ids.py22
-rw-r--r--youtube_dl/InfoExtractors.py2
3 files changed, 25 insertions, 1 deletions
diff --git a/test/test_utils.py b/test/test_utils.py
index 8afc30370..796ed4ab2 100644
--- a/test/test_utils.py
+++ b/test/test_utils.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python
+
# Various small unit tests
import sys
diff --git a/test/test_youtube_playlist_ids.py b/test/test_youtube_playlist_ids.py
new file mode 100644
index 000000000..b4dcedb45
--- /dev/null
+++ b/test/test_youtube_playlist_ids.py
@@ -0,0 +1,22 @@
+#!/usr/bin/env python
+
+import sys
+import unittest
+
+# Allow direct execution
+import os
+sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+
+from youtube_dl.InfoExtractors import YoutubeIE, YoutubePlaylistIE
+
+class TestYoutubePlaylistMatching(unittest.TestCase):
+ def test_playlist_matching(self):
+ assert YoutubePlaylistIE().suitable(u'ECUl4u3cNGP61MdtwGTqZA0MreSaDybji8')
+ assert YoutubePlaylistIE().suitable(u'PL63F0C78739B09958')
+ assert not YoutubePlaylistIE().suitable(u'PLtS2H6bU1M')
+
+ def test_youtube_matching(self):
+ assert YoutubeIE().suitable(u'PLtS2H6bU1M')
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/youtube_dl/InfoExtractors.py b/youtube_dl/InfoExtractors.py
index e5e8f41f0..1857360d4 100644
--- a/youtube_dl/InfoExtractors.py
+++ b/youtube_dl/InfoExtractors.py
@@ -1671,7 +1671,7 @@ class YahooSearchIE(InfoExtractor):
class YoutubePlaylistIE(InfoExtractor):
"""Information Extractor for YouTube playlists."""
- _VALID_URL = r'(?:(?:https?://)?(?:\w+\.)?youtube\.com/(?:(?:course|view_play_list|my_playlists|artist|playlist)\?.*?(p|a|list)=|user/.*?/user/|p/|user/.*?#[pg]/c/)(?:PL|EC)?|PL|EC)([0-9A-Za-z-_]+)(?:/.*?/([0-9A-Za-z_-]+))?.*'
+ _VALID_URL = r'(?:(?:https?://)?(?:\w+\.)?youtube\.com/(?:(?:course|view_play_list|my_playlists|artist|playlist)\?.*?(p|a|list)=|user/.*?/user/|p/|user/.*?#[pg]/c/)(?:PL|EC)?|PL|EC)([0-9A-Za-z-_]{10,})(?:/.*?/([0-9A-Za-z_-]+))?.*'
_TEMPLATE_URL = 'http://www.youtube.com/%s?%s=%s&page=%s&gl=US&hl=en'
_VIDEO_INDICATOR_TEMPLATE = r'/watch\?v=(.+?)&amp;([^&"]+&amp;)*list=.*?%s'
_MORE_PAGES_INDICATOR = r'yt-uix-pager-next'