1
0
mirror of https://github.com/instaloader/instaloader.git synced 2024-10-02 13:27:07 +02:00

Add versionadded directives and spacings

This commit is contained in:
Alexander Graf 2023-12-18 07:58:53 +01:00
parent bf396f0e6c
commit 7cc13ee08e
3 changed files with 7 additions and 1 deletions

View File

@ -213,6 +213,8 @@ Instaloader to login.
Cookie file path of a browser profile to load cookies from.
.. versionadded:: 4.11
.. option:: --sessionfile SESSIONFILE, -f SESSIONFILE
Path for loading and storing session key file. Defaults to

View File

@ -72,6 +72,7 @@ def filterstr_to_filterfunc(filter_str: str, item_type: type):
return filterfunc
def get_cookies_from_instagram(domain, browser, cookie_file='', cookie_name=''):
supported_browsers = {
"chrome": browser_cookie3.chrome,
@ -104,6 +105,7 @@ def get_cookies_from_instagram(domain, browser, cookie_file='', cookie_name=''):
else:
return cookies
def import_session(browser, instaloader, cookiefile):
cookie = get_cookies_from_instagram('instagram', browser, cookiefile)
if cookie is not None:
@ -114,9 +116,10 @@ def import_session(browser, instaloader, cookiefile):
instaloader.context.username = username
print(f"{username} has been successfully logged in.")
next_step_text = (f"Next: Run instaloader --login={username} 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.")
print(textwrap.fill(next_step_text))
def _main(instaloader: Instaloader, targetlist: List[str],
username: Optional[str] = None, password: Optional[str] = None,
sessionfile: Optional[str] = None,

View File

@ -212,6 +212,7 @@ class InstaloaderContext:
return requests.utils.dict_from_cookiejar(self._session.cookies)
def update_cookies(self, cookie):
""".. versionadded:: 4.11"""
self._session.cookies.update(cookie)
def load_session(self, username, sessiondata):