1
0
mirror of https://github.com/instaloader/instaloader.git synced 2024-07-07 11:42:38 +02:00

Add support for more browsers (#2258)

This commit is contained in:
Eduardo Kalinowski 2024-05-18 11:11:12 -03:00 committed by GitHub
parent 65b12d650c
commit 7d0e46798e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 6 deletions

View File

@ -202,7 +202,7 @@ Instaloader to login.
This feature requires the browser_cookie3 library. This feature requires the browser_cookie3 library.
Compatible with :option:`--cookiefile` if you want to load cookies from browser profiles. Compatible with :option:`--cookiefile` if you want to load cookies from browser profiles.
Incompatible with :option:`--login` due to potential username mismatch between user input and browser login. Incompatible with :option:`--login` due to potential username mismatch between user input and browser login.
Supported browsers: Chrome, Firefox, Edge, Opera, Safari, Brave. Supported browsers: Brave, Chrome, Chromium, Edge, Firefox, LibreWolf, Opera, Opera_GX, Safari and Vivaldi.
After loading the cookies run the :option:`--login` option as it is required to download high quality media After loading the cookies run the :option:`--login` option as it is required to download high quality media
and to make full use of Instaloader's features. and to make full use of Instaloader's features.

View File

@ -85,17 +85,22 @@ def filterstr_to_filterfunc(filter_str: str, item_type: type):
def get_cookies_from_instagram(domain, browser, cookie_file='', cookie_name=''): def get_cookies_from_instagram(domain, browser, cookie_file='', cookie_name=''):
supported_browsers = { supported_browsers = {
"chrome": browser_cookie3.chrome,
"firefox": browser_cookie3.firefox,
"edge": browser_cookie3.edge,
"brave": browser_cookie3.brave, "brave": browser_cookie3.brave,
"chrome": browser_cookie3.chrome,
"chromium": browser_cookie3.chromium,
"edge": browser_cookie3.edge,
"firefox": browser_cookie3.firefox,
"librewolf": browser_cookie3.librewolf,
"opera": browser_cookie3.opera, "opera": browser_cookie3.opera,
"safari": browser_cookie3.safari "opera_gx": browser_cookie3.opera_gx,
"safari": browser_cookie3.safari,
"vivaldi": browser_cookie3.vivaldi,
} }
if browser not in supported_browsers: if browser not in supported_browsers:
raise InvalidArgumentException("Loading cookies from the specified browser failed\n" raise InvalidArgumentException("Loading cookies from the specified browser failed\n"
"Supported browsers are Chrome, Firefox, Edge, Brave, Opera and Safari") "Supported browsers are Brave, Chrome, Chromium, Edge, Firefox, LibreWolf, "
"Opera, Opera_GX, Safari and Vivaldi")
cookies = {} cookies = {}
browser_cookies = list(supported_browsers[browser](cookie_file=cookie_file)) browser_cookies = list(supported_browsers[browser](cookie_file=cookie_file))