Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

feat(news): add news archive page and functionality for article exploration

fudjiab3e2661561e0
diff --git a/pages/news-archive.html b/pages/news-archive.html
new file mode 100644
index 000000000..c510cc8a5
--- /dev/null
+++ b/pages/news-archive.html
@@ -0,0 +1,157 @@
+<!doctype html>
+<html lang="en" class="cv-page">
+ <head>
+ <script>
+ /* three.ws theme boot — no-flash; runtime in /theme-switcher.js */ (function () {
+ try {
+ var m = localStorage.getItem('twx_theme');
+ var l =
+ m === 'auto'
+ ? window.matchMedia &&
+ window.matchMedia('(prefers-color-scheme: light)').matches
+ : m === 'light';
+ document.documentElement.setAttribute('data-theme', l ? 'light' : 'dark');
+ } catch (e) {
+ document.documentElement.setAttribute('data-theme', 'dark');
+ }
+ })();
+ </script>
+ <meta charset="utf-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <title>Crypto News Archive — 662k articles since 2017 · three.ws</title>
+ <meta
+ name="description"
+ content="The largest open crypto-news archive: 662,047 articles from September 2017 to today, searchable by keyword, ticker, source, sentiment, date, and language (English + Chinese)."
+ />
+ <meta property="og:type" content="website" />
+ <meta property="og:site_name" content="three.ws" />
+ <meta property="og:url" content="https://three.ws/markets/archive" />
+ <meta property="og:title" content="Crypto News Archive — 662k articles since 2017 · three.ws" />
+ <meta
+ property="og:description"
+ content="662,047 crypto news articles from 2017 to today — searchable by keyword, ticker, source, sentiment, date, and language."
+ />
+ <meta
+ property="og:image"
+ content="https://three.ws/api/page-og?s=crypto&amp;t=Crypto+News+Archive&amp;d=662%2C047+articles+from+September+2017+to+today+%E2%80%94+searchable+by+keyword%2C+ticker%2C+source%2C+sentiment%2C+date%2C+and+language.&amp;p=%2Fmarkets%2Farchive"
+ />
+ <meta property="og:image:width" content="1200" />
+ <meta property="og:image:height" content="630" />
+ <meta name="twitter:card" content="summary_large_image" />
+ <meta name="twitter:site" content="@trythreews" />
+ <meta name="twitter:title" content="Crypto News Archive — 662k articles since 2017" />
+ <meta
+ name="twitter:description"
+ content="The largest open crypto-news archive — searchable by keyword, ticker, source, sentiment, date, and language."
+ />
+ <meta
+ name="twitter:image"
+ content="https://three.ws/api/page-og?s=crypto&amp;t=Crypto+News+Archive&amp;d=662%2C047+articles+from+September+2017+to+today+%E2%80%94+searchable+by+keyword%2C+ticker%2C+source%2C+sentiment%2C+date%2C+and+language.&amp;p=%2Fmarkets%2Farchive"
+ />
+ <meta name="theme-color" content="#09090b" />
+ <link rel="icon" href="/favicon.ico" sizes="any" />
+ <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
+ <link rel="apple-touch-icon" href="/apple-touch-icon.png" />
+ <link rel="manifest" href="/site.webmanifest" />
+ <link rel="stylesheet" href="/fonts/fonts.css" />
+ <link rel="stylesheet" href="/nav.css" />
+ <link rel="stylesheet" href="/src/coin-pages.css" />
+ <link rel="stylesheet" href="/footer.css" />
+ <link rel="canonical" href="https://three.ws/markets/archive" />
+ <meta name="robots" content="index, follow, max-image-preview:large, max-snippet:-1" />
+ <meta property="og:locale" content="en_US" />
+ <meta property="og:image:alt" content="Crypto News Archive — three.ws" />
+ <script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"Dataset","name":"three.ws Crypto News Archive","description":"662,047 crypto news articles from September 2017 onward, enriched with tickers, tags, sentiment, and language. Sources include the CryptoPanic english corpus and the Odaily chinese corpus.","url":"https://three.ws/markets/archive","temporalCoverage":"2017-09/..","inLanguage":["en","zh"],"creator":{"@type":"Organization","name":"three.ws","url":"https://three.ws"}}]}</script>
+ </head>
+ <body>
+ <header><div id="nav-container"></div></header>
+ <script src="/nav.js"></script>
+
+ <main class="cv-container">
+ <nav class="cv-crumbs" aria-label="Breadcrumb">
+ <a href="/markets">Markets</a><span class="sep">/</span
+ ><span class="here">News Archive</span>
+ </nav>
+ <h1 class="cv-h1">Crypto News Archive</h1>
+ <p class="cv-sub">
+ The largest open archive of crypto news — <strong>662,047 articles</strong> from
+ September 2017 to today, in English and Chinese, every record enriched with
+ tickers, tags, and sentiment. Search a decade of market history.
+ </p>
+
+ <nav class="cv-tools" aria-label="Market tools">
+ <a class="cv-pill" href="/markets">Markets Hub</a>
+ <a class="cv-pill" href="/markets/news">News</a>
+ <a class="cv-pill" href="/markets/archive" aria-current="page">Archive</a>
+ <a class="cv-pill" href="/coins">Coins</a>
+ <a class="cv-pill" href="/heatmap">Heatmap</a>
+ <a class="cv-pill" href="/fear-greed">Fear &amp; Greed</a>
+ </nav>
+
+ <!-- Corpus stats. Hydrated by src/news-archive.js. -->
+ <section id="arc-stats" class="arc-stats" aria-label="Archive statistics"></section>
+
+ <!-- Filters. -->
+ <form id="arc-filters" class="arc-filters" aria-label="Archive filters">
+ <div class="arc-field" style="grid-column: span 2">
+ <label for="arc-q">Search</label>
+ <input id="arc-q" type="search" placeholder="bitcoin etf, mt gox, halving…" autocomplete="off" />
+ </div>
+ <div class="arc-field">
+ <label for="arc-ticker">Ticker</label>
+ <input id="arc-ticker" type="text" placeholder="BTC" maxlength="10" autocomplete="off" />
+ </div>
+ <div class="arc-field">
+ <label for="arc-source">Source</label>
+ <input id="arc-source" type="text" placeholder="coindesk, odaily…" autocomplete="off" />
+ </div>
+ <div class="arc-field">
+ <label for="arc-from">From</label>
+ <input id="arc-from" type="date" min="2017-09-01" />
+ </div>
+ <div class="arc-field">
+ <label for="arc-to">To</label>
+ <input id="arc-to" type="date" min="2017-09-01" />
+ </div>
+ <div class="arc-field">
+ <label for="arc-sentiment">Sentiment</label>
+ <select id="arc-sentiment">
+ <option value="">Any</option>
+ <option value="positive">Positive</option>
+ <option value="neutral">Neutral</option>
+ <option value="negative">Negative</option>
+ </select>
+ </div>
+ <div class="arc-field">
+ <label for="arc-lang">Language</label>
+ <select id="arc-lang">
+ <option value="">All</option>
+ <option value="en">English</option>
+ <option value="zh">中文</option>
+ </select>
+ </div>
+ <div class="arc-actions">
+ <button class="arc-btn" type="submit">Search archive</button>
+ <button class="arc-btn ghost" type="reset" id="arc-reset">Reset</button>
+ </div>
+ </form>
+
+ <!-- Year quick-jump + trending tickers. -->
+ <div id="arc-years" class="arc-years" role="group" aria-label="Jump to a year"></div>
+
+ <p id="arc-coverage" class="arc-coverage" role="status"></p>
+
+ <!-- Results. -->
+ <section id="arc-results" class="cv-section" aria-label="Archive results" aria-live="polite"></section>
+
+ <div style="display: flex; justify-content: center; margin: 1.5rem 0 0">
+ <button id="arc-more" class="cv-load-more" type="button" hidden>Load more</button>
+ </div>
+ </main>
+
+ <script type="module" src="/src/news-archive.js"></script>
+ <script src="/brand.js" defer></script>
+ <div id="footer-container"></div>
+ <script src="/footer.js"></script>
+ </body>
+</html>
diff --git a/src/news-archive.js b/src/news-archive.js
new file mode 100644
index 000000000..ef4eaa7d2
--- /dev/null
+++ b/src/news-archive.js
@@ -0,0 +1,301 @@
+// /markets/archive — explorer over the 662k-article historical archive
+// (/api/news/archive, GCS-backed). Corpus stats band, rich filters (keyword,
+// ticker, source, date range, sentiment, language), year quick-jump, trending
+// ticker chips, dense result rows with honest coverage reporting (the API
+// scans newest→oldest months and says exactly how far it got).
+
+import { escapeHtml as esc } from './shared/coin-format.js';
+
+const $ = (id) => document.getElementById(id);
+const PAGE_SIZE = 50;
+
+const state = {
+ q: '',
+ ticker: '',
+ source: '',
+ from: '',
+ to: '',
+ sentiment: '',
+ lang: '',
+ offset: 0,
+ articles: [],
+ scanned: null,
+ totalMatches: 0,
+ hasMore: false,
+ loading: false,
+ stats: null,
+};
+
+async function getJson(url) {
+ const res = await fetch(url, { headers: { accept: 'application/json' } });
+ const body = await res.json().catch(() => ({}));
+ if (!res.ok) {
+ const err = new Error(body?.message || `fetch → ${res.status}`);
+ err.status = res.status;
+ throw err;
+ }
+ return body;
+}
+
+function queryUrl(offset) {
+ const p = new URLSearchParams();
+ if (state.q) p.set('q', state.q);
+ if (state.ticker) p.set('ticker', state.ticker);
+ if (state.source) p.set('source', state.source);
+ if (state.from) p.set('start_date', state.from);
+ if (state.to) p.set('end_date', state.to);
+ if (state.sentiment) p.set('sentiment', state.sentiment);
+ if (state.lang) p.set('lang', state.lang);
+ p.set('limit', String(PAGE_SIZE));
+ p.set('offset', String(offset));
+ return `/api/news/archive?${p}`;
+}
+
+function syncUrl() {
+ const p = new URLSearchParams();
+ for (const [k, v] of Object.entries({
+ q: state.q, ticker: state.ticker, source: state.source,
+ from: state.from, to: state.to, sentiment: state.sentiment, lang: state.lang,
+ })) if (v) p.set(k, v);
+ const qs = p.toString();
+ history.replaceState(null, '', qs ? `/markets/archive?${qs}` : '/markets/archive');
+}
+
+// ── Stats band ───────────────────────────────────────────────────────────────
+
+function statCard(value, label) {
+ return `<div class="cv-stat-card"><div class="cv-mini-stat"><strong>${value}</strong><span>${label}</span></div></div>`;
+}
+
+async function loadStats() {
+ try {
+ const data = await getJson('/api/news/archive?stats=true');
+ state.stats = data.stats;
+ const s = data.stats;
+ const first = new Date(s.first_article_date);
+ const last = new Date(s.last_article_date);
+ const fmt = (d) => d.toLocaleDateString(undefined, { month: 'short', year: 'numeric' });
+ $('arc-stats').innerHTML = [
+ statCard(s.total_articles.toLocaleString(), 'articles'),
+ statCard(`${fmt(first)} → ${fmt(last)}`, 'coverage'),
+ statCard(String(data.months?.count ?? '—'), 'months of history'),
+ statCard(s.top_sources?.length >= 30 ? '100+' : String(s.top_sources?.length || '—'), 'sources'),
+ statCard('EN + 中文', 'languages'),
+ ].join('');
+ renderYears();
+ } catch {
+ $('arc-stats').innerHTML = '';
+ }
+}
+
+async function loadTrending() {
+ try {
+ const data = await getJson('/api/news/archive?trending=true');
+ if (!data.trending?.length) return;
+ const chips = data.trending
+ .slice(0, 12)
+ .map(
+ (t) =>
+ `<button class="nw-chip" type="button" data-trend="${esc(t.ticker)}" title="${t.count.toLocaleString()} mentions in the newest archive months">${esc(t.ticker)}</button>`,
+ )
+ .join('');
+ $('arc-years').insertAdjacentHTML(
+ 'beforeend',
+ `<span style="flex-basis:100%;height:0"></span><span class="arc-coverage" style="margin:0">Most covered:</span>${chips}`,
+ );
+ } catch {
+ // trending strip is decorative — the explorer works without it
+ }
+}
+
+function renderYears() {
+ const s = state.stats;
+ if (!s) return;
+ const firstYear = new Date(s.first_article_date).getUTCFullYear();
+ const lastYear = new Date(s.last_article_date).getUTCFullYear();
+ let html = '';
+ for (let y = lastYear; y >= firstYear; y--) {
+ html += `<button class="nw-tab" type="button" data-year="${y}" aria-pressed="${String(state.from === `${y}-01-01` && state.to === `${y}-12-31`)}">${y}</button>`;
+ }
+ $('arc-years').innerHTML = html;
+ loadTrending();
+}
+
+// ── Results ──────────────────────────────────────────────────────────────────
+
+function rowHtml(a) {
+ const d = a.pub_date ? new Date(a.pub_date) : null;
+ const dateStr = d && !Number.isNaN(d.getTime())
+ ? d.toLocaleDateString(undefined, { year: 'numeric', month: 'short', day: 'numeric' })
+ : '—';
+ const label = a.sentiment?.label || 'neutral';
+ const dotCls = label.includes('positive') ? 'pos' : label.includes('negative') ? 'neg' : '';
+ const readerParams = new URLSearchParams({ url: a.link || '', title: a.title, source: a.source });
+ const titleInner = a.link
+ ? `<a href="/markets/news/article?${esc(readerParams.toString())}">${esc(a.title)}</a>`
+ : esc(a.title);
+ return `
+ <div class="arc-row">
+ <span class="arc-date">${esc(dateStr)}</span>
+ <span class="nw-dot ${dotCls}" title="Sentiment: ${esc(label.replace('_', ' '))}"></span>
+ <span class="arc-title">${titleInner}${a.lang === 'zh' ? '<span class="lang">中文</span>' : ''}
+ ${(a.tickers || []).slice(0, 3).map((t) => `<button class="nw-chip" type="button" data-arc-ticker="${esc(t)}" style="margin-left:0.375rem">${esc(t)}</button>`).join('')}
+ </span>
+ <span class="arc-src">${esc(a.source)}</span>
+ </div>`;
+}
+
+function coverageText() {
+ const sc = state.scanned;
+ if (!sc) return '';
+ const fmtMonth = (m) => {
+ if (!m) return '—';
+ const [y, mo] = m.split('-');
+ return new Date(Date.UTC(+y, +mo - 1, 1)).toLocaleDateString(undefined, { month: 'short', year: 'numeric' });
+ };
+ let text = `${state.totalMatches.toLocaleString()} matches in ${fmtMonth(sc.from)} → ${fmtMonth(sc.to)}`;
+ if (!sc.complete) {
+ text += ` · ${sc.months_remaining} older months not scanned yet — narrow the date range (or use the year buttons) to search further back`;
+ }
+ return text;
+}
+
+function render() {
+ const el = $('arc-results');
+ if (!state.articles.length) {
+ el.innerHTML = `
+ <div class="cv-empty">
+ <p><strong>No archived articles match.</strong></p>
+ <p>${state.scanned && !state.scanned.complete ? 'The newest months had no hits — pick a year or date range to search deeper into the archive.' : 'Loosen a filter and try again.'}</p>
+ </div>`;
+ $('arc-coverage').textContent = coverageText();
+ $('arc-more').hidden = true;
+ return;
+ }
+ el.innerHTML = `<div class="arc-list">${state.articles.map(rowHtml).join('')}</div>`;
+ $('arc-coverage').textContent = coverageText();
+ $('arc-more').hidden = !state.hasMore;
+}
+
+async function load({ append = false } = {}) {
+ if (state.loading) return;
+ state.loading = true;
+ const el = $('arc-results');
+ const moreBtn = $('arc-more');
+ if (!append) {
+ state.offset = 0;
+ el.innerHTML = `<div class="arc-list" aria-hidden="true">${`<div class="arc-row"><span class="cv-skel" style="height:0.75rem"></span><span></span><span class="cv-skel" style="height:0.875rem"></span><span class="cv-skel" style="height:0.75rem;width:60px"></span></div>`.repeat(10)}</div>`;
+ $('arc-coverage').textContent = 'Searching the archive…';
+ } else {
+ moreBtn.disabled = true;
+ moreBtn.textContent = 'Loading…';
+ }
+ try {
+ const data = await getJson(queryUrl(append ? state.offset : 0));
+ state.articles = append ? state.articles.concat(data.articles) : data.articles;
+ state.offset = state.articles.length;
+ state.scanned = data.scanned;
+ state.totalMatches = data.total_scanned_matches;
+ state.hasMore = data.has_more && data.articles.length > 0;
+ render();
+ } catch (err) {
+ el.innerHTML = `
+ <div class="cv-empty">
+ <p><strong>The archive didn’t respond.</strong></p>
+ <p>${err.status === 429 ? 'Rate limited — wait a few seconds and retry.' : esc(err.message || 'Try again in a moment.')}</p>
+ <p><button class="arc-btn" type="button" id="arc-retry">Retry</button></p>
+ </div>`;
+ $('arc-coverage').textContent = '';
+ document.getElementById('arc-retry')?.addEventListener('click', () => load());
+ } finally {
+ state.loading = false;
+ moreBtn.disabled = false;
+ moreBtn.textContent = 'Load more';
+ }
+}
+
+// ── Events ───────────────────────────────────────────────────────────────────
+
+function readForm() {
+ state.q = $('arc-q').value.trim();
+ state.ticker = $('arc-ticker').value.trim().toUpperCase();
+ state.source = $('arc-source').value.trim();
+ state.from = $('arc-from').value;
+ state.to = $('arc-to').value;
+ state.sentiment = $('arc-sentiment').value;
+ state.lang = $('arc-lang').value;
+}
+
+function writeForm() {
+ $('arc-q').value = state.q;
+ $('arc-ticker').value = state.ticker;
+ $('arc-source').value = state.source;
+ $('arc-from').value = state.from;
+ $('arc-to').value = state.to;
+ $('arc-sentiment').value = state.sentiment;
+ $('arc-lang').value = state.lang;
+}
+
+function wireEvents() {
+ $('arc-filters').addEventListener('submit', (e) => {
+ e.preventDefault();
+ readForm();
+ syncUrl();
+ renderYears();
+ load();
+ });
+ $('arc-reset').addEventListener('click', (e) => {
+ e.preventDefault();
+ for (const k of ['q', 'ticker', 'source', 'from', 'to', 'sentiment', 'lang']) state[k] = '';
+ writeForm();
+ syncUrl();
+ renderYears();
+ load();
+ });
+ $('arc-years').addEventListener('click', (e) => {
+ const yearBtn = e.target.closest('[data-year]');
+ if (yearBtn) {
+ const y = yearBtn.dataset.year;
+ state.from = `${y}-01-01`;
+ state.to = `${y}-12-31`;
+ writeForm();
+ syncUrl();
+ renderYears();
+ load();
+ return;
+ }
+ const trend = e.target.closest('[data-trend]');
+ if (trend) {
+ state.ticker = trend.dataset.trend;
+ writeForm();
+ syncUrl();
+ load();
+ }
+ });
+ $('arc-results').addEventListener('click', (e) => {
+ const chip = e.target.closest('[data-arc-ticker]');
+ if (!chip) return;
+ state.ticker = chip.dataset.arcTicker;
+ writeForm();
+ syncUrl();
+ load();
+ });
+ $('arc-more').addEventListener('click', () => load({ append: true }));
+}
+
+function init() {
+ const p = new URLSearchParams(location.search);
+ state.q = p.get('q') || '';
+ state.ticker = (p.get('ticker') || '').toUpperCase();
+ state.source = p.get('source') || '';
+ state.from = p.get('from') || '';
+ state.to = p.get('to') || '';
+ state.sentiment = p.get('sentiment') || '';
+ state.lang = p.get('lang') || '';
+ writeForm();
+ wireEvents();
+ loadStats();
+ load();
+}
+
+init();