show evolutions as well
All checks were successful
Build and Deploy / Build & Push Image (push) Successful in 33s

This commit is contained in:
2026-03-18 20:28:06 -06:00
parent a8e3c9b1cc
commit d48f23b022
7 changed files with 4431 additions and 106 deletions

View File

@@ -63,7 +63,10 @@ defmodule CobblemonUi.TierListScraper do
{:noreply, tier_list}
{:error, reason} ->
Logger.error("[TierListScraper] Scrape failed, keeping existing state: #{inspect(reason)}")
Logger.error(
"[TierListScraper] Scrape failed, keeping existing state: #{inspect(reason)}"
)
{:noreply, state}
end
end
@@ -110,13 +113,22 @@ defmodule CobblemonUi.TierListScraper do
case bands do
[] ->
Logger.warning("[TierListScraper] No .tierlist-band elements found — page structure may have changed")
Logger.warning(
"[TierListScraper] No .tierlist-band elements found — page structure may have changed"
)
{:error, :no_pokemon_found}
_ ->
pokemon =
Enum.flat_map(bands, fn band ->
tier = band |> Floki.attribute("data-tier") |> List.first() |> to_string() |> String.upcase()
tier =
band
|> Floki.attribute("data-tier")
|> List.first()
|> to_string()
|> String.upcase()
cards = Floki.find(band, ".tierlist-card")
Enum.flat_map(cards, fn card ->
@@ -128,7 +140,10 @@ defmodule CobblemonUi.TierListScraper do
end)
end)
Logger.info("[TierListScraper] Parsed #{length(pokemon)} pokemon across #{length(bands)} tiers")
Logger.info(
"[TierListScraper] Parsed #{length(pokemon)} pokemon across #{length(bands)} tiers"
)
{:ok, pokemon}
end
end