# encoding: utf-8 from __future__ import unicode_literals import re import json import base64 import zlib from hashlib import sha1 from math import pow, sqrt, floor from .common import InfoExtractor from ..compat import ( compat_etree_fromstring, compat_urllib_parse_urlencode, compat_urllib_request, compat_urlparse, ) from ..utils import ( ExtractorError, bytes_to_intlist, intlist_to_bytes, int_or_none, lowercase_escape, remove_end, sanitized_Request, unified_strdate, urlencode_postdata, xpath_text, extract_attributes, ) from ..aes import ( aes_cbc_decrypt, ) class CrunchyrollBaseIE(InfoExtractor): _LOGIN_URL = 'https://www.crunchyroll.com/login' _LOGIN_FORM = 'login_form' _NETRC_MACHINE = 'crunchyroll' def _login(self): (username, password) = self._get_login_info() if username is None: return login_page = self._download_webpage( self._LOGIN_URL, None, 'Downloading login page') def is_logged(webpage): return '