Skip to content

Commit

Permalink
Cleanup logix
Browse files Browse the repository at this point in the history
  • Loading branch information
dgtlmoon committed Oct 7, 2024
1 parent 12ef8ad commit 28e498d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions changedetectionio/processors/restock_diff/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,11 +239,11 @@ def run_changedetection(self, watch, skip_when_checksum_same=True):

# Very often websites will lie about the 'availability' in the metadata, so if the scraped version says its NOT in stock, use that.
if self.fetcher.instock_data != 'None' and self.fetcher.instock_data != 'Possibly in stock':
if itemprop_availability.get('availability'):
if update_obj['restock'].get('in_stock'):
logger.warning(
f"Lie detected in the availability machine data!! when scraping said its not in stock!! itemprop was '{itemprop_availability}' and scraped from browser was '{self.fetcher.instock_data}' ")
logger.debug(f"Setting instock to FALSE, scraper found '{self.fetcher.instock_data}'")
update_obj['restock']["in_stock"] = False
logger.debug(f"Setting instock to FALSE, scraper found '{self.fetcher.instock_data}' in the body but metadata reported not-in-stock")
update_obj['restock']["in_stock"] = False

# What we store in the snapshot
price = update_obj.get('restock').get('price') if update_obj.get('restock').get('price') else ""
Expand Down

0 comments on commit 28e498d

Please sign in to comment.