Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stashid scraping crash #8

Open
scruffynerf opened this issue Jan 27, 2024 · 1 comment
Open

stashid scraping crash #8

scruffynerf opened this issue Jan 27, 2024 · 1 comment

Comments

@scruffynerf
Copy link

using:

# Fragment Scrape
	def scrape_scene(self, source, input):
		if isinstance(source, str):
			source = {"scraper_id": source}
		if isinstance(input, (str, int)):
			input = {"scene_id": input}

		if not isinstance(source, dict):
			self.log.warning(f'Unexpected Object passed to source {type(source)}{source}\n, expecting "ScraperSourceInput" or string of scraper_id')
			return None
		if not isinstance(input, dict):
			self.log.warning(f'Unexpected Object passed to input {type(input)}{input}\n, expecting "ScrapeSingleSceneInput" or string of scene_id')
			return None

		query = """query ScrapeSingleScene($source: ScraperSourceInput!, $input: ScrapeSingleSceneInput!) {
			scrapeSingleScene(source: $source, input: $input) {
			  ...ScrapedScene
			}
		  }
		"""
		scraped_scene_list = self._callGraphQL(query, {"source": source, "input": input})["scrapeSingleScene"]
		if len(scraped_scene_list) == 0:
			return None
		else:
			return scraped_scene_list

I use:

stashresult = stash.scrape_scene(
                {"stash_box_index": stash_box_index}, 
                {"query": stash_id}
                )

and crash with error 120

If I do it directly, and avoid the Scraped Scene fragment:

query = """query ScrapeSingleScene($source: ScraperSourceInput!, $input: ScrapeSingleSceneInput!) {
			scrapeSingleScene(source: $source, input: $input) {
			  title
              }
            }"""
        stashresult = stash._callGraphQL(query, {"source": {"stash_box_index": stash_box_index} , "input": {"query": stash_id}})

No error, and I get the title as expected
result is {"scrapeSingleScene": [{"title": "whatever"}]}

Since I'm literally querying a stashid to a result from a stashbox, it's not a local issue.

solution: allow custom fragment but also need to figure out why it crashes on what should be a simple scraped result

@stg-annon
Copy link
Owner

any details in the error? I can't seem to reproduce this

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

No branches or pull requests

2 participants