diff --git a/README.rst b/README.rst index cbdfdfc6..4302e457 100644 --- a/README.rst +++ b/README.rst @@ -194,7 +194,7 @@ OAuth ----- *gallery-dl* supports user authentication via OAuth_ for -``deviantart``, ``flickr``, ``reddit`` and ``tumblr``. +``deviantart``, ``flickr``, ``reddit``, ``smugmug`` and ``tumblr``. This is entirely optional, but grants *gallery-dl* the ability to issue requests on your account's behalf and enables it to access resources which would otherwise be unavailable to a public user. diff --git a/docs/supportedsites.rst b/docs/supportedsites.rst index 3a7a8fcf..da6b774a 100644 --- a/docs/supportedsites.rst +++ b/docs/supportedsites.rst @@ -68,7 +68,7 @@ Sea Otter Scans https://reader.seaotterscans.com/ Chapters, Manga Sen Manga http://raw.senmanga.com/ Chapters Sense-Scans http://sensescans.com/ Chapters, Manga SlideShare https://www.slideshare.net/ Presentations -SmugMug https://www.smugmug.com/ |Albums, individ-5| +SmugMug https://www.smugmug.com/ |Albums, individ-5| Optional (OAuth) Subapics https://subapics.com/ Chapters, Manga The /b/ Archive https://thebarchive.com/ Threads Tumblr https://www.tumblr.com/ Images from Users, Likes, Posts, Tag-Searches Optional (OAuth) diff --git a/gallery_dl/extractor/oauth.py b/gallery_dl/extractor/oauth.py index 6d8a1c7a..7c682541 100644 --- a/gallery_dl/extractor/oauth.py +++ b/gallery_dl/extractor/oauth.py @@ -9,7 +9,7 @@ """Utility classes to setup OAuth and link a users account to gallery-dl""" from .common import Extractor, Message -from . import deviantart, flickr, reddit, tumblr +from . import deviantart, flickr, reddit, smugmug, tumblr from .. import text, oauth, config import os import urllib.parse @@ -212,6 +212,27 @@ class OAuthReddit(OAuthBase): ) +class OAuthSmugmug(OAuthBase): + subcategory = "smugmug" + pattern = ["oauth:smugmug$"] + + def __init__(self, match): + OAuthBase.__init__(self, match) + self.session = oauth.OAuth1Session( + self.oauth_config("api-key", smugmug.SmugmugAPI.API_KEY), + self.oauth_config("api-secret", smugmug.SmugmugAPI.API_SECRET), + ) + + def items(self): + yield Message.Version, 1 + + self._oauth1_authorization_flow( + "https://api.smugmug.com/services/oauth/1.0a/getRequestToken", + "https://api.smugmug.com/services/oauth/1.0a/authorize", + "https://api.smugmug.com/services/oauth/1.0a/getAccessToken", + ) + + class OAuthTumblr(OAuthBase): subcategory = "tumblr" pattern = ["oauth:tumblr$"] diff --git a/scripts/build_supportedsites.py b/scripts/build_supportedsites.py index db12075d..16567b63 100755 --- a/scripts/build_supportedsites.py +++ b/scripts/build_supportedsites.py @@ -87,6 +87,7 @@ AUTH_MAP = { "reddit" : "Optional (OAuth)", "sankaku" : "Optional", "seiga" : "Required", + "smugmug" : "Optional (OAuth)", "tumblr" : "Optional (OAuth)", }