mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-29 02:31:25 +01:00
Compare commits
No commits in common. "c5d36421769c841ecd87c3077366ab132597d421" and "611f459b1c9ce1bc904a9990e5d8be21e2091d89" have entirely different histories.
c5d3642176
...
611f459b1c
|
@ -307,8 +307,6 @@ def _extract_chrome_cookies(browser_name, profile, keyring, logger):
|
||||||
try:
|
try:
|
||||||
cursor = _open_database_copy(cookie_database_path, tmpdir)
|
cursor = _open_database_copy(cookie_database_path, tmpdir)
|
||||||
|
|
||||||
# meta_version is necessary to determine if we need to trim the hash prefix from the cookies
|
|
||||||
# Ref: https://github.com/yt-dlp/yt-dlp/issues/6564#issuecomment-2428437307
|
|
||||||
meta_version = int(cursor.execute('SELECT value FROM meta WHERE key = "version"').fetchone()[0])
|
meta_version = int(cursor.execute('SELECT value FROM meta WHERE key = "version"').fetchone()[0])
|
||||||
decryptor = get_cookie_decryptor(
|
decryptor = get_cookie_decryptor(
|
||||||
config['browser_dir'], config['keyring_name'], logger,
|
config['browser_dir'], config['keyring_name'], logger,
|
||||||
|
@ -420,14 +418,14 @@ def get_cookie_decryptor(browser_root, browser_keyring_name, logger, *, keyring=
|
||||||
|
|
||||||
|
|
||||||
class LinuxChromeCookieDecryptor(ChromeCookieDecryptor):
|
class LinuxChromeCookieDecryptor(ChromeCookieDecryptor):
|
||||||
def __init__(self, browser_keyring_name, logger, *, keyring=None, meta_version=None):
|
def __init__(self, browser_keyring_name, logger, *, keyring=None, meta_version=0):
|
||||||
self._logger = logger
|
self._logger = logger
|
||||||
self._v10_key = self.derive_key(b'peanuts')
|
self._v10_key = self.derive_key(b'peanuts')
|
||||||
self._empty_key = self.derive_key(b'')
|
self._empty_key = self.derive_key(b'')
|
||||||
self._cookie_counts = {'v10': 0, 'v11': 0, 'other': 0}
|
self._cookie_counts = {'v10': 0, 'v11': 0, 'other': 0}
|
||||||
self._browser_keyring_name = browser_keyring_name
|
self._browser_keyring_name = browser_keyring_name
|
||||||
self._keyring = keyring
|
self._keyring = keyring
|
||||||
self._meta_version = meta_version or 0
|
self._meta_version = meta_version
|
||||||
|
|
||||||
@functools.cached_property
|
@functools.cached_property
|
||||||
def _v11_key(self):
|
def _v11_key(self):
|
||||||
|
@ -474,12 +472,12 @@ class LinuxChromeCookieDecryptor(ChromeCookieDecryptor):
|
||||||
|
|
||||||
|
|
||||||
class MacChromeCookieDecryptor(ChromeCookieDecryptor):
|
class MacChromeCookieDecryptor(ChromeCookieDecryptor):
|
||||||
def __init__(self, browser_keyring_name, logger, meta_version=None):
|
def __init__(self, browser_keyring_name, logger, meta_version=0):
|
||||||
self._logger = logger
|
self._logger = logger
|
||||||
password = _get_mac_keyring_password(browser_keyring_name, logger)
|
password = _get_mac_keyring_password(browser_keyring_name, logger)
|
||||||
self._v10_key = None if password is None else self.derive_key(password)
|
self._v10_key = None if password is None else self.derive_key(password)
|
||||||
self._cookie_counts = {'v10': 0, 'other': 0}
|
self._cookie_counts = {'v10': 0, 'other': 0}
|
||||||
self._meta_version = meta_version or 0
|
self._meta_version = meta_version
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def derive_key(password):
|
def derive_key(password):
|
||||||
|
@ -508,11 +506,11 @@ class MacChromeCookieDecryptor(ChromeCookieDecryptor):
|
||||||
|
|
||||||
|
|
||||||
class WindowsChromeCookieDecryptor(ChromeCookieDecryptor):
|
class WindowsChromeCookieDecryptor(ChromeCookieDecryptor):
|
||||||
def __init__(self, browser_root, logger, meta_version=None):
|
def __init__(self, browser_root, logger, meta_version=0):
|
||||||
self._logger = logger
|
self._logger = logger
|
||||||
self._v10_key = _get_windows_v10_key(browser_root, logger)
|
self._v10_key = _get_windows_v10_key(browser_root, logger)
|
||||||
self._cookie_counts = {'v10': 0, 'other': 0}
|
self._cookie_counts = {'v10': 0, 'other': 0}
|
||||||
self._meta_version = meta_version or 0
|
self._meta_version = meta_version
|
||||||
|
|
||||||
def decrypt(self, encrypted_value):
|
def decrypt(self, encrypted_value):
|
||||||
version = encrypted_value[:3]
|
version = encrypted_value[:3]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user