Download static/index.html from MetaQiu/geo: direct link, hf CLI and curl.
- Browser
- Download file 30 kB
-
https://huggingface.co/spaces/MetaQiu/geo/resolve/main/static/index.html
- Command line
-
hf download hf://spaces/MetaQiu/geo/static/index.html
-
curl -L -o index.html https://huggingface.co/spaces/MetaQiu/geo/resolve/main/static/index.html
30 kB
| <html lang="zh-CN"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>IP Geo API - IP 地理位置查询</title> | |
| <link rel="preconnect" href="https://fonts.googleapis.com"> | |
| <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> | |
| <link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;600;700&display=swap" rel="stylesheet"> | |
| <style> | |
| :root { | |
| --bg-primary: #f8fafc; | |
| --bg-card: #ffffff; | |
| --bg-code: #1e293b; | |
| --accent: #0891b2; | |
| --accent-light: #ecfeff; | |
| --accent-hover: #0e7490; | |
| --green: #059669; | |
| --green-light: #ecfdf5; | |
| --text-primary: #0f172a; | |
| --text-secondary: #475569; | |
| --text-muted: #94a3b8; | |
| --border: #e2e8f0; | |
| --border-focus: #0891b2; | |
| --shadow-sm: 0 1px 2px rgba(0,0,0,0.05); | |
| --shadow-md: 0 4px 12px rgba(0,0,0,0.08); | |
| --shadow-lg: 0 12px 32px rgba(0,0,0,0.1); | |
| --radius: 16px; | |
| --radius-sm: 10px; | |
| } | |
| * { margin: 0; padding: 0; box-sizing: border-box; } | |
| body { | |
| font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif; | |
| background: var(--bg-primary); | |
| color: var(--text-primary); | |
| min-height: 100vh; | |
| display: flex; | |
| flex-direction: column; | |
| align-items: center; | |
| line-height: 1.6; | |
| } | |
| .bg-pattern { | |
| position: fixed; | |
| inset: 0; | |
| background-color: #fafaf8; | |
| background-image: | |
| linear-gradient(rgba(0,0,0,0.03) 1px, transparent 1px), | |
| linear-gradient(90deg, rgba(0,0,0,0.03) 1px, transparent 1px); | |
| background-size: 24px 24px; | |
| z-index: -1; | |
| } | |
| .container { | |
| width: 100%; | |
| max-width: 800px; | |
| padding: 24px 20px; | |
| display: flex; | |
| flex-direction: column; | |
| gap: 24px; | |
| } | |
| /* Header */ | |
| header { | |
| text-align: center; | |
| padding: 40px 0 8px; | |
| animation: fadeIn 0.6s ease-out; | |
| } | |
| h1 { | |
| font-size: 2rem; | |
| font-weight: 700; | |
| color: var(--text-primary); | |
| margin-bottom: 8px; | |
| letter-spacing: -0.5px; | |
| } | |
| .subtitle { | |
| color: var(--text-secondary); | |
| font-size: 1rem; | |
| font-weight: 400; | |
| } | |
| @keyframes fadeIn { | |
| from { opacity: 0; transform: translateY(-12px); } | |
| to { opacity: 1; transform: translateY(0); } | |
| } | |
| /* Search */ | |
| .search-section { | |
| animation: fadeIn 0.6s ease-out 0.1s backwards; | |
| } | |
| .search-box-wrapper { | |
| background: var(--bg-card); | |
| padding: 6px; | |
| border-radius: var(--radius); | |
| border: 1.5px solid var(--border); | |
| box-shadow: var(--shadow-md); | |
| transition: border-color 0.2s, box-shadow 0.2s; | |
| display: flex; | |
| align-items: center; | |
| gap: 8px; | |
| } | |
| .search-box-wrapper:focus-within { | |
| border-color: var(--border-focus); | |
| box-shadow: 0 0 0 3px rgba(8,145,178,0.1), var(--shadow-md); | |
| } | |
| .search-icon { | |
| padding-left: 14px; | |
| color: var(--text-muted); | |
| display: flex; | |
| } | |
| .search-icon svg { width: 20px; height: 20px; } | |
| .search-input { | |
| flex: 1; | |
| background: transparent; | |
| border: none; | |
| padding: 14px 0; | |
| font-size: 1.05rem; | |
| color: var(--text-primary); | |
| font-family: 'JetBrains Mono', monospace; | |
| outline: none; | |
| min-width: 0; | |
| } | |
| .search-input::placeholder { | |
| color: var(--text-muted); | |
| font-family: 'Noto Sans SC', sans-serif; | |
| font-weight: 400; | |
| } | |
| .search-actions { | |
| display: flex; | |
| gap: 6px; | |
| padding-right: 6px; | |
| } | |
| .action-btn { | |
| background: var(--bg-primary); | |
| border: 1px solid var(--border); | |
| padding: 10px 14px; | |
| border-radius: var(--radius-sm); | |
| color: var(--text-secondary); | |
| font-size: 0.875rem; | |
| font-weight: 500; | |
| cursor: pointer; | |
| transition: all 0.2s; | |
| white-space: nowrap; | |
| display: flex; | |
| align-items: center; | |
| gap: 6px; | |
| } | |
| .action-btn svg { width: 16px; height: 16px; } | |
| .action-btn:hover { | |
| background: var(--accent-light); | |
| color: var(--accent); | |
| border-color: var(--accent); | |
| } | |
| .search-btn { | |
| background: var(--accent); | |
| border: none; | |
| padding: 10px 22px; | |
| border-radius: var(--radius-sm); | |
| color: white; | |
| font-size: 0.9rem; | |
| font-weight: 600; | |
| cursor: pointer; | |
| transition: all 0.2s; | |
| display: flex; | |
| align-items: center; | |
| justify-content: center; | |
| min-width: 76px; | |
| } | |
| .search-btn:hover { | |
| background: var(--accent-hover); | |
| box-shadow: 0 2px 8px rgba(8,145,178,0.3); | |
| } | |
| .search-btn:active { transform: scale(0.97); } | |
| .search-btn.loading { pointer-events: none; opacity: 0.7; } | |
| .spinner { | |
| width: 18px; | |
| height: 18px; | |
| border: 2.5px solid rgba(255,255,255,0.3); | |
| border-top-color: white; | |
| border-radius: 50%; | |
| animation: spin 0.7s linear infinite; | |
| display: none; | |
| } | |
| .search-btn.loading .spinner { display: block; } | |
| .search-btn.loading .btn-text { display: none; } | |
| @keyframes spin { to { transform: rotate(360deg); } } | |
| /* Results */ | |
| .result-section { | |
| min-height: 200px; | |
| animation: fadeIn 0.4s ease-out; | |
| } | |
| .result-card { | |
| background: var(--bg-card); | |
| border: 1px solid var(--border); | |
| border-radius: var(--radius); | |
| overflow: hidden; | |
| box-shadow: var(--shadow-lg); | |
| animation: slideUp 0.4s ease-out; | |
| } | |
| @keyframes slideUp { | |
| from { opacity: 0; transform: translateY(16px); } | |
| to { opacity: 1; transform: translateY(0); } | |
| } | |
| .result-header { | |
| padding: 28px 32px; | |
| background: linear-gradient(135deg, var(--accent-light) 0%, #f0fdfa 100%); | |
| display: flex; | |
| flex-direction: column; | |
| align-items: center; | |
| gap: 8px; | |
| border-bottom: 1px solid var(--border); | |
| } | |
| .result-ip { | |
| font-family: 'JetBrains Mono', monospace; | |
| font-size: 2rem; | |
| font-weight: 700; | |
| color: var(--accent); | |
| letter-spacing: 0.5px; | |
| } | |
| .result-subnet { | |
| font-family: 'JetBrains Mono', monospace; | |
| color: var(--text-muted); | |
| font-size: 0.85rem; | |
| background: rgba(8,145,178,0.08); | |
| padding: 3px 12px; | |
| border-radius: 20px; | |
| } | |
| .result-body { | |
| padding: 32px; | |
| display: grid; | |
| grid-template-columns: repeat(2, 1fr); | |
| gap: 28px; | |
| } | |
| .info-group { | |
| display: flex; | |
| flex-direction: column; | |
| gap: 20px; | |
| } | |
| .info-item { | |
| display: flex; | |
| flex-direction: column; | |
| gap: 6px; | |
| } | |
| .info-label { | |
| color: var(--text-muted); | |
| font-size: 0.75rem; | |
| font-weight: 600; | |
| text-transform: uppercase; | |
| letter-spacing: 0.5px; | |
| display: flex; | |
| align-items: center; | |
| gap: 6px; | |
| } | |
| .info-label svg { width: 14px; height: 14px; color: var(--accent); } | |
| .info-value { | |
| font-size: 1.05rem; | |
| color: var(--text-primary); | |
| font-weight: 500; | |
| } | |
| .info-value.mono { font-family: 'JetBrains Mono', monospace; } | |
| .info-value.highlight { | |
| color: var(--accent); | |
| font-weight: 600; | |
| } | |
| .location-path { | |
| display: flex; | |
| flex-wrap: wrap; | |
| align-items: center; | |
| gap: 6px; | |
| } | |
| .loc-pill { | |
| background: var(--accent-light); | |
| color: var(--accent-hover); | |
| padding: 4px 12px; | |
| border-radius: 6px; | |
| font-size: 0.9rem; | |
| font-weight: 500; | |
| } | |
| .loc-sep { | |
| color: var(--text-muted); | |
| font-size: 0.75rem; | |
| } | |
| .map-btn { | |
| margin-top: auto; | |
| background: var(--bg-primary); | |
| border: 1px dashed var(--border); | |
| border-radius: var(--radius-sm); | |
| padding: 10px; | |
| text-align: center; | |
| color: var(--text-secondary); | |
| font-size: 0.875rem; | |
| font-family: 'JetBrains Mono', monospace; | |
| cursor: pointer; | |
| transition: all 0.2s; | |
| } | |
| .map-btn:hover { | |
| border-color: var(--accent); | |
| color: var(--accent); | |
| background: var(--accent-light); | |
| } | |
| /* Map */ | |
| .map-section { | |
| display: none; | |
| animation: slideUp 0.4s ease-out; | |
| } | |
| .map-container { | |
| background: var(--bg-card); | |
| border: 1px solid var(--border); | |
| border-radius: var(--radius); | |
| overflow: hidden; | |
| box-shadow: var(--shadow-md); | |
| } | |
| .map-header { | |
| padding: 12px 20px; | |
| border-bottom: 1px solid var(--border); | |
| display: flex; | |
| align-items: center; | |
| gap: 8px; | |
| color: var(--text-secondary); | |
| font-size: 0.875rem; | |
| font-weight: 500; | |
| } | |
| .map-header svg { width: 16px; height: 16px; color: var(--accent); } | |
| .map-frame { | |
| width: 100%; | |
| height: 400px; | |
| border: none; | |
| display: block; | |
| } | |
| /* Error */ | |
| .error-state { | |
| text-align: center; | |
| padding: 40px; | |
| background: #fef2f2; | |
| border: 1px solid #fecaca; | |
| border-radius: var(--radius); | |
| color: #dc2626; | |
| } | |
| .error-state svg { | |
| width: 32px; | |
| height: 32px; | |
| margin: 0 auto 12px; | |
| color: #f87171; | |
| } | |
| /* Welcome */ | |
| .welcome-state { | |
| text-align: center; | |
| padding: 48px 20px; | |
| color: var(--text-muted); | |
| font-weight: 400; | |
| } | |
| .welcome-state p:first-child { font-size: 1rem; } | |
| .welcome-state p:last-child { font-size: 0.85rem; margin-top: 8px; opacity: 0.7; } | |
| /* Footer */ | |
| footer { | |
| margin-top: auto; | |
| padding: 32px 20px; | |
| text-align: center; | |
| color: var(--text-muted); | |
| font-size: 0.8rem; | |
| } | |
| .credits { margin-top: 6px; } | |
| .credits a { | |
| color: var(--accent); | |
| text-decoration: none; | |
| font-weight: 500; | |
| transition: color 0.2s; | |
| } | |
| .credits a:hover { color: var(--accent-hover); text-decoration: underline; } | |
| /* API Docs */ | |
| .api-docs { | |
| background: var(--bg-card); | |
| border: 1px solid var(--border); | |
| border-radius: var(--radius); | |
| padding: 28px; | |
| box-shadow: var(--shadow-sm); | |
| } | |
| .docs-title { | |
| font-size: 1.05rem; | |
| font-weight: 600; | |
| margin-bottom: 16px; | |
| color: var(--text-primary); | |
| display: flex; | |
| align-items: center; | |
| gap: 8px; | |
| } | |
| .docs-title svg { width: 18px; height: 18px; color: var(--accent); } | |
| .code-block { | |
| background: var(--bg-code); | |
| border-radius: var(--radius-sm); | |
| margin-bottom: 12px; | |
| overflow: hidden; | |
| } | |
| .code-block:last-child { margin-bottom: 0; } | |
| .code-header { | |
| background: rgba(255,255,255,0.06); | |
| padding: 8px 16px; | |
| display: flex; | |
| justify-content: space-between; | |
| align-items: center; | |
| border-bottom: 1px solid rgba(255,255,255,0.08); | |
| } | |
| .code-lang { | |
| font-size: 0.75rem; | |
| color: #94a3b8; | |
| font-weight: 600; | |
| font-family: 'JetBrains Mono', monospace; | |
| } | |
| .copy-btn { | |
| background: rgba(255,255,255,0.08); | |
| border: none; | |
| color: #94a3b8; | |
| padding: 4px 10px; | |
| border-radius: 6px; | |
| font-size: 0.75rem; | |
| cursor: pointer; | |
| transition: all 0.2s; | |
| font-family: 'Noto Sans SC', sans-serif; | |
| } | |
| .copy-btn:hover { | |
| background: rgba(255,255,255,0.15); | |
| color: white; | |
| } | |
| code { | |
| display: block; | |
| padding: 14px 16px; | |
| font-family: 'JetBrains Mono', monospace; | |
| font-size: 0.85rem; | |
| color: #e2e8f0; | |
| overflow-x: auto; | |
| white-space: pre; | |
| line-height: 1.6; | |
| } | |
| /* Responsive */ | |
| @media (max-width: 768px) { | |
| .container { padding: 16px; } | |
| header { padding: 24px 0 0; } | |
| h1 { font-size: 1.6rem; } | |
| .search-box-wrapper { | |
| flex-direction: column; | |
| padding: 10px; | |
| gap: 10px; | |
| } | |
| .search-icon { display: none; } | |
| .search-input { | |
| padding: 10px; | |
| text-align: center; | |
| width: 100%; | |
| } | |
| .search-actions { | |
| width: 100%; | |
| justify-content: center; | |
| padding: 0; | |
| } | |
| .action-btn, .search-btn { | |
| flex: 1; | |
| justify-content: center; | |
| } | |
| .result-body { | |
| grid-template-columns: 1fr; | |
| padding: 24px; | |
| gap: 20px; | |
| } | |
| .result-ip { font-size: 1.5rem; } | |
| .map-frame { height: 300px; } | |
| } | |
| /* Reduced motion */ | |
| @media (prefers-reduced-motion: reduce) { | |
| *, *::before, *::after { | |
| animation-duration: 0.01ms ; | |
| transition-duration: 0.01ms ; | |
| } | |
| } | |
| .hidden { display: none ; } | |
| </style> | |
| </head> | |
| <body> | |
| <div class="bg-pattern"></div> | |
| <div class="container"> | |
| <header> | |
| <h1>IP Geo API</h1> | |
| <p class="subtitle">IP 地理位置与归属地查询</p> | |
| </header> | |
| <section class="search-section"> | |
| <div class="search-box-wrapper"> | |
| <span class="search-icon"> | |
| <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg> | |
| </span> | |
| <input | |
| type="text" | |
| class="search-input" | |
| id="ipInput" | |
| placeholder="输入 IP 地址..." | |
| autocomplete="off" | |
| spellcheck="false" | |
| aria-label="IP 地址输入" | |
| > | |
| <div class="search-actions"> | |
| <button class="action-btn" onclick="queryMyIP()" title="查询本机IP" aria-label="查询本机IP"> | |
| <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 10c0 6-8 12-8 12s-8-6-8-12a8 8 0 0 1 16 0Z"/><circle cx="12" cy="10" r="3"/></svg> | |
| <span class="btn-label">我的 IP</span> | |
| </button> | |
| <button class="search-btn" id="searchBtn" onclick="queryIP()" aria-label="查询"> | |
| <span class="btn-text">查询</span> | |
| <div class="spinner"></div> | |
| </button> | |
| </div> | |
| </div> | |
| </section> | |
| <section class="result-section" id="resultSection"> | |
| <div class="welcome-state"> | |
| <p>输入 IP 地址开始查询</p> | |
| <p>支持 IPv4 和 IPv6</p> | |
| </div> | |
| </section> | |
| <section class="map-section" id="mapSection"> | |
| <div class="map-container"> | |
| <div class="map-header"> | |
| <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polygon points="3 6 9 3 15 6 21 3 21 18 15 21 9 18 3 21"/><line x1="9" x2="9" y1="3" y2="18"/><line x1="15" x2="15" y1="6" y2="21"/></svg> | |
| <span>位置标注</span> | |
| </div> | |
| <iframe class="map-frame" id="mapFrame" sandbox="allow-scripts allow-same-origin" title="地图"></iframe> | |
| </div> | |
| </section> | |
| <section class="api-docs"> | |
| <h2 class="docs-title"> | |
| <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m16 18 2 2 4-4"/><path d="M21 12V8.5C21 5.46 18.54 3 15.5 3h-7C5.46 3 3 5.46 3 8.5v7C3 18.54 5.46 21 8.5 21H12"/><path d="M8 8h8"/><path d="M8 12h4"/></svg> | |
| API 使用说明 | |
| </h2> | |
| <div class="code-block"> | |
| <div class="code-header"> | |
| <span class="code-lang">Shell</span> | |
| <button class="copy-btn" onclick="copyCode('curl')">复制</button> | |
| </div> | |
| <code id="code-curl"># 基础查询 | |
| curl https://geo.metaqiu.cn/api/8.8.8.8 | |
| # 精确定位(美团数据源) | |
| curl https://geo.metaqiu.cn/api/locate/8.8.8.8</code> | |
| </div> | |
| <div class="code-block"> | |
| <div class="code-header"> | |
| <span class="code-lang">Python</span> | |
| <button class="copy-btn" onclick="copyCode('py')">复制</button> | |
| </div> | |
| <code id="code-py">import requests | |
| # 基础查询 | |
| response = requests.get('https://geo.metaqiu.cn/api/8.8.8.8') | |
| print(response.json()) | |
| # 精确定位(美团数据源) | |
| response = requests.get('https://geo.metaqiu.cn/api/locate/8.8.8.8') | |
| print(response.json())</code> | |
| </div> | |
| </section> | |
| </div> | |
| <footer> | |
| <p>Powered by MaxMind GeoLite2 & GeoCN</p> | |
| <p class="credits">Made by <a href="https://metaqiu.cn" target="_blank" rel="noopener">MetaQiu</a></p> | |
| </footer> | |
| <script> | |
| </script> | |
| </body> | |
| </html> | |