import os
import re
+import xml.etree.ElementTree
from .common import InfoExtractor
from .youtube import YoutubeIE
compat_urllib_parse,
compat_urllib_request,
compat_urlparse,
+ compat_xml_parse_error,
ExtractorError,
HEADRequest,
raise ExtractorError('Invalid URL protocol')
return response
+ def _extract_rss(self, url, video_id, doc):
+ playlist_title = doc.find('./channel/title').text
+ playlist_desc_el = doc.find('./channel/description')
+ playlist_desc = None if playlist_desc_el is None else playlist_desc_el.text
+
+ entries = [{
+ '_type': 'url',
+ 'url': e.find('link').text,
+ 'title': e.find('title').text,
+ } for e in doc.findall('./channel/item')]
+
+ return {
+ '_type': 'playlist',
+ 'id': url,
+ 'title': playlist_title,
+ 'description': playlist_desc,
+ 'entries': entries,
+ }
+
def _real_extract(self, url):
parsed_url = compat_urlparse.urlparse(url)
if not parsed_url.scheme:
self.report_extraction(video_id)
+ # Is it an RSS feed?
+ try:
+ doc = xml.etree.ElementTree.fromstring(webpage.encode('utf-8'))
+ if doc.tag == 'rss':
+ return self._extract_rss(url, video_id, doc)
+ except compat_xml_parse_error:
+ pass
+
# it's tempting to parse this further, but you would
# have to take into account all the variations like
# Video Title - Site Name
r'^(?:https?://)?([^/]*)/.*', url, 'video uploader')
# Look for BrightCove:
- bc_url = BrightcoveIE._extract_brightcove_url(webpage)
- if bc_url is not None:
+ bc_urls = BrightcoveIE._extract_brightcove_urls(webpage)
+ if bc_urls:
self.to_screen('Brightcove video detected.')
- surl = smuggle_url(bc_url, {'Referer': url})
- return self.url_result(surl, 'Brightcove')
+ entries = [{
+ '_type': 'url',
+ 'url': smuggle_url(bc_url, {'Referer': url}),
+ 'ie_key': 'Brightcove'
+ } for bc_url in bc_urls]
+
+ return {
+ '_type': 'playlist',
+ 'title': video_title,
+ 'id': video_id,
+ 'entries': entries,
+ }
# Look for embedded (iframe) Vimeo player
mobj = re.search(
if mobj is not None:
return self.url_result(mobj.group(1), 'Mpora')
- # Look for embedded Novamov player
+ # Look for embedded NovaMov player
mobj = re.search(
r'<iframe[^>]+?src=(["\'])(?P<url>http://(?:(?:embed|www)\.)?novamov\.com/embed\.php.+?)\1', webpage)
if mobj is not None:
- return self.url_result(mobj.group('url'), 'Novamov')
+ return self.url_result(mobj.group('url'), 'NovaMov')
+
+ # Look for embedded NowVideo player
+ mobj = re.search(
+ r'<iframe[^>]+?src=(["\'])(?P<url>http://(?:(?:embed|www)\.)?nowvideo\.(?:ch|sx|eu)/embed\.php.+?)\1', webpage)
+ if mobj is not None:
+ return self.url_result(mobj.group('url'), 'NowVideo')
# Look for embedded Facebook player
mobj = re.search(