correcting pixiv connection functionality

This commit is contained in:
2026-02-04 12:45:31 -05:00
parent cc19bbd372
commit 2190a9c16b
8 changed files with 315 additions and 13 deletions
+2 -1
View File
@@ -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",
+8
View File
@@ -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",
+1 -1
View File
@@ -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")