show evolutions as well
All checks were successful
Build and Deploy / Build & Push Image (push) Successful in 33s
All checks were successful
Build and Deploy / Build & Push Image (push) Successful in 33s
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user