1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-21 18:22:30 +01:00

allow passing cookies to OAuth extractors

partially revert ce54b8c04c
This commit is contained in:
Mike Fährmann 2024-11-09 17:52:23 +01:00
parent 0e18fa395d
commit 7916c8bf77
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
7 changed files with 6 additions and 11 deletions

View File

@ -31,7 +31,7 @@ class DeviantartExtractor(Extractor):
root = "https://www.deviantart.com" root = "https://www.deviantart.com"
directory_fmt = ("{category}", "{username}") directory_fmt = ("{category}", "{username}")
filename_fmt = "{category}_{index}_{title}.{extension}" filename_fmt = "{category}_{index}_{title}.{extension}"
cookies_domain = None cookies_domain = ".deviantart.com"
cookies_names = ("auth", "auth_secure", "userinfo") cookies_names = ("auth", "auth_secure", "userinfo")
_last_request = 0 _last_request = 0
@ -399,7 +399,7 @@ class DeviantartExtractor(Extractor):
def _textcontent_to_html(self, deviation, content): def _textcontent_to_html(self, deviation, content):
html = content["html"] html = content["html"]
markup = html["markup"] markup = html.get("markup")
if not markup or markup[0] != "{": if not markup or markup[0] != "{":
return markup return markup
@ -1144,7 +1144,6 @@ class DeviantartScrapsExtractor(DeviantartExtractor):
subcategory = "scraps" subcategory = "scraps"
directory_fmt = ("{category}", "{username}", "Scraps") directory_fmt = ("{category}", "{username}", "Scraps")
archive_fmt = "s_{_username}_{index}.{extension}" archive_fmt = "s_{_username}_{index}.{extension}"
cookies_domain = ".deviantart.com"
pattern = BASE_PATTERN + r"/gallery/(?:\?catpath=)?scraps\b" pattern = BASE_PATTERN + r"/gallery/(?:\?catpath=)?scraps\b"
example = "https://www.deviantart.com/USER/gallery/scraps" example = "https://www.deviantart.com/USER/gallery/scraps"
@ -1161,7 +1160,6 @@ class DeviantartSearchExtractor(DeviantartExtractor):
subcategory = "search" subcategory = "search"
directory_fmt = ("{category}", "Search", "{search_tags}") directory_fmt = ("{category}", "Search", "{search_tags}")
archive_fmt = "Q_{search_tags}_{index}.{extension}" archive_fmt = "Q_{search_tags}_{index}.{extension}"
cookies_domain = ".deviantart.com"
pattern = (r"(?:https?://)?www\.deviantart\.com" pattern = (r"(?:https?://)?www\.deviantart\.com"
r"/search(?:/deviations)?/?\?([^#]+)") r"/search(?:/deviations)?/?\?([^#]+)")
example = "https://www.deviantart.com/search?q=QUERY" example = "https://www.deviantart.com/search?q=QUERY"
@ -1213,7 +1211,6 @@ class DeviantartGallerySearchExtractor(DeviantartExtractor):
"""Extractor for deviantart gallery searches""" """Extractor for deviantart gallery searches"""
subcategory = "gallery-search" subcategory = "gallery-search"
archive_fmt = "g_{_username}_{index}.{extension}" archive_fmt = "g_{_username}_{index}.{extension}"
cookies_domain = ".deviantart.com"
pattern = BASE_PATTERN + r"/gallery/?\?(q=[^#]+)" pattern = BASE_PATTERN + r"/gallery/?\?(q=[^#]+)"
example = "https://www.deviantart.com/USER/gallery?q=QUERY" example = "https://www.deviantart.com/USER/gallery?q=QUERY"

View File

@ -20,7 +20,6 @@ class FlickrExtractor(Extractor):
filename_fmt = "{category}_{id}.{extension}" filename_fmt = "{category}_{id}.{extension}"
directory_fmt = ("{category}", "{user[username]}") directory_fmt = ("{category}", "{user[username]}")
archive_fmt = "{id}" archive_fmt = "{id}"
cookies_domain = None
request_interval = (1.0, 2.0) request_interval = (1.0, 2.0)
request_interval_min = 0.5 request_interval_min = 0.5

View File

@ -19,7 +19,6 @@ class MastodonExtractor(BaseExtractor):
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]}"
cookies_domain = None
def __init__(self, match): def __init__(self, match):
BaseExtractor.__init__(self, match) BaseExtractor.__init__(self, match)

View File

@ -26,7 +26,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}"
cookies_domain = None cookies_domain = ".pixiv.net"
sanity_url = "https://s.pximg.net/common/images/limit_sanity_level_360.png" sanity_url = "https://s.pximg.net/common/images/limit_sanity_level_360.png"
mypixiv_url = "https://s.pximg.net/common/images/limit_mypixiv_360.png" mypixiv_url = "https://s.pximg.net/common/images/limit_mypixiv_360.png"
@ -739,7 +739,6 @@ class PixivPixivisionExtractor(PixivExtractor):
directory_fmt = ("{category}", "pixivision", directory_fmt = ("{category}", "pixivision",
"{pixivision_id} {pixivision_title}") "{pixivision_id} {pixivision_title}")
archive_fmt = "V{pixivision_id}_{id}{suffix}.{extension}" archive_fmt = "V{pixivision_id}_{id}{suffix}.{extension}"
cookies_domain = ".pixiv.net"
pattern = r"(?:https?://)?(?:www\.)?pixivision\.net/(?:en/)?a/(\d+)" pattern = r"(?:https?://)?(?:www\.)?pixivision\.net/(?:en/)?a/(\d+)"
example = "https://www.pixivision.net/en/a/12345" example = "https://www.pixivision.net/en/a/12345"

View File

@ -21,7 +21,6 @@ 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}")
cookies_domain = None
empty_user = { empty_user = {
"Uri": "", "Uri": "",
"ResponseLevel": "Public", "ResponseLevel": "Public",

View File

@ -31,7 +31,6 @@ class TumblrExtractor(Extractor):
directory_fmt = ("{category}", "{blog_name}") directory_fmt = ("{category}", "{blog_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}"
cookies_domain = None
def __init__(self, match): def __init__(self, match):
Extractor.__init__(self, match) Extractor.__init__(self, match)

View File

@ -251,6 +251,9 @@ class WeiboUserExtractor(WeiboExtractor):
pattern = USER_PATTERN + r"(?:$|#)" pattern = USER_PATTERN + r"(?:$|#)"
example = "https://weibo.com/USER" example = "https://weibo.com/USER"
def initialize(self):
pass
def items(self): def items(self):
base = "{}/u/{}?tabtype=".format(self.root, self._user_id()) base = "{}/u/{}?tabtype=".format(self.root, self._user_id())
return self._dispatch_extractors(( return self._dispatch_extractors((