ThePornDatabase / stash_theporndb_scraper

A python script to scrape Stash data from thePornDB
MIT License
68 stars 18 forks source link

KeyError: 'tag' for parsing scene tag results when running scrapeScenes.py #56

Open anonymouscowards opened 12 months ago

anonymouscowards commented 12 months ago

I believe that tpdb likely changed their api results format for scenes sometime this year when it comes to scene tags. When running scrapeScenes.py and a successful hit occurs, it fails to update the scene with the following error:

ERROR:root:Scrape succeeded, but update failed:
Traceback (most recent call last):
  File "/mnt/d/GIT/stash_theporndb_scraper/scrapeScenes.py", line 752, in updateSceneFromScrape
    tag_name = tag_dict['tag'].replace('-', ' ').replace('(', '').replace(')', '').strip().title()
KeyError: 'tag'

The tag results is a list of dictionaries under 'data.tags' in the json return, simplified example below:

[
  {
    "id": 2,
    "name": "Sex"
  },
  {
    "id": 29,
    "name": "Blowjob"
  }
]

If I comment out the portion for tagging, the update succeeds (without tags). Any chance the scraper logic can be updated to account for this? Thanks!