Skip to content

Commit

Permalink
[nsfwalbum] disable Referer headers by default (#4598)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikf committed Oct 1, 2023
1 parent 0b150d4 commit eb230e4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
13 changes: 7 additions & 6 deletions gallery_dl/extractor/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,14 @@ class Extractor():
directory_fmt = ("{category}",)
filename_fmt = "{filename}.{extension}"
archive_fmt = ""
root = ""
cookies_domain = ""
referer = True
tls12 = True
browser = None
root = ""
request_interval = 0.0
request_interval_min = 0.0
request_timestamp = 0.0
tls12 = True

def __init__(self, match):
self.log = logging.getLogger(self.category)
Expand Down Expand Up @@ -310,10 +311,10 @@ def _init_session(self):
else:
headers["Accept-Encoding"] = "gzip, deflate"

custom_referer = self.config("referer", True)
if custom_referer:
if isinstance(custom_referer, str):
headers["Referer"] = custom_referer
referer = self.config("referer", self.referer)
if referer:
if isinstance(referer, str):
headers["Referer"] = referer
elif self.root:
headers["Referer"] = self.root + "/"

Expand Down
1 change: 1 addition & 0 deletions gallery_dl/extractor/nsfwalbum.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class NsfwalbumAlbumExtractor(GalleryExtractor):
filename_fmt = "{album_id}_{num:>03}_{id}.{extension}"
directory_fmt = ("{category}", "{album_id} {title}")
archive_fmt = "{id}"
referer = False
pattern = r"(?:https?://)?(?:www\.)?nsfwalbum\.com(/album/(\d+))"
example = "https://nsfwalbum.com/album/12345"

Expand Down

0 comments on commit eb230e4

Please sign in to comment.