diff options
author | Shadab Zafar <dufferzafar0@gmail.com> | 2015-06-26 21:27:43 +0530 |
---|---|---|
committer | Shadab Zafar <dufferzafar0@gmail.com> | 2015-06-26 21:27:43 +0530 |
commit | 2028c6e03d7e254831350081bb4b4741b0b47ac4 (patch) | |
tree | b341882483fa21405b760d81c940d6288d724ab6 | |
parent | 2988835af5cbe695e61d3b58bc65027f5b48fb63 (diff) |
Added a Playlist Info Extractor for WebOfStories
-rw-r--r-- | youtube_dl/extractor/__init__.py | 5 | ||||
-rw-r--r-- | youtube_dl/extractor/webofstories.py | 25 |
2 files changed, 29 insertions, 1 deletions
diff --git a/youtube_dl/extractor/__init__.py b/youtube_dl/extractor/__init__.py index 46cc4cd06..c3f3a3e38 100644 --- a/youtube_dl/extractor/__init__.py +++ b/youtube_dl/extractor/__init__.py @@ -693,7 +693,10 @@ from .wdr import ( WDRMobileIE, WDRMausIE, ) -from .webofstories import WebOfStoriesIE +from .webofstories import ( + WebOfStoriesIE, + WebOfStoriesPlaylistIE, +) from .weibo import WeiboIE from .wimp import WimpIE from .wistia import WistiaIE diff --git a/youtube_dl/extractor/webofstories.py b/youtube_dl/extractor/webofstories.py index 73077a312..d70e30c00 100644 --- a/youtube_dl/extractor/webofstories.py +++ b/youtube_dl/extractor/webofstories.py @@ -1,6 +1,8 @@ # coding: utf-8 from __future__ import unicode_literals +import re + from .common import InfoExtractor from ..utils import int_or_none @@ -98,3 +100,26 @@ class WebOfStoriesIE(InfoExtractor): 'description': description, 'duration': duration, } + + +class WebOfStoriesPlaylistIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?webofstories\.com/playAll/(?P<id>[^/]+)' + _TESTS = [] + + def _real_extract(self, url): + playlist_id = self._match_id(url) + + webpage = self._download_webpage(url, playlist_id) + + entries = [ + self.url_result('http://www.webofstories.com/play/%s' % video_number, 'WebOfStories') + for video_number in set(re.findall('href="/playAll/%s\?sId=(\d+)"' % playlist_id, webpage)) + ] + + title = self._html_search_regex( + r'<title>([^<]+)\s*-\s*Web\sof\sStories</title>', webpage, 'title') + + description = self._html_search_meta( + 'description', webpage, 'description') + + return self.playlist_result(entries, playlist_id, title, description) |