-from __future__ import unicode_literals
-
import re
from .common import InfoExtractor
'id': 'PracticalUnix_intro-environment',
'ext': 'mp4',
'title': 'Intro Environment',
- }
+ },
}
def _real_extract(self, url):
- mobj = re.match(self._VALID_URL, url)
+ mobj = self._match_valid_url(url)
if mobj.group('course') and mobj.group('video'): # A specific video
course = mobj.group('course')
'upload_date': None,
}
- baseUrl = 'http://openclassroom.stanford.edu/MainFolder/courses/' + course + '/videos/'
- xmlUrl = baseUrl + video + '.xml'
- mdoc = self._download_xml(xmlUrl, info['id'])
+ base_url = 'http://openclassroom.stanford.edu/MainFolder/courses/' + course + '/videos/'
+ xml_url = base_url + video + '.xml'
+ mdoc = self._download_xml(xml_url, info['id'])
try:
info['title'] = mdoc.findall('./title')[0].text
- info['url'] = baseUrl + mdoc.findall('./videoFile')[0].text
+ info['url'] = base_url + mdoc.findall('./videoFile')[0].text
except IndexError:
raise ExtractorError('Invalid metadata XML file')
return info
links = orderedSet(re.findall(r'<a href="(VideoPage\.php\?[^"]+)">', coursepage))
info['entries'] = [self.url_result(
- 'http://openclassroom.stanford.edu/MainFolder/%s' % unescapeHTML(l)
+ f'http://openclassroom.stanford.edu/MainFolder/{unescapeHTML(l)}',
) for l in links]
return info
else: # Root page
}
info['title'] = info['id']
- rootURL = 'http://openclassroom.stanford.edu/MainFolder/HomePage.php'
- rootpage = self._download_webpage(rootURL, info['id'],
+ root_url = 'http://openclassroom.stanford.edu/MainFolder/HomePage.php'
+ rootpage = self._download_webpage(root_url, info['id'],
errnote='Unable to download course info page')
links = orderedSet(re.findall(r'<a href="(CoursePage\.php\?[^"]+)">', rootpage))
info['entries'] = [self.url_result(
- 'http://openclassroom.stanford.edu/MainFolder/%s' % unescapeHTML(l)
+ f'http://openclassroom.stanford.edu/MainFolder/{unescapeHTML(l)}',
) for l in links]
return info