from __future__ import unicode_literals import re from .common import InfoExtractor from .wistia import WistiaIE from ..compat import compat_str from ..utils import ( clean_html, ExtractorError, get_element_by_class, urlencode_postdata, urljoin, ) class UpskillBaseIE(InfoExtractor): _LOGIN_URL = 'http://upskillcourses.com/sign_in' _NETRC_MACHINE = 'upskill' def _real_initialize(self): self._login() def _login(self): username, password = self._get_login_info() if username is None: return login_page, urlh = self._download_webpage_handle( self._LOGIN_URL, None, 'Downloading login page') login_url = compat_str(urlh.geturl()) login_form = self._hidden_inputs(login_page) login_form.update({ 'user[email]': username, 'user[password]': password, }) post_url = self._search_regex( r'