Skip to content

Commit 2ff8501

Browse files
Stash-KennyGKennyGDogmaDragon
authored
Add GroupAutoScraper plugin (#682)
* Add GroupAutoScraper plugin: Automatically re-scrape groups with Adult Empire URLs to update tags and studio information. Includes main script, configuration files, and README documentation. * Add SceneBetterDetails plugin: Enhance scene details rendering by preserving line breaks. Includes JavaScript and YAML configuration files. * Removing new plugin to resolve old PR. * Removing static manifest file. Per DognaDragon it is created automatically. * Update GroupAutoScraper README and add requirements.txt - Added instructions for installing Python dependencies in the README. - Included a new requirements.txt file listing necessary packages: requests and stashapp-tools. - Updated README to clarify that the plugin works across environments with installed dependencies. * Update GroupAutoScraper README to correct plugin directory path --------- Co-authored-by: KennyG <kennyg@kennyg.com> Co-authored-by: DogmaDragon <103123951+DogmaDragon@users.noreply.github.com>
1 parent 41a8ac2 commit 2ff8501

4 files changed

Lines changed: 477 additions & 0 deletions

File tree

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: GroupAutoScraper
2+
description: Automatically re-scrape groups that have an Adult Empire URL to pickup tags and studio for the group.
3+
url: https://github.com/stashapp/CommunityScripts
4+
version: 1.1.0
5+
exec:
6+
- python
7+
- "{pluginDir}/autoScraper.py"
8+
interface: raw
9+
hooks:
10+
- name: hook_group_auto_scraper
11+
description: Re-scrape group on create when it has a URL.
12+
triggeredBy:
13+
- Group.Create.Post
14+

plugins/GroupAutoScraper/README.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# GroupAutoScraper
2+
3+
Automatically re-scrape groups that have a supported URL and merge the scraped data back into the group.
4+
5+
## What it does
6+
7+
- **Trigger**
8+
- Listens to the **`Group.Create.Post`** hook only.
9+
- **URL filter**
10+
- If the group has no URLs, the plugin exits quietly (no changes).
11+
- If the first URL does **not** contain `adultdvdempire.com/`, the plugin logs:
12+
- `AutoGroup only uses AdultDVDEmpire URLS. Exiting.`
13+
and exits without making any changes.
14+
- **Scrape + merge**
15+
- When the first URL *does* contain `adultdvdempire.com/`:
16+
- Calls `scrapeGroupURL(url)` for that URL.
17+
- Merges scraped data into the group and performs a `GroupUpdate`:
18+
- Uses scraped values when present, otherwise keeps existing values.
19+
- Uses `scraped.studio.stored_id` as `studio_id` only when it is not `null`.
20+
- Builds `tag_ids` from:
21+
- existing group tag IDs, plus
22+
- scraped tag entries where `stored_id` is not `null`,
23+
- then de-duplicates.
24+
- Only sends `front_image` / `back_image` when present in the scrape result so existing images are not overwritten with `null`.
25+
- **Summary logging**
26+
- On a successful update, the plugin logs a concise summary, e.g.:
27+
- `Group 9681 'Women Seeking Women Vol. 101' updated. Added 4 tag(s), set studio.`
28+
- If a studio name is scraped but cannot be resolved (no `stored_id`), the message instead reads:
29+
- `Group 9681 'Some Title' updated. Added 3 tag(s), could not set studio 'Some Studio', not found in studios.`
30+
31+
Groups without any URL, or with non-AdultDVD Empire URLs, are ignored without error.
32+
33+
## Installation
34+
35+
1. Copy this folder to your Stash plugins directory, typically:
36+
37+
- `plugins/CommunityScripts/plugins/GroupAutoScraper/`
38+
39+
2. Install Python dependencies. From this plugin's directory run:
40+
41+
```bash
42+
pip install -r requirements.txt
43+
```
44+
45+
This installs:
46+
47+
- `requests`
48+
- `stashapp-tools` (which provides the `stashapi` package used by the plugin)
49+
50+
3. Ensure the following files exist in this directory:
51+
52+
- `manifest`
53+
- `GroupAutoScraper.yml`
54+
- `autoScraper.py`
55+
- `README.md`
56+
- `requirements.txt`
57+
58+
4. In Stash, open **Settings → Plugins** and reload or restart Stash so the plugin is detected.
59+
60+
You should then see **GroupAutoScraper** listed with a hook that triggers on `Group.Create.Post`.
61+
62+
## Configuration
63+
64+
This plugin intentionally uses the **server connection information provided by Stash**:
65+
66+
- GraphQL URL, scheme, host and port come from the plugin input.
67+
- Authentication uses the Stash session cookie provided in `server_connection`.
68+
69+
As a result:
70+
71+
- **No API keys or URLs need to be hard-coded or edited in the script.**
72+
- The plugin should work across environments as long as it is installed in the correct plugins directory and the Python dependencies are installed.
73+

0 commit comments

Comments
 (0)