added functionality for pixiv and deviantart
This commit is contained in:
@@ -12,7 +12,7 @@ from app.utils.encryption import encrypt_data, decrypt_data
|
||||
|
||||
bp = Blueprint("credentials", __name__)
|
||||
|
||||
VALID_PLATFORMS = ["patreon", "subscribestar", "hentaifoundry", "discord"]
|
||||
VALID_PLATFORMS = ["patreon", "subscribestar", "hentaifoundry", "discord", "pixiv", "deviantart"]
|
||||
|
||||
|
||||
@bp.route("", methods=["GET"])
|
||||
|
||||
@@ -85,6 +85,44 @@ async def list_platforms():
|
||||
"default_config": gdl_service.get_default_config_for_platform("discord"),
|
||||
"notes": "Requires Discord user token (not bot token)",
|
||||
},
|
||||
"pixiv": {
|
||||
"name": "Pixiv",
|
||||
"description": "Download artwork from Pixiv artists",
|
||||
"requires_auth": True,
|
||||
"auth_type": "cookies",
|
||||
"url_pattern": "https://www.pixiv.net/users/{user_id}",
|
||||
"url_examples": [
|
||||
"https://www.pixiv.net/users/12345678",
|
||||
"https://www.pixiv.net/en/users/12345678",
|
||||
],
|
||||
"content_types": gdl_service.get_platform_content_types("pixiv"),
|
||||
"content_type_descriptions": {
|
||||
"all": "All artwork (illustrations and manga)",
|
||||
"illusts": "Illustrations only",
|
||||
"manga": "Manga only",
|
||||
"bookmarks": "Bookmarked works",
|
||||
},
|
||||
"default_config": gdl_service.get_default_config_for_platform("pixiv"),
|
||||
},
|
||||
"deviantart": {
|
||||
"name": "DeviantArt",
|
||||
"description": "Download artwork from DeviantArt artists",
|
||||
"requires_auth": False,
|
||||
"auth_type": "cookies",
|
||||
"url_pattern": "https://www.deviantart.com/{username}",
|
||||
"url_examples": [
|
||||
"https://www.deviantart.com/example-artist",
|
||||
"https://www.deviantart.com/example-artist/gallery",
|
||||
],
|
||||
"content_types": gdl_service.get_platform_content_types("deviantart"),
|
||||
"content_type_descriptions": {
|
||||
"all": "All deviations",
|
||||
"gallery": "Gallery artwork",
|
||||
"scraps": "Scraps folder",
|
||||
"favorites": "Favorited works",
|
||||
},
|
||||
"default_config": gdl_service.get_default_config_for_platform("deviantart"),
|
||||
},
|
||||
}
|
||||
|
||||
return jsonify({"platforms": platforms})
|
||||
@@ -95,7 +133,7 @@ async def get_platform(platform: str):
|
||||
"""Get detailed information about a specific platform."""
|
||||
gdl_service = GalleryDLService()
|
||||
|
||||
if platform not in ["patreon", "subscribestar", "hentaifoundry", "discord"]:
|
||||
if platform not in ["patreon", "subscribestar", "hentaifoundry", "discord", "pixiv", "deviantart"]:
|
||||
return jsonify({"error": f"Unknown platform: {platform}"}), 404
|
||||
|
||||
# Get the full platform info from list_platforms
|
||||
@@ -115,7 +153,7 @@ async def get_config_schema(platform: str):
|
||||
This defines what options can be set per-source for this platform.
|
||||
Useful for building dynamic forms in the frontend.
|
||||
"""
|
||||
if platform not in ["patreon", "subscribestar", "hentaifoundry", "discord"]:
|
||||
if platform not in ["patreon", "subscribestar", "hentaifoundry", "discord", "pixiv", "deviantart"]:
|
||||
return jsonify({"error": f"Unknown platform: {platform}"}), 404
|
||||
|
||||
gdl_service = GalleryDLService()
|
||||
|
||||
@@ -78,7 +78,7 @@ async def create_source():
|
||||
return jsonify({"error": f"Missing required fields: {', '.join(missing)}"}), 400
|
||||
|
||||
# Validate platform
|
||||
valid_platforms = ["patreon", "subscribestar", "hentaifoundry", "discord"]
|
||||
valid_platforms = ["patreon", "subscribestar", "hentaifoundry", "discord", "pixiv", "deviantart"]
|
||||
if data["platform"] not in valid_platforms:
|
||||
return jsonify({"error": f"Invalid platform. Must be one of: {', '.join(valid_platforms)}"}), 400
|
||||
|
||||
|
||||
@@ -232,7 +232,7 @@ async def add_source_to_subscription(subscription_id: int):
|
||||
return jsonify({"error": f"Missing required fields: {', '.join(missing)}"}), 400
|
||||
|
||||
# Validate platform
|
||||
valid_platforms = ["patreon", "subscribestar", "hentaifoundry", "discord"]
|
||||
valid_platforms = ["patreon", "subscribestar", "hentaifoundry", "discord", "pixiv", "deviantart"]
|
||||
if data["platform"] not in valid_platforms:
|
||||
return jsonify({"error": f"Invalid platform. Must be one of: {', '.join(valid_platforms)}"}), 400
|
||||
|
||||
|
||||
@@ -171,6 +171,23 @@ class GalleryDLService:
|
||||
# Deep crawling options
|
||||
"threads": True, # Include thread content for complete history
|
||||
},
|
||||
"pixiv": {
|
||||
"content_types": ["all"],
|
||||
"directory": ["{category}"],
|
||||
"filename": "{id}_{title[:50]}_{num:>02}.{extension}",
|
||||
# Content options
|
||||
"ugoira": True, # Download ugoira (animated) as WebM
|
||||
},
|
||||
"deviantart": {
|
||||
"content_types": ["all"],
|
||||
"directory": [], # Flat structure within platform folder
|
||||
"filename": "{index:>03}_{title[:50]}.{extension}",
|
||||
# Content options
|
||||
"flat": True, # Flatten folder structure
|
||||
"original": True, # Download original quality
|
||||
"mature": True, # Include mature content
|
||||
"metadata": True, # Include metadata
|
||||
},
|
||||
}
|
||||
|
||||
def __init__(self, rate_limit: Optional[float] = None):
|
||||
@@ -682,6 +699,10 @@ class GalleryDLService:
|
||||
return ["all"] # No granular control
|
||||
elif platform == "discord":
|
||||
return ["all"] # No granular control
|
||||
elif platform == "pixiv":
|
||||
return ["all", "illusts", "manga", "bookmarks"]
|
||||
elif platform == "deviantart":
|
||||
return ["all", "gallery", "scraps", "favorites"]
|
||||
else:
|
||||
return ["all"]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user