Scraper Operations¶
Operations for scraping metadata from external sources.
Bases: StashClientProtocol
Mixin for scraper-related client methods.
Functions¶
list_scrapers
async
¶
list_scrapers(
types: list[ScrapeContentType],
) -> list[Scraper]
List available scrapers filtered by content types.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
types
|
list[ScrapeContentType]
|
List of content types to filter scrapers by (GALLERY, IMAGE, MOVIE, GROUP, PERFORMER, SCENE) |
required |
Returns:
| Type | Description |
|---|---|
list[Scraper]
|
List of Scraper objects matching the requested types |
Examples:
List all scene scrapers:
scrapers = await client.list_scrapers([ScrapeContentType.SCENE])
for scraper in scrapers:
print(f"Scene scraper: {scraper.name}")
List multiple scraper types:
from stash_graphql_client.types import ScrapeContentType
scrapers = await client.list_scrapers([
ScrapeContentType.SCENE,
ScrapeContentType.PERFORMER
])
Check scraper capabilities:
scrape_single_scene
async
¶
scrape_single_scene(
source: ScraperSourceInput,
input: ScrapeSingleSceneInput,
) -> list[ScrapedScene]
Scrape for a single scene.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
ScraperSourceInput
|
Scraper source (scraper_id or stash_box_endpoint) |
required |
input
|
ScrapeSingleSceneInput
|
Scene scraping input (query, scene_id, or scene_input) |
required |
Returns:
| Type | Description |
|---|---|
list[ScrapedScene]
|
List of ScrapedScene objects |
Examples:
Scrape by query string:
source = ScraperSourceInput(scraper_id="scraper-123")
input = ScrapeSingleSceneInput(query="scene title")
scenes = await client.scrape_single_scene(source, input)
Scrape by scene ID (using fingerprints):
source = ScraperSourceInput(scraper_id="scraper-123")
input = ScrapeSingleSceneInput(scene_id="scene-456")
scenes = await client.scrape_single_scene(source, input)
Scrape from StashBox:
scrape_multi_scenes
async
¶
scrape_multi_scenes(
source: ScraperSourceInput,
input: ScrapeMultiScenesInput,
) -> list[list[ScrapedScene]]
Scrape for multiple scenes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
ScraperSourceInput
|
Scraper source (scraper_id or stash_box_endpoint) |
required |
input
|
ScrapeMultiScenesInput
|
Multi-scene scraping input (scene_ids) |
required |
Returns:
| Type | Description |
|---|---|
list[list[ScrapedScene]]
|
List of lists of ScrapedScene objects (one list per input scene) |
Examples:
Scrape multiple scenes:
scrape_single_studio
async
¶
scrape_single_studio(
source: ScraperSourceInput,
input: ScrapeSingleStudioInput,
) -> list[ScrapedStudio]
Scrape for a single studio.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
ScraperSourceInput
|
Scraper source (scraper_id or stash_box_endpoint) |
required |
input
|
ScrapeSingleStudioInput
|
Studio scraping input (query - can be name or Stash ID) |
required |
Returns:
| Type | Description |
|---|---|
list[ScrapedStudio]
|
List of ScrapedStudio objects |
Examples:
Scrape studio by name:
scrape_single_tag
async
¶
Scrape for a single tag.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
ScraperSourceInput
|
Scraper source (scraper_id or stash_box_endpoint) |
required |
input
|
ScrapeSingleTagInput
|
Tag scraping input (query - can be name or Stash ID) |
required |
Returns:
| Type | Description |
|---|---|
list[ScrapedTag]
|
List of ScrapedTag objects |
Examples:
Scrape tag by name:
source = ScraperSourceInput(scraper_id="scraper-123")
input = ScrapeSingleTagInput(query="Tag Name")
tags = await client.scrape_single_tag(source, input)
Scrape from StashBox:
scrape_single_performer
async
¶
scrape_single_performer(
source: ScraperSourceInput,
input: ScrapeSinglePerformerInput,
) -> list[ScrapedPerformer]
Scrape for a single performer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
ScraperSourceInput
|
Scraper source (scraper_id or stash_box_endpoint) |
required |
input
|
ScrapeSinglePerformerInput
|
Performer scraping input (query, performer_id, or performer_input) |
required |
Returns:
| Type | Description |
|---|---|
list[ScrapedPerformer]
|
List of ScrapedPerformer objects |
Examples:
Scrape by query string:
source = ScraperSourceInput(scraper_id="scraper-123")
input = ScrapeSinglePerformerInput(query="Performer Name")
performers = await client.scrape_single_performer(source, input)
Scrape by performer ID:
scrape_multi_performers
async
¶
scrape_multi_performers(
source: ScraperSourceInput,
input: ScrapeMultiPerformersInput,
) -> list[list[ScrapedPerformer]]
Scrape for multiple performers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
ScraperSourceInput
|
Scraper source (scraper_id or stash_box_endpoint) |
required |
input
|
ScrapeMultiPerformersInput
|
Multi-performer scraping input (performer_ids) |
required |
Returns:
| Type | Description |
|---|---|
list[list[ScrapedPerformer]]
|
List of lists of ScrapedPerformer objects (one list per input performer) |
Examples:
Scrape multiple performers:
scrape_single_gallery
async
¶
scrape_single_gallery(
source: ScraperSourceInput,
input: ScrapeSingleGalleryInput,
) -> list[ScrapedGallery]
Scrape for a single gallery.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
ScraperSourceInput
|
Scraper source (scraper_id or stash_box_endpoint) |
required |
input
|
ScrapeSingleGalleryInput
|
Gallery scraping input (query, gallery_id, or gallery_input) |
required |
Returns:
| Type | Description |
|---|---|
list[ScrapedGallery]
|
List of ScrapedGallery objects |
Examples:
Scrape by query string:
source = ScraperSourceInput(scraper_id="scraper-123")
input = ScrapeSingleGalleryInput(query="gallery title")
galleries = await client.scrape_single_gallery(source, input)
Scrape by gallery ID:
scrape_single_movie
async
¶
scrape_single_movie(
source: ScraperSourceInput,
input: ScrapeSingleMovieInput,
) -> list[ScrapedMovie]
Scrape for a single movie.
.. deprecated::
Use :meth:scrape_single_group instead.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
ScraperSourceInput
|
Scraper source (scraper_id or stash_box_endpoint) |
required |
input
|
ScrapeSingleMovieInput
|
Movie scraping input (query, movie_id, or movie_input) |
required |
Returns:
| Type | Description |
|---|---|
list[ScrapedMovie]
|
List of ScrapedMovie objects |
Examples:
Scrape by query string:
scrape_single_group
async
¶
scrape_single_group(
source: ScraperSourceInput,
input: ScrapeSingleGroupInput,
) -> list[ScrapedGroup]
Scrape for a single group.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
ScraperSourceInput
|
Scraper source (scraper_id or stash_box_endpoint) |
required |
input
|
ScrapeSingleGroupInput
|
Group scraping input (query, group_id, or group_input) |
required |
Returns:
| Type | Description |
|---|---|
list[ScrapedGroup]
|
List of ScrapedGroup objects |
Examples:
Scrape by query string:
source = ScraperSourceInput(scraper_id="scraper-123")
input = ScrapeSingleGroupInput(query="group title")
groups = await client.scrape_single_group(source, input)
Scrape by group ID:
scrape_single_image
async
¶
scrape_single_image(
source: ScraperSourceInput,
input: ScrapeSingleImageInput,
) -> list[ScrapedImage]
Scrape for a single image.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
ScraperSourceInput
|
Scraper source (scraper_id or stash_box_endpoint) |
required |
input
|
ScrapeSingleImageInput
|
Image scraping input (query, image_id, or image_input) |
required |
Returns:
| Type | Description |
|---|---|
list[ScrapedImage]
|
List of ScrapedImage objects |
Examples:
Scrape by query string:
source = ScraperSourceInput(scraper_id="scraper-123")
input = ScrapeSingleImageInput(query="image title")
images = await client.scrape_single_image(source, input)
Scrape by image ID:
scrape_url
async
¶
Scrape content based on a URL.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
url
|
str
|
The URL to scrape |
required |
ty
|
ScrapeContentType
|
Type of content to scrape (GALLERY, IMAGE, MOVIE, GROUP, PERFORMER, SCENE) |
required |
Returns:
| Type | Description |
|---|---|
Any
|
ScrapedContent union type (could be any scraped type based on ty parameter) |
Note
Returns ScrapedStudio, ScrapedTag, ScrapedScene, ScrapedGallery, ScrapedImage, ScrapedMovie, ScrapedGroup, or ScrapedPerformer depending on the content type.
Examples:
Scrape a scene from URL:
from stash_graphql_client.types import ScrapeContentType
content = await client.scrape_url(
"https://example.com/scene/123",
ScrapeContentType.SCENE
)
if content:
print(f"Scraped scene: {content.title}")
Scrape a performer from URL:
scrape_performer_url
async
¶
scrape_performer_url(url: str) -> ScrapedPerformer | None
Scrape a complete performer record based on a URL.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
url
|
str
|
The URL to scrape performer from |
required |
Returns:
| Type | Description |
|---|---|
ScrapedPerformer | None
|
ScrapedPerformer object if successful, None otherwise |
Examples:
Scrape performer from URL:
scrape_scene_url
async
¶
scrape_scene_url(url: str) -> ScrapedScene | None
Scrape a complete scene record based on a URL.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
url
|
str
|
The URL to scrape scene from |
required |
Returns:
| Type | Description |
|---|---|
ScrapedScene | None
|
ScrapedScene object if successful, None otherwise |
Examples:
Scrape scene from URL:
scrape_gallery_url
async
¶
Scrape a complete gallery record based on a URL.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
url
|
str
|
The URL to scrape gallery from |
required |
Returns:
| Type | Description |
|---|---|
ScrapedGallery | None
|
ScrapedGallery object if successful, None otherwise |
Examples:
Scrape gallery from URL:
scrape_image_url
async
¶
Scrape a complete image record based on a URL.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
url
|
str
|
The URL to scrape image from |
required |
Returns:
| Type | Description |
|---|---|
ScrapedImage | None
|
ScrapedImage object if successful, None otherwise |
Examples:
Scrape image from URL:
scrape_movie_url
async
¶
Scrape a complete movie record based on a URL.
.. deprecated::
Use :meth:scrape_group_url instead.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
url
|
str
|
The URL to scrape movie from |
required |
Returns:
| Type | Description |
|---|---|
ScrapedMovie | None
|
ScrapedMovie object if successful, None otherwise |
Examples:
Scrape movie from URL:
scrape_group_url
async
¶
Scrape a complete group record based on a URL.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
url
|
str
|
The URL to scrape group from |
required |
Returns:
| Type | Description |
|---|---|
ScrapedGroup | None
|
ScrapedGroup object if successful, None otherwise |
Examples:
Scrape group from URL:
reload_scrapers
async
¶
Reload all scrapers from configuration.
Returns:
| Type | Description |
|---|---|
bool
|
True if successful, False otherwise |
Examples:
Reload scrapers after configuration change:
submit_stashbox_fingerprints
async
¶
submit_stashbox_fingerprints(
input_data: StashBoxFingerprintSubmissionInput
| dict[str, Any],
) -> bool
Submit fingerprints to StashBox.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_data
|
StashBoxFingerprintSubmissionInput | dict[str, Any]
|
StashBoxFingerprintSubmissionInput object or dictionary |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if successful |
submit_stashbox_scene_draft
async
¶
Submit scene draft to StashBox.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_data
|
StashBoxDraftSubmissionInput | dict[str, Any]
|
StashBoxDraftSubmissionInput object or dictionary |
required |
Returns:
| Type | Description |
|---|---|
str
|
Draft ID |
submit_stashbox_performer_draft
async
¶
submit_stashbox_performer_draft(
input_data: StashBoxDraftSubmissionInput
| dict[str, Any],
) -> str
Submit performer draft to StashBox.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_data
|
StashBoxDraftSubmissionInput | dict[str, Any]
|
StashBoxDraftSubmissionInput object or dictionary |
required |
Returns:
| Type | Description |
|---|---|
str
|
Draft ID |
stashbox_batch_performer_tag
async
¶
Batch tag performers from StashBox.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_data
|
dict[str, Any]
|
Batch performer tag input dictionary |
required |
Returns:
| Type | Description |
|---|---|
str
|
Job ID |
stashbox_batch_studio_tag
async
¶
Batch tag studios from StashBox.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_data
|
dict[str, Any]
|
Batch studio tag input dictionary |
required |
Returns:
| Type | Description |
|---|---|
str
|
Job ID |
stashbox_batch_tag_tag
async
¶
Batch tag tags from StashBox.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_data
|
dict[str, Any]
|
Batch tag input dictionary (StashBoxBatchTagInput) |
required |
Returns:
| Type | Description |
|---|---|
str
|
Job ID |