flake8 improvements

This commit is contained in:
bergoid 2023-11-04 22:17:35 +01:00
parent dd935aeda1
commit aef8a39bf3

View file

@ -1,6 +1,5 @@
import functools import functools
import json import json
from http.cookiejar import CookieJar
import urllib.parse import urllib.parse
import urllib.request import urllib.request
@ -25,6 +24,7 @@
urlencode_postdata, urlencode_postdata,
) )
def parse_year(timestamp): def parse_year(timestamp):
""" Return the first 4 characters as an int """ """ Return the first 4 characters as an int """
if isinstance(timestamp, str) and len(timestamp) >= 4: if isinstance(timestamp, str) and len(timestamp) >= 4:
@ -32,6 +32,7 @@ def parse_year(timestamp):
else: else:
return None return None
class VRTBaseIE(GigyaBaseIE): class VRTBaseIE(GigyaBaseIE):
_GEO_BYPASS = False _GEO_BYPASS = False
@ -293,9 +294,9 @@ class VrtNUIE(VRTBaseIE):
def _perform_login(self, username, password): def _perform_login(self, username, password):
login_page = self._request_webpage('https://www.vrt.be/vrtnu/sso/login', None, note='Getting session cookies', errnote='Failed to get session cookies') self._request_webpage('https://www.vrt.be/vrtnu/sso/login', None, note='Getting session cookies', errnote='Failed to get session cookies')
res = self._download_json( self._download_json(
'https://login.vrt.be/perform_login', None, data=json.dumps({ 'https://login.vrt.be/perform_login', None, data=json.dumps({
"loginID": username, "loginID": username,
"password": password, "password": password,
@ -312,7 +313,7 @@ def _real_extract(self, url):
parsed_url = urllib.parse.urlparse(url) parsed_url = urllib.parse.urlparse(url)
# 1. Obtain/refresh 'vrtnu-site_profile' tokens # 1. Obtain/refresh 'vrtnu-site_profile' tokens
res = self._request_webpage('https://www.vrt.be/vrtnu/sso/login', None, note='Getting tokens', errnote='Failed to get tokens') self._request_webpage('https://www.vrt.be/vrtnu/sso/login', None, note='Getting tokens', errnote='Failed to get tokens')
# 2. Perform GraphQL query to obtain video metadata # 2. Perform GraphQL query to obtain video metadata
headers = { headers = {