def _login(self):
    (username, password) = self._get_login_info()
    if (username is None):
        return
    self._request_webpage((self._API_BASE + 'login'), None, 'Downloading login page')
    try:
        target_url = self._download_json('https://account.atresmedia.com/api/login', None, 'Logging in', headers={'Content-Type': 'application/x-www-form-urlencoded'}, data=urlencode_postdata({'username': username, 'password': password}))['targetUrl']
    except ExtractorError as e:
        self._handle_error(e, 400)
    self._request_webpage(target_url, None, 'Following Target URL')
def _login(self):
    (username, password) = self._get_login_info()
    if (username is None):
        return
    self._request_webpage((self._API_BASE + 'login'), None, 'Downloading login page')
    try:
        target_url = self._download_json('https://account.atresmedia.com/api/login', None, 'Logging in', headers={'Content-Type': 'application/x-www-form-urlencoded'}, data=urlencode_postdata({'username': username, 'password': password}))['targetUrl']
    except ExtractorError as e:
        self._handle_error(e, 400)
    self._request_webpage(target_url, None, 'Following Target URL')