# coding: utf-8 from __future__ import unicode_literals import base64 import json import re import zlib from hashlib import sha1 from math import floor, pow, sqrt from ..aes import aes_cbc_decrypt from ..compat import ( compat_etree_fromstring, compat_urllib_parse_urlencode, compat_urllib_request, compat_urlparse, ) from ..utils import ( ExtractorError, bytes_to_intlist, extract_attributes, int_or_none, intlist_to_bytes, lowercase_escape, remove_end, sanitized_Request, unified_strdate, urlencode_postdata, xpath_text, ) from .common import InfoExtractor 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 '