fix(Redgifs): scene-by-name passes string to to_scraped_scene expecting dict#2745
Open
nicholasdelucca wants to merge 1 commit into
Open
Conversation
…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'
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
scene-by-namehandler inscrapers/Redgifs/Redgifs.pypasses the rawidentifierstring directly toto_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: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:
Fix
Call
fetch_data()first (same pattern used byscene_by_url()directly above), then pass the resulting dict toto_scraped_scene():Test plan
fetch_data()returnsNone, result is empty list, no crash