Skip to content

fix(Redgifs): scene-by-name passes string to to_scraped_scene expecting dict#2745

Open
nicholasdelucca wants to merge 1 commit into
stashapp:masterfrom
nicholasdelucca:fix/redgifs-scene-by-name-string-to-dict
Open

fix(Redgifs): scene-by-name passes string to to_scraped_scene expecting dict#2745
nicholasdelucca wants to merge 1 commit into
stashapp:masterfrom
nicholasdelucca:fix/redgifs-scene-by-name-string-to-dict

Conversation

@nicholasdelucca

Copy link
Copy Markdown

Summary

The scene-by-name handler in scrapers/Redgifs/Redgifs.py passes the raw identifier string directly to to_scraped_scene(), but that function expects the JSON dict returned by the RedGIFs API ({"gif": {...}, "user": {...}}).

When invoked, the function fails at line 44 trying to do data["gif"] on a string:

case "scene-by-name", {"name": identifier}:
    result = [s for s in [to_scraped_scene(identifier.strip())] if s]
                                            ^^^^^^^^^^^^^^^^^^
                                            # string, not the expected dict

Stash surfaces this as scraper script error: exit status 69.

Reproduce

In Stash UI, on a scene, run the Redgifs scraper by name. The scraper exits with status 69 and Stash logs show:

TypeError: string indices must be integers, not 'str'
  File "Redgifs.py", line 44, in to_scraped_scene
    gif = data["gif"]

Fix

Call fetch_data() first (same pattern used by scene_by_url() directly above), then pass the resulting dict to to_scraped_scene():

case "scene-by-name", {"name": identifier}:
    data = fetch_data(identifier.strip())
    result = [to_scraped_scene(data)] if data else []

Test plan

  • Manual scrape by name in Stash UI on a known scene — succeeds and returns tags/title/date/url
  • Scrape by URL (unchanged path) — still works
  • Invalid identifier — fetch_data() returns None, result is empty list, no crash

…ng dict

The scene-by-name handler was passing the raw identifier string directly to
`to_scraped_scene()`, which expects the JSON dict returned by the RedGIFs API
(`{"gif": {...}, "user": {...}}`).

This caused `TypeError: string indices must be integers, not 'str'` at line 44
where the function accesses `data["gif"]`. Stash surfaces this as
"scraper script error: exit status 69".

Fix: call `fetch_data()` first to obtain the API response, then pass the dict
to `to_scraped_scene()`. Mirrors the pattern used by `scene_by_url()` on the
line above.

Discovered while scraping a video by name in Stash UI; full traceback:

  File "Redgifs.py", line 182, in <module>
    result = [s for s in [to_scraped_scene(identifier.strip())] if s]
  File "Redgifs.py", line 44, in to_scraped_scene
    gif = data["gif"]
          ~~~~^^^^^^^
  TypeError: string indices must be integers, not 'str'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant