Cloudflare detection, cache failed scrapes, cover art fallback logging
All checks were successful
Build plugin / build (push) Successful in 1m15s
All checks were successful
Build plugin / build (push) Successful in 1m15s
This commit is contained in:
parent
d06cba872c
commit
2598c0397b
2 changed files with 10 additions and 5 deletions
|
|
@ -62,9 +62,10 @@ 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:
|
||||
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():
|
||||
|
|
@ -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 = []
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue