Cloudflare detection, cache failed scrapes, cover art fallback logging
All checks were successful
Build plugin / build (push) Successful in 1m15s

This commit is contained in:
Jose Falanga 2026-08-17 13:12:53 -03:00
parent d06cba872c
commit 2598c0397b
2 changed files with 10 additions and 5 deletions

View file

@ -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 = []

View file

@ -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",