# coding: utf-8 from __future__ import unicode_literals import re from .common import InfoExtractor from ..compat import ( compat_str, compat_urlparse, ) from ..utils import ( ExtractorError, parse_duration, url_or_none, urlencode_postdata, ) class FrontendMastersBaseIE(InfoExtractor): _API_BASE = 'https://api.frontendmasters.com/v1/kabuki' _LOGIN_URL = 'https://frontendmasters.com/login/' _NETRC_MACHINE = 'frontendmasters' _QUALITIES = { 'low': {'width': 480, 'height': 360}, 'mid': {'width': 1280, 'height': 720}, 'high': {'width': 1920, 'height': 1080} } def _perform_login(self, username, password): login_page = self._download_webpage( self._LOGIN_URL, None, 'Downloading login page') login_form = self._hidden_inputs(login_page) login_form.update({ 'username': username, 'password': password }) post_url = self._search_regex( r'