From 2598c0397bef67c8b4de1b5a7ea6b8aa83ba9fa8 Mon Sep 17 00:00:00 2001 From: Jose Falanga Date: Mon, 17 Aug 2026 13:12:53 -0300 Subject: [PATCH] Cloudflare detection, cache failed scrapes, cover art fallback logging --- core/boxart_itch.gd | 13 +++++++++---- plugin.json | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/core/boxart_itch.gd b/core/boxart_itch.gd index 18f2292..a2be6c3 100644 --- a/core/boxart_itch.gd +++ b/core/boxart_itch.gd @@ -62,11 +62,12 @@ func get_boxart(item: LibraryItem, kind: LAYOUT) -> Texture2D: if meta.is_empty() and game.has("url"): logger.info("Enriching metadata for: %s (url=%s)" % [title, game.get("url", "")]) meta = _fetch_game_page_metadata(game) + # Cache even empty results to avoid re-scraping on every request. if meta.is_empty(): - logger.warn("Page scrape returned no metadata for: %s" % title) - else: - _enriched[game_id] = meta - _save_enriched_meta(game_id, meta) + meta = {"screenshots": []} + logger.info("Page scrape returned no screenshots for: %s (cached as empty)" % title) + _enriched[game_id] = meta + _save_enriched_meta(game_id, meta) elif not meta.is_empty(): logger.info("Using cached metadata for: %s (%d screenshots)" % [title, meta.get("screenshots", []).size()]) else: @@ -267,6 +268,10 @@ func _fetch_game_page_metadata(game: Dictionary) -> Dictionary: logger.warn("Empty HTML response for: " + page_url) return {} + if html.find("challenge-platform") != -1 or html.find("cf-browser-verification") != -1: + logger.warn("Cloudflare challenge detected for: " + page_url) + return {} + var shot_re := RegEx.new() shot_re.compile("https://img\\.itch\\.zone/aW1hZ2Uv[^\"]*/original/[^\"]*") var screenshots: Array = [] diff --git a/plugin.json b/plugin.json index c0e577f..407892b 100644 --- a/plugin.json +++ b/plugin.json @@ -1,7 +1,7 @@ { "plugin.id": "itch-artprovider", "plugin.name": "itch.io Art Provider", - "plugin.version": "0.1.4", + "plugin.version": "0.1.5", "plugin.min-api-version": "1.1.0", "plugin.link": "https://forge.thergic.ar/jose/itchio-opengamepadui-artprovider-plugin", "plugin.source": "https://forge.thergic.ar/jose/itchio-opengamepadui-artprovider-plugin",