feature: DuckDuckGo weather widget extractor #25
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
Mort's
pkg/logic/weather2/weather2.gocurrently does ~300 lines of inline browser scraping to extract structured weather data from DuckDuckGo's weather widget. It openshttps://duckduckgo.com/?q=weather+CITY, waits 3 seconds, then does complex text parsing and attribute extraction fromdiv.react-module articleelements.This should be a proper site extractor in go-extractor's
sites/duckduckgopackage (or a newsites/duckduckgo/weathersub-package).Proposed API
Benefits
Reference
See
mort/pkg/logic/weather2/weather2.gofor the current implementation andParseWeatherFromText()for the text parsing logic.Implemented in PR #44. Added
GetWeather()method withWeatherDataandDayForecasttypes, extracting location, temperature, condition, high/low, humidity, wind, and multi-day forecast from DuckDuckGo's weather widget. Full mock-based test coverage included.