[playwright] simplify code

This commit is contained in:
Lauren Liberda 2021-06-03 14:33:14 +02:00
parent f34b024e70
commit 7787c45730

View file

@ -1,7 +1,5 @@
# coding: utf-8 # coding: utf-8
from __future__ import unicode_literals from http.cookiejar import Cookie
from .compat import compat_cookiejar_Cookie
from .utils import ( from .utils import (
ExtractorError, ExtractorError,
is_outdated_version, is_outdated_version,
@ -87,11 +85,11 @@ class PlaywrightHelper():
def _set_cookies_from_browser(self, cookies): def _set_cookies_from_browser(self, cookies):
for cookie in cookies: for cookie in cookies:
self._extractor._downloader.cookiejar.set_cookie( self._extractor._downloader.cookiejar.set_cookie(
compat_cookiejar_Cookie(0, cookie['name'], cookie['value'], cookie.get('port'), False, Cookie(0, cookie['name'], cookie['value'], cookie.get('port'), False,
cookie['domain'], False, cookie['domain'].startswith('.'), cookie['domain'], False, cookie['domain'].startswith('.'),
cookie['path'], cookie['path'] != '/', cookie['path'], cookie['path'] != '/',
cookie['secure'], cookie['expires'], cookie['secure'], cookie['expires'],
False, None, None, None)) False, None, None, None))
def open_page(self, url, display_id, browser_used='firefox', note='Opening page in %(browser)s', html=None): def open_page(self, url, display_id, browser_used='firefox', note='Opening page in %(browser)s', html=None):
pw = self.pw() pw = self.pw()