mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-24 15:50:32 +01:00
[cookies] Detect profiles for cygwin/BSD (#3975)
Closes #3370 Authored by: moench-tegeder
This commit is contained in:
parent
5ec1b6b716
commit
dec30912a7
@ -156,30 +156,16 @@ def _extract_firefox_cookies(profile, logger):
|
|||||||
|
|
||||||
|
|
||||||
def _firefox_browser_dir():
|
def _firefox_browser_dir():
|
||||||
if sys.platform in ('linux', 'linux2'):
|
if sys.platform in ('cygwin', 'win32'):
|
||||||
return os.path.expanduser('~/.mozilla/firefox')
|
|
||||||
elif sys.platform == 'win32':
|
|
||||||
return os.path.expandvars(R'%APPDATA%\Mozilla\Firefox\Profiles')
|
return os.path.expandvars(R'%APPDATA%\Mozilla\Firefox\Profiles')
|
||||||
elif sys.platform == 'darwin':
|
elif sys.platform == 'darwin':
|
||||||
return os.path.expanduser('~/Library/Application Support/Firefox')
|
return os.path.expanduser('~/Library/Application Support/Firefox')
|
||||||
else:
|
return os.path.expanduser('~/.mozilla/firefox')
|
||||||
raise ValueError(f'unsupported platform: {sys.platform}')
|
|
||||||
|
|
||||||
|
|
||||||
def _get_chromium_based_browser_settings(browser_name):
|
def _get_chromium_based_browser_settings(browser_name):
|
||||||
# https://chromium.googlesource.com/chromium/src/+/HEAD/docs/user_data_dir.md
|
# https://chromium.googlesource.com/chromium/src/+/HEAD/docs/user_data_dir.md
|
||||||
if sys.platform in ('linux', 'linux2'):
|
if sys.platform in ('cygwin', 'win32'):
|
||||||
config = _config_home()
|
|
||||||
browser_dir = {
|
|
||||||
'brave': os.path.join(config, 'BraveSoftware/Brave-Browser'),
|
|
||||||
'chrome': os.path.join(config, 'google-chrome'),
|
|
||||||
'chromium': os.path.join(config, 'chromium'),
|
|
||||||
'edge': os.path.join(config, 'microsoft-edge'),
|
|
||||||
'opera': os.path.join(config, 'opera'),
|
|
||||||
'vivaldi': os.path.join(config, 'vivaldi'),
|
|
||||||
}[browser_name]
|
|
||||||
|
|
||||||
elif sys.platform == 'win32':
|
|
||||||
appdata_local = os.path.expandvars('%LOCALAPPDATA%')
|
appdata_local = os.path.expandvars('%LOCALAPPDATA%')
|
||||||
appdata_roaming = os.path.expandvars('%APPDATA%')
|
appdata_roaming = os.path.expandvars('%APPDATA%')
|
||||||
browser_dir = {
|
browser_dir = {
|
||||||
@ -203,7 +189,15 @@ def _get_chromium_based_browser_settings(browser_name):
|
|||||||
}[browser_name]
|
}[browser_name]
|
||||||
|
|
||||||
else:
|
else:
|
||||||
raise ValueError(f'unsupported platform: {sys.platform}')
|
config = _config_home()
|
||||||
|
browser_dir = {
|
||||||
|
'brave': os.path.join(config, 'BraveSoftware/Brave-Browser'),
|
||||||
|
'chrome': os.path.join(config, 'google-chrome'),
|
||||||
|
'chromium': os.path.join(config, 'chromium'),
|
||||||
|
'edge': os.path.join(config, 'microsoft-edge'),
|
||||||
|
'opera': os.path.join(config, 'opera'),
|
||||||
|
'vivaldi': os.path.join(config, 'vivaldi'),
|
||||||
|
}[browser_name]
|
||||||
|
|
||||||
# Linux keyring names can be determined by snooping on dbus while opening the browser in KDE:
|
# Linux keyring names can be determined by snooping on dbus while opening the browser in KDE:
|
||||||
# dbus-monitor "interface='org.kde.KWallet'" "type=method_return"
|
# dbus-monitor "interface='org.kde.KWallet'" "type=method_return"
|
||||||
|
Loading…
Reference in New Issue
Block a user