Skip to content

Commit

Permalink
migrate sites
Browse files Browse the repository at this point in the history
  • Loading branch information
nrg101 committed Jan 30, 2025
1 parent b616bd5 commit f47d03b
Show file tree
Hide file tree
Showing 7 changed files with 167 additions and 150 deletions.
31 changes: 0 additions & 31 deletions scrapers/21Naturals/21Naturals.yml

This file was deleted.

31 changes: 0 additions & 31 deletions scrapers/21Sextreme/21Sextreme.yml

This file was deleted.

40 changes: 0 additions & 40 deletions scrapers/21Sextury/21Sextury.yml

This file was deleted.

6 changes: 6 additions & 0 deletions scrapers/AdultTime/AdultTime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ name: "AdultTime"
sceneByURL:
- action: script
url:
- 21naturals.com/en/video/
- 21sextreme.com/en/video/
- 21sextury.com/en/video/
- accidentalgangbang.com/en/video/
- adamandevepictures.com/en/video/
- adulttime.com/en/video/
Expand Down Expand Up @@ -32,6 +35,7 @@ sceneByURL:
- getupclose.com/en/video/
- girlstryanal.com/en/video/
- girlsunderarrest.com/en/video/
- girlsway.com/en/video/
- givemeteens.com/en/video/
- gostuckyourself.com/en/video/
- hairyundies.com/en/video/
Expand Down Expand Up @@ -115,6 +119,7 @@ galleryByFragment:
galleryByURL:
- action: script
url:
- 21sextury.com/en/photo/
- accidentalgangbang.com/en/photo/
- adulttimepilots.com/en/photo/
- allgirlmassage.com/en/photo/
Expand All @@ -124,6 +129,7 @@ galleryByURL:
- devilstgirls.com/en/photo/
- devilstgirls.com/en/video/
- fantasymassage.com/en/photo/
- girlsway.com/en/photo/
- joymii.com/en/photo/
- mommysgirl.com/en/photo/
- nurumassage.com/en/photo/
Expand Down
150 changes: 150 additions & 0 deletions scrapers/Blowpass/Blowpass.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
"""
Stash scraper for Blowpass (Network) that uses the Algolia API Python client
"""
import json
import sys
from typing import Any

from AlgoliaAPI.AlgoliaAPI import (
ScrapedGallery,
ScrapedMovie,
gallery_from_fragment,
gallery_from_url,
movie_from_url,
performer_from_fragment,
performer_from_url,
performer_search,
scene_from_fragment,
scene_from_url,
scene_search
)

from py_common import log
from py_common.types import ScrapedScene
from py_common.util import scraper_args

channel_name_map = {
}
"""
This map just contains overrides when using a channel name as the studio
"""

network_name_map = {
}
"""
Each network_name requiring a map/override should have a key-value here
"""

serie_name_map = {
}
"""
Each serie_name requiring a map/override should have a key-value here
"""

site_map = {
}
"""
Each site found in the logic should have a key-value here
"""

def determine_studio(api_object: dict[str, Any]) -> str | None:
"""
Determine studio name from API object properties to use instead of the
`studio_name` property scraped by default
"""
available_on_site = api_object.get("availableOnSite", [])
main_channel_name = api_object.get("mainChannel", {}).get("name")
network_name = api_object.get("network_name")
serie_name = api_object.get("serie_name")
sitename_pretty = api_object.get("sitename_pretty")
log.debug(
f"available_on_site: {available_on_site}, "
f"main_channel_name: {main_channel_name}, "
f"network_name: {network_name}, "
f"serie_name: {serie_name}, "
f"sitename_pretty: {sitename_pretty}, "
)

# steps through api_scene["availableOnSite"], and picks the first match
if site_match := next(
(site for site in available_on_site if site in site_map),
None
):
log.debug(f"matched site '{site_match}'")
return site_map.get(site_match, site_match)
if serie_name in [
*serie_name_map,
]:
log.debug(f"matched serie_name '{serie_name}'")
return serie_name_map.get(serie_name, serie_name)
if main_channel_name:
log.debug(f"matched main_channel_name '{main_channel_name}'")
# most scenes have the studio name as the main channel name
return channel_name_map.get(main_channel_name, main_channel_name)
return None


def postprocess_scene(scene: ScrapedScene, api_scene: dict[str, Any]) -> ScrapedScene:
"""
Applies post-processing to the scene
"""
if studio_override := determine_studio(api_scene):
scene["studio"] = { "name": studio_override }

return scene


def postprocess_movie(movie: ScrapedMovie, api_movie: dict[str, Any]) -> ScrapedMovie:
"""
Applies post-processing to the movie
"""
if studio_override := determine_studio(api_movie):
movie["studio"] = { "name": studio_override }

return movie


def postprocess_gallery(gallery: ScrapedGallery, api_gallery: dict[str, Any]) -> ScrapedGallery:
"""
Applies post-processing to the gallery
"""
if studio_override := determine_studio(api_gallery):
gallery["studio"] = { "name": studio_override }

return gallery


if __name__ == "__main__":
op, args = scraper_args()

log.debug(f"args: {args}")
match op, args:
case "gallery-by-url", {"url": url, "extra": extra} if url and extra:
sites = extra
result = gallery_from_url(url, sites, postprocess=postprocess_gallery)
case "gallery-by-fragment", args:
sites = args.pop("extra")
result = gallery_from_fragment(args, sites, postprocess=postprocess_gallery)
case "scene-by-url", {"url": url, "extra": extra} if url and extra:
sites = extra
result = scene_from_url(url, sites, postprocess=postprocess_scene)
case "scene-by-name", {"name": name, "extra": extra} if name and extra:
sites = extra
result = scene_search(name, sites, postprocess=postprocess_scene)
case "scene-by-fragment" | "scene-by-query-fragment", args:
sites = args.pop("extra")
result = scene_from_fragment(args, sites, postprocess=postprocess_scene)
case "performer-by-url", {"url": url}:
result = performer_from_url(url)
case "performer-by-fragment", args:
result = performer_from_fragment(args)
case "performer-by-name", {"name": name, "extra": extra} if name and extra:
sites = extra
result = performer_search(name, sites)
case "movie-by-url", {"url": url} if url:
result = movie_from_url(url, postprocess=postprocess_movie)
case _:
log.error(f"Operation: {op}, arguments: {json.dumps(args)}")
sys.exit(1)

print(json.dumps(result))
19 changes: 11 additions & 8 deletions scrapers/Blowpass/Blowpass.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# requires: Algolia
# requires: AlgoliaAPI
name: Blowpass
sceneByURL:
- action: script
url:
- 1000facials.com/en/scene/
- 1000facials.com/en/video/
- blowpass.com/en/video/
- immorallive.com/en/video/
Expand All @@ -11,26 +12,28 @@ sceneByURL:
- throated.com/en/video/
script:
- python
- ../Algolia/Algolia.py
- Blowpass.py
- blowpass
- scene-by-url
sceneByFragment:
action: script
script:
- python
- ../Algolia/Algolia.py
- Blowpass.py
- blowpass
- scene-by-fragment
sceneByName:
action: script
script:
- python
- ../Algolia/Algolia.py
- Blowpass.py
- blowpass
- searchName
- scene-by-name
sceneByQueryFragment:
action: script
script:
- python
- ../Algolia/Algolia.py
- Blowpass.py
- blowpass
- validName
# Last Updated February 24, 2024
- scene-by-query-fragment
# Last Updated January 30, 2025
40 changes: 0 additions & 40 deletions scrapers/Girlsway/Girlsway.yml

This file was deleted.

0 comments on commit f47d03b

Please sign in to comment.