correcting pixiv connection functionality
This commit is contained in:
@@ -89,7 +89,7 @@ async def list_platforms():
|
||||
"name": "Pixiv",
|
||||
"description": "Download artwork from Pixiv artists",
|
||||
"requires_auth": True,
|
||||
"auth_type": "cookies",
|
||||
"auth_type": "token",
|
||||
"url_pattern": "https://www.pixiv.net/users/{user_id}",
|
||||
"url_examples": [
|
||||
"https://www.pixiv.net/users/12345678",
|
||||
@@ -103,6 +103,7 @@ async def list_platforms():
|
||||
"bookmarks": "Bookmarked works",
|
||||
},
|
||||
"default_config": gdl_service.get_default_config_for_platform("pixiv"),
|
||||
"notes": "Requires OAuth refresh token. Run 'gallery-dl oauth:pixiv' to obtain one.",
|
||||
},
|
||||
"deviantart": {
|
||||
"name": "DeviantArt",
|
||||
|
||||
@@ -387,6 +387,8 @@ class GalleryDLService:
|
||||
"please login",
|
||||
"must be logged in",
|
||||
"authentication required",
|
||||
"authenticationerror",
|
||||
"refresh-token", # Pixiv OAuth
|
||||
"session expired",
|
||||
"invalid cookie",
|
||||
"cookies are expired",
|
||||
@@ -560,6 +562,12 @@ class GalleryDLService:
|
||||
config["extractor"]["discord"] = {}
|
||||
config["extractor"]["discord"]["token"] = auth_token
|
||||
|
||||
# Add refresh token for Pixiv
|
||||
if auth_token and platform == "pixiv":
|
||||
if "pixiv" not in config["extractor"]:
|
||||
config["extractor"]["pixiv"] = {}
|
||||
config["extractor"]["pixiv"]["refresh-token"] = auth_token
|
||||
|
||||
# Write temporary config file
|
||||
with tempfile.NamedTemporaryFile(
|
||||
mode="w",
|
||||
|
||||
@@ -207,7 +207,7 @@ async def _download_source_async(source_id: int, download_id: int = None) -> dic
|
||||
cookies_path = None
|
||||
auth_token = None
|
||||
|
||||
if source_platform == "discord":
|
||||
if source_platform in ("discord", "pixiv"):
|
||||
auth_token = await cred_manager.get_token(source_platform)
|
||||
if not auth_token:
|
||||
logger.warning(f"No token for {source_platform}, download may fail")
|
||||
|
||||
Reference in New Issue
Block a user