[weasyl] api-key authentication (#1057)
* [weasyl] support api keys * [weasyl] document api-key authentication * [weasyl] usernames can contain ~
This commit is contained in:
@@ -1497,6 +1497,16 @@ Description
|
|||||||
See https://wallhaven.cc/help/api for more information.
|
See https://wallhaven.cc/help/api for more information.
|
||||||
|
|
||||||
|
|
||||||
|
extractor.weasyl.api-key
|
||||||
|
Type
|
||||||
|
``string``
|
||||||
|
Default
|
||||||
|
``null``
|
||||||
|
Description
|
||||||
|
Generate an API key at https://www.weasyl.com/control/apikeys
|
||||||
|
Set this field in your config to the value of that key.
|
||||||
|
|
||||||
|
|
||||||
extractor.weibo.retweets
|
extractor.weibo.retweets
|
||||||
------------------------
|
------------------------
|
||||||
Type
|
Type
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ Twitter https://twitter.com/ |twitter-C|
|
|||||||
VSCO https://vsco.co/ Collections, individual Images, User Profiles
|
VSCO https://vsco.co/ Collections, individual Images, User Profiles
|
||||||
Wallhaven https://wallhaven.cc/ individual Images, Search Results Optional (`API Key <configuration.rst#extractorwallhavenapi-key>`__)
|
Wallhaven https://wallhaven.cc/ individual Images, Search Results Optional (`API Key <configuration.rst#extractorwallhavenapi-key>`__)
|
||||||
Warosu https://warosu.org/ Threads
|
Warosu https://warosu.org/ Threads
|
||||||
Weasyl https://www.weasyl.com/ Favorites, Folders, Journals, Submissions
|
Weasyl https://www.weasyl.com/ Favorites, Folders, Journals, Submissions Optional
|
||||||
Webtoon https://www.webtoons.com/ Comics, Episodes
|
Webtoon https://www.webtoons.com/ Comics, Episodes
|
||||||
Weibo https://www.weibo.com/ Images from Statuses, User Profiles
|
Weibo https://www.weibo.com/ Images from Statuses, User Profiles
|
||||||
WikiArt.org https://www.wikiart.org/ Artists, Artist Listings, Artworks
|
WikiArt.org https://www.wikiart.org/ Artists, Artist Listings, Artworks
|
||||||
|
|||||||
@@ -30,6 +30,10 @@ class WeasylExtractor(Extractor):
|
|||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def __init__(self, match):
|
||||||
|
Extractor.__init__(self, match)
|
||||||
|
self.session.headers['X-Weasyl-API-Key'] = self.config("api-key")
|
||||||
|
|
||||||
def request_submission(self, submitid):
|
def request_submission(self, submitid):
|
||||||
return self.request(
|
return self.request(
|
||||||
"{}/api/submissions/{}/view".format(self.root, submitid)).json()
|
"{}/api/submissions/{}/view".format(self.root, submitid)).json()
|
||||||
@@ -64,7 +68,7 @@ class WeasylExtractor(Extractor):
|
|||||||
|
|
||||||
class WeasylSubmissionExtractor(WeasylExtractor):
|
class WeasylSubmissionExtractor(WeasylExtractor):
|
||||||
subcategory = "submission"
|
subcategory = "submission"
|
||||||
pattern = BASE_PATTERN + r"(?:~[\w-]+/submissions|submission)/(\d+)"
|
pattern = BASE_PATTERN + r"(?:~[\w~-]+/submissions|submission)/(\d+)"
|
||||||
test = (
|
test = (
|
||||||
("https://www.weasyl.com/~fiz/submissions/2031/a-wesley", {
|
("https://www.weasyl.com/~fiz/submissions/2031/a-wesley", {
|
||||||
"pattern": "https://cdn.weasyl.com/~fiz/submissions/2031/41ebc1c29"
|
"pattern": "https://cdn.weasyl.com/~fiz/submissions/2031/41ebc1c29"
|
||||||
@@ -105,12 +109,13 @@ class WeasylSubmissionExtractor(WeasylExtractor):
|
|||||||
|
|
||||||
class WeasylSubmissionsExtractor(WeasylExtractor):
|
class WeasylSubmissionsExtractor(WeasylExtractor):
|
||||||
subcategory = "submissions"
|
subcategory = "submissions"
|
||||||
pattern = BASE_PATTERN + r"(?:~|submissions/)([\w-]+)/?$"
|
pattern = BASE_PATTERN + r"(?:~|submissions/)([\w~-]+)/?$"
|
||||||
test = (
|
test = (
|
||||||
("https://www.weasyl.com/~tanidareal", {
|
("https://www.weasyl.com/~tanidareal", {
|
||||||
"count": ">= 200"
|
"count": ">= 200"
|
||||||
}),
|
}),
|
||||||
("https://www.weasyl.com/submissions/tanidareal"),
|
("https://www.weasyl.com/submissions/tanidareal"),
|
||||||
|
("https://www.weasyl.com/~aro~so")
|
||||||
)
|
)
|
||||||
|
|
||||||
def __init__(self, match):
|
def __init__(self, match):
|
||||||
@@ -126,7 +131,7 @@ class WeasylSubmissionsExtractor(WeasylExtractor):
|
|||||||
class WeasylFolderExtractor(WeasylExtractor):
|
class WeasylFolderExtractor(WeasylExtractor):
|
||||||
subcategory = "folder"
|
subcategory = "folder"
|
||||||
directory_fmt = ("{category}", "{owner_login}", "{folder_name}")
|
directory_fmt = ("{category}", "{owner_login}", "{folder_name}")
|
||||||
pattern = BASE_PATTERN + r"submissions/([\w-]+)\?folderid=(\d+)"
|
pattern = BASE_PATTERN + r"submissions/([\w~-]+)\?folderid=(\d+)"
|
||||||
test = ("https://www.weasyl.com/submissions/tanidareal?folderid=7403", {
|
test = ("https://www.weasyl.com/submissions/tanidareal?folderid=7403", {
|
||||||
"count": ">= 12"
|
"count": ">= 12"
|
||||||
})
|
})
|
||||||
@@ -175,7 +180,7 @@ class WeasylJournalsExtractor(WeasylExtractor):
|
|||||||
subcategory = "journals"
|
subcategory = "journals"
|
||||||
filename_fmt = "{journalid} {title}.{extension}"
|
filename_fmt = "{journalid} {title}.{extension}"
|
||||||
archive_fmt = "{journalid}"
|
archive_fmt = "{journalid}"
|
||||||
pattern = BASE_PATTERN + r"journals/([\w-]+)"
|
pattern = BASE_PATTERN + r"journals/([\w~-]+)"
|
||||||
test = ("https://www.weasyl.com/journals/charmander", {
|
test = ("https://www.weasyl.com/journals/charmander", {
|
||||||
"count": ">= 2",
|
"count": ">= 2",
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -186,6 +186,7 @@ AUTH_MAP = {
|
|||||||
"tumblr" : "Optional" + _OAUTH,
|
"tumblr" : "Optional" + _OAUTH,
|
||||||
"twitter" : "Optional",
|
"twitter" : "Optional",
|
||||||
"wallhaven" : "Optional" + _APIKEY_WH,
|
"wallhaven" : "Optional" + _APIKEY_WH,
|
||||||
|
"weasyl" : "Optional",
|
||||||
}
|
}
|
||||||
|
|
||||||
IGNORE_LIST = (
|
IGNORE_LIST = (
|
||||||
|
|||||||
Reference in New Issue
Block a user