[common] improve handling of 'user-agent' settings (#6594)

improves 5412b22dae

ignore 'extractor.user-agent' only for extractors using a custom
'User-Agent' header
This commit is contained in:
Mike Fährmann
2024-12-03 10:55:41 +01:00
parent 26163db69d
commit 57f8227473

View File

@@ -387,8 +387,8 @@ class Extractor():
useragent = self.useragent
elif useragent == "browser":
useragent = _browser_useragent()
elif useragent is config.get(("extractor",), "user-agent") and \
useragent == Extractor.useragent:
elif self.useragent is not Extractor.useragent and \
useragent is config.get(("extractor",), "user-agent"):
useragent = self.useragent
headers["User-Agent"] = useragent
headers["Accept"] = "*/*"