惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
DataBreaches.Net
有赞技术团队
有赞技术团队
Jina AI
Jina AI
H
Help Net Security
D
Docker
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Blog — PlanetScale
Blog — PlanetScale
Hugging Face - Blog
Hugging Face - Blog
罗磊的独立博客
MyScale Blog
MyScale Blog
N
Netflix TechBlog - Medium
B
Blog RSS Feed
Martin Fowler
Martin Fowler
WordPress大学
WordPress大学
T
The Blog of Author Tim Ferriss
U
Unit 42
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
MongoDB | Blog
MongoDB | Blog
美团技术团队
M
MIT News - Artificial intelligence
阮一峰的网络日志
阮一峰的网络日志
博客园 - 司徒正美
Microsoft Security Blog
Microsoft Security Blog
IT之家
IT之家

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Why I Used wttr.in Instead of OpenWeatherMap for My Firef...
Weather Cloc · 2026-05-04 · via DEV Community

When building Weather & Clock Dashboard, I evaluated several weather APIs. I ended up choosing wttr.in. Here's why — and why it might be wrong for your use case.

The Options

OpenWeatherMap — The obvious choice. Free tier with 1000 calls/day. Requires API key. JSON format. Great documentation.

wttr.in — A public weather service designed for terminal/curl usage. Free, no API key, accepts city names or coordinates. Returns JSON, ASCII art, or PNG images.

WeatherAPI.com — Similar to OWM but with a slightly different free tier.

Open-Meteo — Open source weather API, completely free, no API key. Returns forecasts based on coordinates.

National Weather Service (US only) — Free, no key, but US-only.

Why wttr.in Won

1. No API key required from users

This is the biggest factor. OpenWeatherMap requires users to:

  1. Create an account
  2. Generate an API key
  3. Paste it into the extension settings
  4. Wait (new keys can take hours to activate)

wttr.in requires:

  1. Type your city name

That friction difference is enormous for install-to-active-user conversion. Every step you remove from setup increases activation rates.

2. Simple URL format

// wttr.in request
const url = `https://wttr.in/${encodeURIComponent(city)}?format=j1`;

Enter fullscreen mode Exit fullscreen mode

Compare to OWM:

// OpenWeatherMap request
const url = `https://api.openweathermap.org/data/2.5/forecast?q=${encodeURIComponent(city)}&appid=${userApiKey}&units=metric`;

Enter fullscreen mode Exit fullscreen mode

Simpler code = fewer bugs.

3. The j1 format returns exactly what I need

{
  "current_condition": [{
    "temp_C": "18",
    "weatherDesc": [{"value": "Partly cloudy"}],
    "humidity": "65",
    "windspeedKmph": "20"
  }],
  "weather": [{
    "date": "2024-01-15",
    "hourly": [{"tempC": "15", ...}],
    "maxtempC": "22",
    "mintempC": "12"
  }]
}

Enter fullscreen mode Exit fullscreen mode

Current conditions plus 3-day forecast, one request.

The Tradeoffs

wttr.in limitations

Reliability: wttr.in is a single developer's project. It could go down or rate-limit requests. It's not a commercial API with SLAs.

Rate limiting: The service does rate-limit per IP. High-traffic use (many users with the same IP, like behind corporate NAT) can get blocked.

Data source: wttr.in pulls from multiple sources. Data quality varies by region.

No API key = less control: You can't increase rate limits. You're at the mercy of the service's capacity.

When to use OpenWeatherMap instead

  • You're building a commercial product that needs reliability guarantees
  • You need weather for non-cities (coordinates only, remote areas)
  • You need hourly precision
  • You have technical users who don't mind API key setup

When wttr.in makes sense

  • You want zero-friction setup
  • Consumer-facing tool where setup friction kills activation
  • Side project or personal tool
  • Casual weather display (not financial or safety-critical)

Implementation Detail: Caching

Since wttr.in doesn't have a paid tier, I implemented aggressive caching:

const CACHE_DURATION = 30 * 60 * 1000; // 30 minutes

async function fetchWeather(city) {
  const cacheKey = `weather_${city}`;
  const cached = await browser.storage.local.get(cacheKey);

  if (cached[cacheKey]) {
    const { data, timestamp } = cached[cacheKey];
    if (Date.now() - timestamp < CACHE_DURATION) {
      return data; // Return cached data
    }
  }

  // Fetch fresh data
  const resp = await fetch(`https://wttr.in/${encodeURIComponent(city)}?format=j1`);
  const data = await resp.json();

  // Cache it
  await browser.storage.local.set({
    [cacheKey]: { data, timestamp: Date.now() }
  });

  return data;
}

Enter fullscreen mode Exit fullscreen mode

This means the API only gets called once per 30 minutes per user, not on every new tab open.

Current Status

Weather & Clock Dashboard uses wttr.in and it's working well. If the service becomes unreliable at scale, I'll add OpenWeatherMap as a fallback or primary option.

Install it on Firefox — source is on GitHub.


Curious what API you'd use for a consumer weather extension? Drop a comment — I'm considering adding OWM as an option.