Fixed ibm think playlist downloader regex and handled ustream via generic parser

This commit is contained in:
Parth Verma 2018-04-29 23:42:10 +05:30
parent 285eefc81b
commit 93041d4cec

View File

@ -4,13 +4,13 @@ from __future__ import unicode_literals
import re import re
from .common import InfoExtractor from .common import InfoExtractor
from .ustream import UstreamIE from .generic import GenericIE
class IbmThinkIE(InfoExtractor): class IbmThinkIE(InfoExtractor):
IE_DESC = 'IBM Think Videos' IE_DESC = 'IBM Think Videos'
IE_NAME = 'IBMThink' IE_NAME = 'IBMThink'
_VALID_URL = r'https?://(?:www\.)?ibm\.com/events/think/watch/replay/(?P<id>[0-9]+)/?' _VALID_URL = r'https?://(?:www\.)?ibm\.com/events/think/watch/(playlist/)?(\d*/)?replay/(?P<id>[0-9]+)/?'
_TESTS = [{ _TESTS = [{
'url': 'https://www.ibm.com/events/think/watch/replay/113734399/', 'url': 'https://www.ibm.com/events/think/watch/replay/113734399/',
'md5': '0a3f1c81c58aacbbb36e292a1c1f9690', 'md5': '0a3f1c81c58aacbbb36e292a1c1f9690',
@ -29,7 +29,7 @@ class IbmThinkIE(InfoExtractor):
video_id = self._match_id(url) video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id) webpage = self._download_webpage(url, video_id)
ustream_url = self._html_search_regex(r'<iframe\ssrc="(.*?)"', webpage, 'ustream_url').split('?')[0] + '/' ustream_url = self._html_search_regex(r'<iframe\ssrc="(.*?)"', webpage, 'ustream_url').split('?')[0] + '/'
return self.url_result(ustream_url, UstreamIE.ie_key()) return self.url_result(ustream_url, GenericIE.ie_key())
class IbmThinkPlaylistIE(InfoExtractor): class IbmThinkPlaylistIE(InfoExtractor):
@ -49,7 +49,7 @@ class IbmThinkPlaylistIE(InfoExtractor):
def _real_extract(self, url): def _real_extract(self, url):
playlist_id = self._match_id(url) playlist_id = self._match_id(url)
webpage = self._download_webpage(url, playlist_id) webpage = self._download_webpage(url, playlist_id)
entries = [self.url_result(m) for m in re.findall(r'<a href="(.+?)" class="(?:video-list-item)?\s?(?:js-video-list-item)?">', webpage)] entries = [self.url_result(m, GenericIE.ie_key()) for m in re.findall(r'<a href="(.+?)" class="(?:video-list-item)?\s?(?:js-video-list-item)?">', webpage)]
title = self._html_search_regex(r'<title>(?:.+?)\s\|\s(?:.+?)\s\|\s(.+?)</title>', webpage, 'title') title = self._html_search_regex(r'<title>(?:.+?)\s\|\s(?:.+?)\s\|\s(.+?)</title>', webpage, 'title')
description = self._og_search_description(webpage) description = self._og_search_description(webpage)
return self.playlist_result(entries, playlist_id, title, description) return self.playlist_result(entries, playlist_id, title, description)