1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-22 02:32:33 +01:00

let extractors opt-out of cookie option usage

useful to avoid sending unnecessary cookies when all authentication
is done through OAuth tokens
This commit is contained in:
Mike Fährmann 2020-01-01 16:07:23 +01:00
parent 5ad92fc196
commit ce54b8c04c
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
8 changed files with 18 additions and 8 deletions

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright 2014-2019 Mike Fährmann # Copyright 2014-2020 Mike Fährmann
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as # it under the terms of the GNU General Public License version 2 as
@ -170,6 +170,9 @@ class Extractor():
def _init_cookies(self): def _init_cookies(self):
"""Populate the session's cookiejar""" """Populate the session's cookiejar"""
if self.cookiedomain is None:
return
cookies = self.config("cookies") cookies = self.config("cookies")
if cookies: if cookies:
if isinstance(cookies, dict): if isinstance(cookies, dict):

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright 2015-2019 Mike Fährmann # Copyright 2015-2020 Mike Fährmann
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as # it under the terms of the GNU General Public License version 2 as
@ -31,6 +31,7 @@ class DeviantartExtractor(Extractor):
category = "deviantart" category = "deviantart"
directory_fmt = ("{category}", "{username}") directory_fmt = ("{category}", "{username}")
filename_fmt = "{category}_{index}_{title}.{extension}" filename_fmt = "{category}_{index}_{title}.{extension}"
cookiedomain = None
root = "https://www.deviantart.com" root = "https://www.deviantart.com"
def __init__(self, match=None): def __init__(self, match=None):

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright 2017-2019 Mike Fährmann # Copyright 2017-2020 Mike Fährmann
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as # it under the terms of the GNU General Public License version 2 as
@ -16,6 +16,7 @@ class FlickrExtractor(Extractor):
"""Base class for flickr extractors""" """Base class for flickr extractors"""
category = "flickr" category = "flickr"
filename_fmt = "{category}_{id}.{extension}" filename_fmt = "{category}_{id}.{extension}"
cookiedomain = None
def __init__(self, match): def __init__(self, match):
Extractor.__init__(self, match) Extractor.__init__(self, match)

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright 2019 Mike Fährmann # Copyright 2019-2020 Mike Fährmann
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as # it under the terms of the GNU General Public License version 2 as
@ -19,6 +19,7 @@ class MastodonExtractor(Extractor):
directory_fmt = ("mastodon", "{instance}", "{account[username]}") directory_fmt = ("mastodon", "{instance}", "{account[username]}")
filename_fmt = "{category}_{id}_{media[id]}.{extension}" filename_fmt = "{category}_{id}_{media[id]}.{extension}"
archive_fmt = "{media[id]}" archive_fmt = "{media[id]}"
cookiedomain = None
instance = None instance = None
root = None root = None

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright 2014-2019 Mike Fährmann # Copyright 2014-2020 Mike Fährmann
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as # it under the terms of the GNU General Public License version 2 as
@ -22,6 +22,7 @@ class PixivExtractor(Extractor):
directory_fmt = ("{category}", "{user[id]} {user[account]}") directory_fmt = ("{category}", "{user[id]} {user[account]}")
filename_fmt = "{id}_p{num}.{extension}" filename_fmt = "{id}_p{num}.{extension}"
archive_fmt = "{id}{suffix}.{extension}" archive_fmt = "{id}{suffix}.{extension}"
cookiedomain = None
def __init__(self, match): def __init__(self, match):
Extractor.__init__(self, match) Extractor.__init__(self, match)

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright 2017-2019 Mike Fährmann # Copyright 2017-2020 Mike Fährmann
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as # it under the terms of the GNU General Public License version 2 as
@ -17,6 +17,7 @@ import time
class RedditExtractor(Extractor): class RedditExtractor(Extractor):
"""Base class for reddit extractors""" """Base class for reddit extractors"""
category = "reddit" category = "reddit"
cookiedomain = None
def __init__(self, match): def __init__(self, match):
Extractor.__init__(self, match) Extractor.__init__(self, match)

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright 2018-2019 Mike Fährmann # Copyright 2018-2020 Mike Fährmann
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as # it under the terms of the GNU General Public License version 2 as
@ -21,6 +21,7 @@ class SmugmugExtractor(Extractor):
category = "smugmug" category = "smugmug"
filename_fmt = ("{category}_{User[NickName]:?/_/}" filename_fmt = ("{category}_{User[NickName]:?/_/}"
"{Image[UploadKey]}_{Image[ImageKey]}.{extension}") "{Image[UploadKey]}_{Image[ImageKey]}.{extension}")
cookiedomain = None
empty_user = { empty_user = {
"Uri": "", "Uri": "",
"ResponseLevel": "Public", "ResponseLevel": "Public",

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright 2016-2019 Mike Fährmann # Copyright 2016-2020 Mike Fährmann
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as # it under the terms of the GNU General Public License version 2 as
@ -45,6 +45,7 @@ class TumblrExtractor(Extractor):
directory_fmt = ("{category}", "{name}") directory_fmt = ("{category}", "{name}")
filename_fmt = "{category}_{blog_name}_{id}_{num:>02}.{extension}" filename_fmt = "{category}_{blog_name}_{id}_{num:>02}.{extension}"
archive_fmt = "{id}_{num}" archive_fmt = "{id}_{num}"
cookiedomain = None
def __init__(self, match): def __init__(self, match):
Extractor.__init__(self, match) Extractor.__init__(self, match)