stash
This commit is contained in:
82
stash/config/scrapers/community/Twistys/Twistys.py
Normal file
82
stash/config/scrapers/community/Twistys/Twistys.py
Normal file
@@ -0,0 +1,82 @@
|
||||
import json
|
||||
import sys
|
||||
from typing import Any
|
||||
from py_common import log
|
||||
from py_common.util import dig, replace_at
|
||||
from AyloAPI.scrape import (
|
||||
gallery_from_url,
|
||||
scraper_args,
|
||||
scene_from_url,
|
||||
scene_search,
|
||||
scene_from_fragment,
|
||||
performer_from_url,
|
||||
performer_from_fragment,
|
||||
performer_search,
|
||||
movie_from_url,
|
||||
)
|
||||
|
||||
studio_map = {
|
||||
"anettedawn": "Anette Dawn",
|
||||
"twistys": "Twistys",
|
||||
"TwistysHard": "Twistys Hard",
|
||||
"whengirlsplay": "When Girls Play",
|
||||
}
|
||||
|
||||
|
||||
def twistys(obj: Any, raw: Any) -> Any:
|
||||
fixed = replace_at(
|
||||
obj, "studio", "name", replacement=lambda x: studio_map.get(x, x)
|
||||
)
|
||||
|
||||
# These are not real studios in the API, so we need to fix them up
|
||||
# if we find a better way to differentiate between these then this needs fixed
|
||||
special_studios = {
|
||||
"bf": "Blue Fantasies",
|
||||
"bo": "Busty Ones",
|
||||
"ef": "Euro Foxes",
|
||||
}
|
||||
# Scene can belong to multiple studios, we only grab the first one
|
||||
studio_name = next(
|
||||
(
|
||||
special_studios.get(c["shortName"])
|
||||
for c in dig(raw, "collections", default=[])
|
||||
if c["shortName"] in special_studios.keys()
|
||||
),
|
||||
dig(fixed, "studio", "name"),
|
||||
)
|
||||
return replace_at(
|
||||
fixed,
|
||||
"studio",
|
||||
replacement=lambda _: {"name": studio_name, "parent": {"name": "Twistys"}},
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
domains = ["twistys"]
|
||||
op, args = scraper_args()
|
||||
result = None
|
||||
|
||||
match op, args:
|
||||
case "gallery-by-url" | "gallery-by-fragment", {"url": url} if url:
|
||||
result = gallery_from_url(url, postprocess=twistys)
|
||||
case "scene-by-url", {"url": url} if url:
|
||||
result = scene_from_url(url, postprocess=twistys)
|
||||
case "scene-by-name", {"name": name} if name:
|
||||
result = scene_search(name, search_domains=domains, postprocess=twistys)
|
||||
case "scene-by-fragment" | "scene-by-query-fragment", args:
|
||||
result = scene_from_fragment(
|
||||
args, search_domains=domains, postprocess=twistys
|
||||
)
|
||||
case "performer-by-url", {"url": url}:
|
||||
result = performer_from_url(url, postprocess=twistys)
|
||||
case "performer-by-fragment", args:
|
||||
result = performer_from_fragment(args)
|
||||
case "performer-by-name", {"name": name} if name:
|
||||
result = performer_search(name, search_domains=domains, postprocess=twistys)
|
||||
case "movie-by-url", {"url": url} if url:
|
||||
result = movie_from_url(url, postprocess=twistys)
|
||||
case _:
|
||||
log.error(f"Operation: {op}, arguments: {json.dumps(args)}")
|
||||
sys.exit(1)
|
||||
|
||||
print(json.dumps(result))
|
||||
79
stash/config/scrapers/community/Twistys/Twistys.yml
Normal file
79
stash/config/scrapers/community/Twistys/Twistys.yml
Normal file
@@ -0,0 +1,79 @@
|
||||
name: Twistys
|
||||
# requires: py_common, AyloAPI
|
||||
# scrapes: Anette Dawn, Blue Fantasies, Busty Ones, Euro Foxes, Feature Film, Mom Knows Best, Nicole Graves, Turning Twistys, Twistys Hard, Twistys Teasers, When Girls Play
|
||||
galleryByURL:
|
||||
- action: script
|
||||
url:
|
||||
- twistys.com/scene/
|
||||
- twistysnetwork.com/scene/
|
||||
script:
|
||||
- python
|
||||
- Twistys.py
|
||||
- gallery-by-url
|
||||
galleryByFragment:
|
||||
action: script
|
||||
script:
|
||||
- python
|
||||
- Twistys.py
|
||||
- gallery-by-fragment
|
||||
sceneByURL:
|
||||
- action: script
|
||||
url:
|
||||
- twistys.com/scene/
|
||||
- twistysnetwork.com/scene/
|
||||
script:
|
||||
- python
|
||||
- Twistys.py
|
||||
- scene-by-url
|
||||
sceneByFragment:
|
||||
action: script
|
||||
script:
|
||||
- python
|
||||
- Twistys.py
|
||||
- scene-by-fragment
|
||||
sceneByName:
|
||||
action: script
|
||||
script:
|
||||
- python
|
||||
- Twistys.py
|
||||
- scene-by-name
|
||||
sceneByQueryFragment:
|
||||
action: script
|
||||
script:
|
||||
- python
|
||||
- Twistys.py
|
||||
- scene-by-query-fragment
|
||||
performerByName:
|
||||
action: script
|
||||
script:
|
||||
- python
|
||||
- Twistys.py
|
||||
- performer-by-name
|
||||
performerByURL:
|
||||
- action: script
|
||||
url:
|
||||
- twistys.com/model/
|
||||
- twistysnetwork.com/model/
|
||||
script:
|
||||
- python
|
||||
- Twistys.py
|
||||
- performer-by-url
|
||||
performerByFragment:
|
||||
action: script
|
||||
script:
|
||||
- python
|
||||
- Twistys.py
|
||||
- performer-by-fragment
|
||||
movieByURL:
|
||||
- action: script
|
||||
url:
|
||||
- twistys.com/movie/
|
||||
- twistysnetwork.com/movie/
|
||||
# Since scenes link to the movie we can scrape movies from scenes
|
||||
- twistys.com/scene/
|
||||
- twistysnetwork.com/scene/
|
||||
script:
|
||||
- python
|
||||
- Twistys.py
|
||||
- movie-by-url
|
||||
# Last Updated January 14, 2024
|
||||
10
stash/config/scrapers/community/Twistys/manifest
Executable file
10
stash/config/scrapers/community/Twistys/manifest
Executable file
@@ -0,0 +1,10 @@
|
||||
id: Twistys
|
||||
name: Twistys
|
||||
metadata: {}
|
||||
version: c2abfdf
|
||||
date: "2024-02-03 17:45:33"
|
||||
requires: []
|
||||
source_repository: https://stashapp.github.io/CommunityScrapers/stable/index.yml
|
||||
files:
|
||||
- Twistys.py
|
||||
- Twistys.yml
|
||||
Reference in New Issue
Block a user