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.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
feat(x): add guest and syndication handling, video posting and price-impact measurement for X content outcomes
nirholas0ad88fb38ac2
diff --git a/api/_lib/x-content/outcomes.js b/api/_lib/x-content/outcomes.jsindex 2947c3fc7..15bbc63af 100644--- a/api/_lib/x-content/outcomes.js+++ b/api/_lib/x-content/outcomes.js@@ -21,6 +21,7 @@// Everything is pure except the store and collectOutcomes.import { urlsIn, weightedLength } from './quality.js';+import { returnsAt } from './price-impact.js';export const OUTCOMES_KEY = 'x_content_outcomes';@@ -58,6 +59,15 @@ export const LEARNED_MIN_SAMPLE = 20;export const CALIBRATION_TEXT_CHARS = 400;export const LEARNED_POINTS_PER_UNIT = 10;export const LEARNED_POINTS_LIMIT = 15;+// The +24h $THREE return after a post is a much noisier signal than its likes+// (the whole market moves it), so it is held back until this many matured posts+// carry one, needs more posts per value, and may move the ranking only a little.+export const PRICE_MIN_SAMPLE = 20;+export const PRICE_MIN_VALUE_COUNT = 5;+// Percentage points of +24h return that count as one unit of lift.+export const PRICE_UNIT_PCT = 10;+export const PRICE_POINTS_PER_UNIT = 4;+export const PRICE_POINTS_LIMIT = 4;// Weighted length (quality.js) at which a post leaves each bucket. `long` is a// post over the standard limit, which X only allows on a Premium account.@@ -252,6 +262,20 @@ export function attributeKeys(row) {return keys;}+// ── Price ───────────────────────────────────────────────────────────────────++// Stamps each row with the +24h $THREE return after it was posted, when the+// candles say what it was. A row less than a day old, or with no price around it,+// is left unstamped (never zero), so it neither helps nor hurts any attribute.+// `candles` is the chronological series from price-impact.js loadSeries.+export function withPriceReturns(rows, candles) {+ if (!candles?.length) return rows;+ return rows.map((row) => {+ const { r24h } = returnsAt(candles, Math.floor(Date.parse(row.at) / 1000));+ return r24h === null ? row : { ...row, priceReturn24h: r24h };+ });+}+// ── Collecting ──────────────────────────────────────────────────────────────async function readTimeline({ client, now, days, limit }) {@@ -298,6 +322,7 @@ export async function collectOutcomes({retryDelayMs = READ_RETRY_MS,previous = null,settleDays = OUTCOMES_SETTLE_DAYS,+ priceSeries = null,}) {const readDays = readDaysFor(previous, { now, days, settleDays });// A read that fails part way is started again from the top: half a timeline@@ -346,7 +371,9 @@ export async function collectOutcomes({return {fetchedAt: new Date(now).toISOString(),readDays: Math.round(readDays * 10) / 10,- posts: [...fresh, ...kept].sort((a, b) => Date.parse(b.at) - Date.parse(a.at)),+ // Stamped after the merge so a stored row that predates the price read+ // (or whose day had not finished) picks its return up on a later refresh.+ posts: withPriceReturns([...fresh, ...kept], priceSeries).sort((a, b) => Date.parse(b.at) - Date.parse(a.at)),};}@@ -410,12 +437,48 @@ export function learnLifts(rows, { now = Date.now(), minAgeHours = MIN_AGE_HOURSconst shrunk = group.n < MIN_VALUE_COUNT ? 0 : delta * (group.n / (group.n + shrinkK));lifts[key] = { delta: round(delta), n: group.n, shrunk: round(shrunk) };}- return {+ const learned = {learnedAt: new Date(now).toISOString(),sample: matured.length,baseline: round(weight > 0 ? sum / weight : 0),lifts,};+ const priceLifts = learnPriceLifts(matured, { now, halfLifeDays });+ if (priceLifts) learned.priceLifts = priceLifts;+ return learned;+}++// For every attribute value, how much better or worse the $THREE price did in+// the 24 hours after posts carrying it than after posts without it, in+// percentage points, weighted and shrunk the same way as the engagement lifts.+// Null until PRICE_MIN_SAMPLE matured posts carry a measured return.+export function learnPriceLifts(matured, { now = Date.now(), halfLifeDays = HALF_LIFE_DAYS, shrinkK = SHRINK_K } = {}) {+ const rows = matured.filter((row) => Number.isFinite(row.priceReturn24h));+ if (rows.length < PRICE_MIN_SAMPLE) return null;+ let weight = 0;+ let sum = 0;+ const groups = new Map();+ for (const row of rows) {+ const w = 0.5 ** ((now - Date.parse(row.at)) / DAY / halfLifeDays);+ weight += w;+ sum += w * row.priceReturn24h;+ for (const key of attributeKeys(row)) {+ const group = groups.get(key) || { weight: 0, sum: 0, n: 0 };+ group.weight += w;+ group.sum += w * row.priceReturn24h;+ group.n += 1;+ groups.set(key, group);+ }+ }+ const lifts = {};+ for (const key of [...groups.keys()].sort()) {+ const group = groups.get(key);+ const rest = weight - group.weight;+ const delta = group.weight > 0 && rest > 1e-12 ? group.sum / group.weight - (sum - group.sum) / rest : 0;+ const shrunk = group.n < PRICE_MIN_VALUE_COUNT ? 0 : delta * (group.n / (group.n + shrinkK));+ lifts[key] = { delta: round(delta, 2), n: group.n, shrunk: round(shrunk, 2) };+ }+ return { sample: rows.length, baseline: round(sum / weight, 2), lifts };}// ── Scoring a queued item ───────────────────────────────────────────────────@@ -438,8 +501,19 @@ export function learnedScore(item, learned) {if (worst < 0) rest.splice(rest.indexOf(worst), 1);const mean = rest.length ? rest.reduce((a, b) => a + b, 0) / rest.length : 0;const points = LEARNED_POINTS_PER_UNIT * (best + worst + mean);- return {- points: round(Math.max(-LEARNED_POINTS_LIMIT, Math.min(LEARNED_POINTS_LIMIT, points)), 1),- found: found.map(({ key, shrunk }) => ({ key, shrunk })),- };+ const engagementPoints = round(Math.max(-LEARNED_POINTS_LIMIT, Math.min(LEARNED_POINTS_LIMIT, points)), 1);+ const result = { points: engagementPoints, found: found.map(({ key, shrunk }) => ({ key, shrunk })) };++ // The $THREE price after posts like this one. Averaged, never summed: the+ // attributes overlap and the market noise does not shrink with more of them.+ const priced = attributeKeys(describeItem(item))+ .map((key) => learned?.priceLifts?.lifts?.[key])+ .filter((lift) => lift && lift.n >= PRICE_MIN_VALUE_COUNT)+ .map((lift) => lift.shrunk);+ if (priced.length) {+ const pricePoints = round(Math.max(-PRICE_POINTS_LIMIT, Math.min(PRICE_POINTS_LIMIT, (PRICE_POINTS_PER_UNIT * priced.reduce((a, b) => a + b, 0)) / priced.length / PRICE_UNIT_PCT)), 1);+ result.pricePoints = pricePoints;+ result.points = round(engagementPoints + pricePoints, 1);+ }+ return result;}diff --git a/api/_lib/x-content/price-impact.js b/api/_lib/x-content/price-impact.jsnew file mode 100644index 000000000..947b091d9--- /dev/null+++ b/api/_lib/x-content/price-impact.js@@ -0,0 +1,196 @@+// What the $THREE price did after each post the account sent.+//+// Pure functions over a chronological candle series ({ t, o, h, l, c, v }, `t` in+// epoch seconds at the bar open, the shape api/_lib/market/ohlcv.js returns), plus+// one loader that pages the series from GeckoTerminal. Used by three consumers+// that must agree on the numbers: scripts/x-archive-price-impact.mjs (the archive+// report and the chart's data file), tests, and the content pipeline's learned+// lifts (outcomes.js).+//+// Two rules keep the returns honest:+// - No lookahead. A price "at" an instant is the close of the last bar that had+// finished by then, never a bar still forming.+// - No interpolation. GeckoTerminal omits bars in which nothing traded. When the+// last finished bar is older than MAX_STALE_SECONDS, or the horizon lies past+// the series, that return is null (unavailable), not a guess.++export const THREE_MINT = 'FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump';+export const HORIZONS = [+ { key: 'r1h', seconds: 3600 },+ { key: 'r4h', seconds: 4 * 3600 },+ { key: 'r24h', seconds: 24 * 3600 },+];+export const BAR_SECONDS = 900;+// A reference bar this long before the instant is still "the market at that+// moment" for a coin that trades every few minutes; older than this is a gap.+export const MAX_STALE_SECONDS = 3600;+export const PAGE_BARS = 1000;+const MAX_PAGES = 60;++const round = (value, places = 2) => Math.round(value * 10 ** places) / 10 ** places + 0;++// Close of the last bar that had finished by `tSec`, or null across a gap or+// before the series begins. `candles` is ascending by `t`.+export function priceAt(candles, tSec, barSeconds = BAR_SECONDS, maxStale = MAX_STALE_SECONDS) {+ let lo = 0;+ let hi = candles.length - 1;+ let found = -1;+ while (lo <= hi) {+ const mid = (lo + hi) >> 1;+ if (candles[mid].t + barSeconds <= tSec) {+ found = mid;+ lo = mid + 1;+ } else hi = mid - 1;+ }+ if (found < 0) return null;+ return tSec - (candles[found].t + barSeconds) <= maxStale ? candles[found].c : null;+}++// Returns in percent at each horizon for one instant. A horizon is null when+// either end of it has no price.+export function returnsAt(candles, tSec, opts = {}) {+ const base = priceAt(candles, tSec, opts.barSeconds, opts.maxStale);+ const out = { priceAtPost: base };+ for (const { key, seconds } of HORIZONS) {+ const later = base ? priceAt(candles, tSec + seconds, opts.barSeconds, opts.maxStale) : null;+ out[key] = base && later ? round((later / base - 1) * 100) : null;+ }+ return out;+}++const engagementOf = (post) => (post.likes || 0) + (post.retweets || 0) + (post.replies || 0);++// A post this account wrote as its own: not a repost of someone else, not a+// reply (replies on this account are mostly reply-farming, not announcements).+export const isOwnHeadPost = (post) => post.isOwn && !post.isRetweet && !post.isReply;++export function impactForPosts(posts, candles, opts = {}) {+ return posts+ .filter(isOwnHeadPost)+ .map((post) => {+ const atSec = Math.floor(Date.parse(post.postedAt) / 1000);+ return {+ id: post.tweetId,+ url: post.url,+ postedAt: post.postedAt,+ text: String(post.text || '').replace(/\s+/g, ' ').trim().slice(0, 140),+ engagement: engagementOf(post),+ hasMedia: Boolean(post.hasImage || post.hasVideo),+ ...returnsAt(candles, atSec, opts),+ };+ })+ .sort((a, b) => Date.parse(a.postedAt) - Date.parse(b.postedAt));+}++const median = (nums) => {+ if (!nums.length) return null;+ const sorted = [...nums].sort((a, b) => a - b);+ const mid = sorted.length >> 1;+ return round(sorted.length % 2 ? sorted[mid] : (sorted[mid - 1] + sorted[mid]) / 2);+};++const mean = (nums) => (nums.length ? round(nums.reduce((a, b) => a + b, 0) / nums.length) : null);++// What an arbitrary moment looks like: every `stepSeconds` across the series, the+// same returns a post would have been given. The comparison a post's return needs+// before it can be called a move: a coin that drifts down 3% a day makes every+// post look bad.+export function baselineReturns(candles, { stepSeconds = 4 * 3600, ...opts } = {}) {+ if (!candles.length) return [];+ const start = candles[0].t + BAR_SECONDS;+ const end = candles[candles.length - 1].t + BAR_SECONDS;+ const rows = [];+ for (let t = start; t <= end; t += stepSeconds) rows.push(returnsAt(candles, t, opts));+ return rows;+}++export function summarize(rows, baseline = []) {+ const summary = { posts: rows.length, horizons: {} };+ for (const { key } of HORIZONS) {+ const known = rows.map((row) => row[key]).filter((v) => v !== null);+ const base = baseline.map((row) => row[key]).filter((v) => v !== null);+ summary.horizons[key] = {+ measured: known.length,+ unavailable: rows.length - known.length,+ median: median(known),+ mean: mean(known),+ positiveShare: known.length ? round(known.filter((v) => v > 0).length / known.length, 3) : null,+ baselineMedian: median(base),+ baselineMean: mean(base),+ baselineSamples: base.length,+ };+ }+ return summary;+}++// The document the Posts view on /oracle-coin reads: the summary, and every post+// that has a $THREE price at the moment it went out. Posts from before the pool+// existed carry no price and are counted in the summary as unavailable instead.+export function buildImpactDocument({ handle, posts, pool, candles, now = Date.now(), mint = THREE_MINT }) {+ const rows = impactForPosts(posts, candles);+ return {+ handle,+ mint,+ pool,+ generatedAt: new Date(now).toISOString(),+ series: {+ barSeconds: BAR_SECONDS,+ from: new Date(candles[0].t * 1000).toISOString(),+ to: new Date((candles[candles.length - 1].t + BAR_SECONDS) * 1000).toISOString(),+ bars: candles.length,+ },+ summary: summarize(rows, baselineReturns(candles)),+ posts: rows.filter((row) => row.priceAtPost !== null),+ };+}++// ── Loading ─────────────────────────────────────────────────────────────────++// The whole 15-minute history of a pool, oldest first, paged back from now with+// GeckoTerminal's before_timestamp until a page comes back short or `fromSec` is+// covered.+export async function loadSeries({ mint = THREE_MINT, fromSec = 0, fetchBars = null, resolvePool = null } = {}) {+ // Loaded on use so the pure functions above (and their tests) carry none of+ // the market layer's cache and network dependencies.+ if (!fetchBars || !resolvePool) {+ const market = await import('../market/ohlcv.js');+ fetchBars = fetchBars || market.fetchOhlcv;+ resolvePool = resolvePool || market.topPoolForToken;+ }+ const pool = await resolvePool(mint, 'solana');+ const byTime = new Map();+ let before = null;+ for (let page = 0; page < MAX_PAGES; page++) {+ const out = await fetchBars({ pool, network: 'solana', timeframe: 'minute', aggregate: 15, limit: PAGE_BARS, beforeTimestamp: before });+ const bars = out.candles || [];+ if (!bars.length) break;+ for (const bar of bars) byTime.set(bar.t, bar);+ const oldest = bars[0].t;+ if (bars.length < PAGE_BARS || oldest <= fromSec || oldest === before) break;+ before = oldest;+ }+ return { pool, candles: [...byTime.values()].sort((a, b) => a.t - b.t) };+}++// The candles the content pipeline stamps its rows with, or null when the market+// layer cannot answer: learning from likes must not stop because a price API did.+export async function loadSeriesOrNull({ days, now = Date.now(), ...rest } = {}) {+ try {+ const { candles } = await loadSeries({ ...rest, fromSec: Math.floor(now / 1000) - days * 86_400 });+ return candles.length ? candles : null;+ } catch {+ return null;+ }+}++// ── Learning from it ────────────────────────────────────────────────────────++// Put each outcome row's +24h price return on the row, keyed by post id, so+// learnLifts can see it. A post with no measured return carries none.+export function attachPriceReturns(rows, impactRows) {+ const byId = new Map((impactRows || []).map((row) => [String(row.id), row]));+ return (rows || []).map((row) => {+ const hit = byId.get(String(row.id));+ return hit && hit.r24h !== null && hit.r24h !== undefined ? { ...row, priceReturn24h: hit.r24h } : row;+ });+}diff --git a/api/_lib/x-content/runner.js b/api/_lib/x-content/runner.jsindex 0b86c5432..3dedae273 100644--- a/api/_lib/x-content/runner.js+++ b/api/_lib/x-content/runner.js@@ -19,7 +19,8 @@ import { loadLifts } from './priority.js';import { loadReview, contentHash } from './review.js';import { previewClient, publishItem, xClientFromEnv } from './publisher.js';import { itemTexts, linkChecks, probeChecks } from './verify.js';-import { collectOutcomes, learnLifts, outcomesAreStale, outcomesStore } from './outcomes.js';+import { OUTCOMES_WINDOW_DAYS, collectOutcomes, learnLifts, outcomesAreStale, outcomesStore } from './outcomes.js';+import { loadSeriesOrNull } from './price-impact.js';const HOUR = 60 * 60_000;const DAY = 24 * HOUR;@@ -133,11 +134,11 @@ async function loadOutcomes(outcomes) {// Runs after the publish attempt, so a slow timeline read cannot delay a post,// and swallows its own failure, so it cannot turn a sent post into a failed tick.-async function refreshOutcomes({ outcomes, stored, collect, client, ledger, now }) {+async function refreshOutcomes({ outcomes, stored, collect, client, ledger, now, loadPrices }) {const sample = (rows) => learnLifts(rows, { now }).sample;if (!outcomes || !outcomesAreStale(stored, now)) return { refreshed: false, sample: sample(stored?.posts) };try {- const fresh = await collect({ client, ledger, now, previous: stored });+ const fresh = await collect({ client, ledger, now, previous: stored, priceSeries: await loadPrices({ days: OUTCOMES_WINDOW_DAYS, now }) });await outcomes.save(fresh);return { refreshed: true, sample: sample(fresh.posts), readDays: fresh.readDays };} catch (err) {@@ -221,6 +222,9 @@ export async function runTick({checks = preflight,outcomes = env.DATABASE_URL ? outcomesStore() : null,collect = collectOutcomes,+ // The $THREE candles the rows are stamped with. A caller that swaps `collect`+ // is not reading the real timeline, so it gets no price read either.+ loadPrices = collect === collectOutcomes ? loadSeriesOrNull : async () => null,}) {const queue = loadQueue(root);const state = await store.load();@@ -275,7 +279,7 @@ export async function runTick({try {result = await fillSlot({ queue, state, store, root, now, requestedId, client, checks, context, publishable, blocked });} finally {- if (!requestedId) report = await refreshOutcomes({ outcomes, stored, collect, client, ledger: state, now });+ if (!requestedId) report = await refreshOutcomes({ outcomes, stored, collect, client, ledger: state, now, loadPrices });}return { ...result, outcomes: report };}diff --git a/api/_lib/x-guest/LICENSE b/api/_lib/x-guest/LICENSEnew file mode 100644index 000000000..d64569567--- /dev/null+++ b/api/_lib/x-guest/LICENSE@@ -0,0 +1,202 @@++ Apache License+ Version 2.0, January 2004+ http://www.apache.org/licenses/++ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION++ 1. Definitions.++ "License" shall mean the terms and conditions for use, reproduction,+ and distribution as defined by Sections 1 through 9 of this document.++ "Licensor" shall mean the copyright owner or entity authorized by+ the copyright owner that is granting the License.++ "Legal Entity" shall mean the union of the acting entity and all+ other entities that control, are controlled by, or are under common+ control with that entity. For the purposes of this definition,+ "control" means (i) the power, direct or indirect, to cause the+ direction or management of such entity, whether by contract or+ otherwise, or (ii) ownership of fifty percent (50%) or more of the+ outstanding shares, or (iii) beneficial ownership of such entity.++ "You" (or "Your") shall mean an individual or Legal Entity+ exercising permissions granted by this License.++ "Source" form shall mean the preferred form for making modifications,+ including but not limited to software source code, documentation+ source, and configuration files.++ "Object" form shall mean any form resulting from mechanical+ transformation or translation of a Source form, including but+ not limited to compiled object code, generated documentation,+ and conversions to other media types.++ "Work" shall mean the work of authorship, whether in Source or+ Object form, made available under the License, as indicated by a+ copyright notice that is included in or attached to the work+ (an example is provided in the Appendix below).++ "Derivative Works" shall mean any work, whether in Source or Object+ form, that is based on (or derived from) the Work and for which the+ editorial revisions, annotations, elaborations, or other modifications+ represent, as a whole, an original work of authorship. For the purposes+ of this License, Derivative Works shall not include works that remain+ separable from, or merely link (or bind by name) to the interfaces of,+ the Work and Derivative Works thereof.++ "Contribution" shall mean any work of authorship, including+ the original version of the Work and any modifications or additions+ to that Work or Derivative Works thereof, that is intentionally+ submitted to Licensor for inclusion in the Work by the copyright owner+ or by an individual or Legal Entity authorized to submit on behalf of+ the copyright owner. For the purposes of this definition, "submitted"+ means any form of electronic, verbal, or written communication sent+ to the Licensor or its representatives, including but not limited to+ communication on electronic mailing lists, source code control systems,+ and issue tracking systems that are managed by, or on behalf of, the+ Licensor for the purpose of discussing and improving the Work, but+ excluding communication that is conspicuously marked or otherwise+ designated in writing by the copyright owner as "Not a Contribution."++ "Contributor" shall mean Licensor and any individual or Legal Entity+ on behalf of whom a Contribution has been received by Licensor and+ subsequently incorporated within the Work.++ 2. Grant of Copyright License. Subject to the terms and conditions of+ this License, each Contributor hereby grants to You a perpetual,+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable+ copyright license to reproduce, prepare Derivative Works of,+ publicly display, publicly perform, sublicense, and distribute the+ Work and such Derivative Works in Source or Object form.++ 3. Grant of Patent License. Subject to the terms and conditions of+ this License, each Contributor hereby grants to You a perpetual,+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable+ (except as stated in this section) patent license to make, have made,+ use, offer to sell, sell, import, and otherwise transfer the Work,+ where such license applies only to those patent claims licensable+ by such Contributor that are necessarily infringed by their+ Contribution(s) alone or by combination of their Contribution(s)+ with the Work to which such Contribution(s) was submitted. If You+ institute patent litigation against any entity (including a+ cross-claim or counterclaim in a lawsuit) alleging that the Work+ or a Contribution incorporated within the Work constitutes direct+ or contributory patent infringement, then any patent licenses+ granted to You under this License for that Work shall terminate+ as of the date such litigation is filed.++ 4. Redistribution. You may reproduce and distribute copies of the+ Work or Derivative Works thereof in any medium, with or without+ modifications, and in Source or Object form, provided that You+ meet the following conditions:++ (a) You must give any other recipients of the Work or+ Derivative Works a copy of this License; and++ (b) You must cause any modified files to carry prominent notices+ stating that You changed the files; and++ (c) You must retain, in the Source form of any Derivative Works+ that You distribute, all copyright, patent, trademark, and+ attribution notices from the Source form of the Work,+ excluding those notices that do not pertain to any part of+ the Derivative Works; and++ (d) If the Work includes a "NOTICE" text file as part of its+ distribution, then any Derivative Works that You distribute must+ include a readable copy of the attribution notices contained+ within such NOTICE file, excluding those notices that do not+ pertain to any part of the Derivative Works, in at least one+ of the following places: within a NOTICE text file distributed+ as part of the Derivative Works; within the Source form or+ documentation, if provided along with the Derivative Works; or,+ within a display generated by the Derivative Works, if and+ wherever such third-party notices normally appear. The contents+ of the NOTICE file are for informational purposes only and+ do not modify the License. You may add Your own attribution+ notices within Derivative Works that You distribute, alongside+ or as an addendum to the NOTICE text from the Work, provided+ that such additional attribution notices cannot be construed+ as modifying the License.++ You may add Your own copyright statement to Your modifications and+ may provide additional or different license terms and conditions+ for use, reproduction, or distribution of Your modifications, or+ for any such Derivative Works as a whole, provided Your use,+ reproduction, and distribution of the Work otherwise complies with+ the conditions stated in this License.++ 5. Submission of Contributions. Unless You explicitly state otherwise,+ any Contribution intentionally submitted for inclusion in the Work+ by You to the Licensor shall be under the terms and conditions of+ this License, without any additional terms or conditions.+ Notwithstanding the above, nothing herein shall supersede or modify+ the terms of any separate license agreement you may have executed+ with Licensor regarding such Contributions.++ 6. Trademarks. This License does not grant permission to use the trade+ names, trademarks, service marks, or product names of the Licensor,+ except as required for reasonable and customary use in describing the+ origin of the Work and reproducing the content of the NOTICE file.++ 7. Disclaimer of Warranty. Unless required by applicable law or+ agreed to in writing, Licensor provides the Work (and each+ Contributor provides its Contributions) on an "AS IS" BASIS,+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or+ implied, including, without limitation, any warranties or conditions+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A+ PARTICULAR PURPOSE. You are solely responsible for determining the+ appropriateness of using or redistributing the Work and assume any+ risks associated with Your exercise of permissions under this License.++ 8. Limitation of Liability. In no event and under no legal theory,+ whether in tort (including negligence), contract, or otherwise,+ unless required by applicable law (such as deliberate and grossly+ negligent acts) or agreed to in writing, shall any Contributor be+ liable to You for damages, including any direct, indirect, special,+ incidental, or consequential damages of any character arising as a+ result of this License or out of the use or inability to use the+ Work (including but not limited to damages for loss of goodwill,+ work stoppage, computer failure or malfunction, or any and all+ other commercial damages or losses), even if such Contributor+ has been advised of the possibility of such damages.++ 9. Accepting Warranty or Additional Liability. While redistributing+ the Work or Derivative Works thereof, You may choose to offer,+ and charge a fee for, acceptance of support, warranty, indemnity,+ or other liability obligations and/or rights consistent with this+ License. However, in accepting such obligations, You may act only+ on Your own behalf and on Your sole responsibility, not on behalf+ of any other Contributor, and only if You agree to indemnify,+ defend, and hold each Contributor harmless for any liability+ incurred by, or claims asserted against, such Contributor by reason+ of your accepting any such warranty or additional liability.++ END OF TERMS AND CONDITIONS++ APPENDIX: How to apply the Apache License to your work.++ To apply the Apache License to your work, attach the following+ boilerplate notice, with the fields enclosed by brackets "[]"+ replaced with your own identifying information. (Don't include+ the brackets!) The text should be enclosed in the appropriate+ comment syntax for the file format. We also recommend that a+ file or class name and description of purpose be included on the+ same "printed page" as the copyright notice for easier+ identification within third-party archives.++ Copyright [yyyy] [name of copyright owner]++ Licensed under the Apache License, Version 2.0 (the "License");+ you may not use this file except in compliance with the License.+ You may obtain a copy of the License at++ http://www.apache.org/licenses/LICENSE-2.0++ Unless required by applicable law or agreed to in writing, software+ distributed under the License is distributed on an "AS IS" BASIS,+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ See the License for the specific language governing permissions and+ limitations under the License.diff --git a/api/_lib/x-guest/NOTICE b/api/_lib/x-guest/NOTICEnew file mode 100644index 000000000..25500ef64--- /dev/null+++ b/api/_lib/x-guest/NOTICE@@ -0,0 +1,15 @@+three.ws x-guest reader+Portions adapted from XActions (https://github.com/nirholas/xactions,+npm package "xactions" 4.0.1), Copyright (c) 2024-2026 nich (@nichxbt),+licensed under the Apache License, Version 2.0 (see LICENSE in this directory).++Adapted files:+ parse-user.js from src/scrapers/twitter/http/parse/user.js+ parse-tweet.js from src/scrapers/twitter/http/parse/tweet.js+ errors.js reduced from src/scrapers/twitter/http/errors.js+ index.js guest-token activation, GraphQL request flow and query-id+ discovery re-implemented from guest.js, client.js, endpoints.js+ and x-endpoints.generated.js++Changes: the parsers import ./errors.js; the HTTP client is a compact+reimplementation that reads only public profiles and timelines.diff --git a/api/_lib/x-guest/errors.js b/api/_lib/x-guest/errors.jsnew file mode 100644index 000000000..e241a87e0--- /dev/null+++ b/api/_lib/x-guest/errors.js@@ -0,0 +1,25 @@+// Error classes for the keyless X guest reader. Adapted from XActions+// (Apache-2.0, see NOTICE). Only the types the guest reader raises are kept.++export class XGuestError extends Error {+ constructor(message, { status = null, endpoint = null, reason = 'error' } = {}) {+ super(message);+ this.name = new.target.name;+ this.status = status;+ this.endpoint = endpoint;+ this.reason = reason;+ }+}++export class NotFoundError extends XGuestError {+ constructor(message, opts = {}) {+ super(message, { ...opts, reason: opts.reason || 'not_found' });+ }+}++export class RateLimitError extends XGuestError {+ constructor(message, opts = {}) {+ super(message, { ...opts, reason: 'rate_limited' });+ this.resetAt = opts.resetAt ?? null;+ }+}diff --git a/api/_lib/x-guest/index.js b/api/_lib/x-guest/index.jsnew file mode 100644index 000000000..bb9e779db--- /dev/null+++ b/api/_lib/x-guest/index.js@@ -0,0 +1,292 @@+// Keyless X (Twitter) reader: public profiles and user timelines through the+// guest-token GraphQL surface x.com's own web client uses for logged-out+// visitors. No API key, no account, read-only.+//+// Adapted from XActions (Apache-2.0, see NOTICE in this directory). It is the+// second rung behind the paid X API v2 (src/kol/x-profile.js) and the feeder for+// the oracle social endpoint (api/cron/oracle-social-ingest.js).+//+// Failure model: every error is an XGuestError with a `reason` (rate_limited,+// stale_query_id, not_found, guest_token, upstream) so callers can fail soft to+// the previous rung and log why. A 429 opens a cooldown that short-circuits+// later calls until the window x.com reported has passed.++import { XGuestError, NotFoundError, RateLimitError } from './errors.js';+import { parseUserData } from './parse-user.js';+import { parseTimelineInstructions, userTimelineInstructions } from './parse-tweet.js';++export { XGuestError, NotFoundError, RateLimitError, parseUserData };++const WEB_BEARER =+ 'AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA';+const GRAPHQL_BASE = 'https://x.com/i/api/graphql';+const ACTIVATE_URL = 'https://api.x.com/1.1/guest/activate.json';+const UPSTREAM_ENDPOINTS_URL =+ 'https://raw.githubusercontent.com/nirholas/XActions/main/src/scrapers/twitter/http/x-endpoints.generated.js';++const GUEST_TTL_MS = 2.5 * 60 * 60 * 1000;+const DEFAULT_COOLDOWN_MS = 60_000;+const REQUEST_TIMEOUT_MS = 12_000;+const HANDLE_RE = /^[A-Za-z0-9_]{1,15}$/;+const USER_AGENT =+ 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36';++// Known-good query IDs. Replaced at runtime by the live upstream constants when+// x.com rotates one (see refreshQueryId).+const QUERY_IDS = {+ UserByScreenName: 'Gb-d6r0vxPOADdG62OEBpQ',+ UserTweets: 'SXVCYB8XHSS25nzIljNtZA',+};++const USER_FEATURES = {+ hidden_profile_subscriptions_enabled: true,+ responsive_web_graphql_exclude_directive_enabled: true,+ verified_phone_label_enabled: false,+ subscriptions_verification_info_is_identity_verified_enabled: true,+ subscriptions_verification_info_verified_since_enabled: true,+ highlights_tweets_tab_ui_enabled: true,+ responsive_web_twitter_article_notes_tab_enabled: true,+ creator_subscriptions_tweet_preview_api_enabled: true,+ responsive_web_graphql_skip_user_profile_image_extensions_enabled: false,+ responsive_web_graphql_timeline_navigation_enabled: true,+};++const TIMELINE_FEATURES = {+ rweb_video_screen_enabled: false,+ responsive_web_graphql_timeline_navigation_enabled: true,+ responsive_web_graphql_skip_user_profile_image_extensions_enabled: false,+ creator_subscriptions_tweet_preview_api_enabled: true,+ longform_notetweets_consumption_enabled: true,+ longform_notetweets_rich_text_read_enabled: true,+ longform_notetweets_inline_media_enabled: true,+ freedom_of_speech_not_reach_fetch_enabled: true,+ standardized_nudges_misinfo: true,+ tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled: true,+ view_counts_everywhere_api_enabled: true,+ responsive_web_edit_tweet_api_enabled: true,+ graphql_is_translatable_rweb_tweet_is_translatable_enabled: true,+ responsive_web_enhance_cards_enabled: false,+ communities_web_enable_tweet_community_results_fetch: true,+ c9s_tweet_anatomy_moderator_badge_enabled: true,+ articles_preview_enabled: true,+ responsive_web_twitter_article_tweet_consumption_enabled: true,+ tweet_awards_web_tipping_enabled: false,+ creator_subscriptions_quote_tweet_preview_enabled: false,+ rweb_tipjar_consumption_enabled: true,+ responsive_web_grok_analyze_button_fetch_trends_enabled: false,+};++const state = {+ guest: null, // { value, createdAt }+ activating: null,+ cooldownUntil: 0,+ queryIds: { ...QUERY_IDS },+ refreshing: null,+};++/** Clear cached guest token, cooldown and discovered query IDs (tests, ops). */+export function resetGuestState() {+ state.guest = null;+ state.activating = null;+ state.cooldownUntil = 0;+ state.queryIds = { ...QUERY_IDS };+ state.refreshing = null;+}++function withTimeout(init) {+ return { ...init, signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS) };+}++async function activateGuestToken(fetchImpl) {+ const res = await fetchImpl(+ ACTIVATE_URL,+ withTimeout({+ method: 'POST',+ headers: { authorization: `Bearer ${WEB_BEARER}`, 'user-agent': USER_AGENT },+ }),+ );+ if (res.status === 429) {+ throw new RateLimitError('guest activation rate limited', { status: 429, endpoint: ACTIVATE_URL });+ }+ if (!res.ok) {+ throw new XGuestError(`guest activation failed: HTTP ${res.status}`, {+ status: res.status,+ endpoint: ACTIVATE_URL,+ reason: 'guest_token',+ });+ }+ const body = await res.json().catch(() => null);+ if (!body?.guest_token) {+ throw new XGuestError('guest activation returned no token', { endpoint: ACTIVATE_URL, reason: 'guest_token' });+ }+ return { value: String(body.guest_token), createdAt: Date.now() };+}++async function guestToken(fetchImpl, { force = false } = {}) {+ if (!force && state.guest && Date.now() - state.guest.createdAt < GUEST_TTL_MS) return state.guest.value;+ if (!state.activating) {+ state.activating = activateGuestToken(fetchImpl)+ .then((token) => {+ state.guest = token;+ return token;+ })+ .finally(() => {+ state.activating = null;+ });+ }+ return (await state.activating).value;+}++/**+ * Re-read the operation's query ID from the XActions repo's current constants.+ * Returns the new ID, or null when upstream is unreachable or does not list it.+ */+async function refreshQueryId(operation, fetchImpl) {+ if (!state.refreshing) {+ state.refreshing = (async () => {+ const res = await fetchImpl(UPSTREAM_ENDPOINTS_URL, withTimeout({ headers: { 'user-agent': USER_AGENT } }));+ if (!res.ok) return null;+ const src = await res.text();+ for (const op of Object.keys(QUERY_IDS)) {+ const m = src.match(new RegExp(`"${op}":\\s*Object\\.freeze\\(\\{\\s*queryId:\\s*"([\\w-]+)"`));+ if (m) state.queryIds[op] = m[1];+ }+ return true;+ })()+ .catch(() => null)+ .finally(() => {+ state.refreshing = null;+ });+ }+ await state.refreshing;+ return state.queryIds[operation] || null;+}++function isStaleQueryIdFailure(status, body) {+ if (status === 404) return true;+ if (status !== 400) return false;+ const text = JSON.stringify(body || {}).toLowerCase();+ return text.includes('persistedquery') || text.includes('query id') || text.includes('queryid');+}++async function graphql(operation, variables, features, fetchImpl, { retried = false, tokenRetried = false } = {}) {+ if (Date.now() < state.cooldownUntil) {+ throw new RateLimitError('x guest reader cooling down after a rate limit', {+ resetAt: state.cooldownUntil,+ endpoint: operation,+ });+ }+ const queryId = state.queryIds[operation];+ const url = `${GRAPHQL_BASE}/${queryId}/${operation}?variables=${encodeURIComponent(+ JSON.stringify(variables),+ )}&features=${encodeURIComponent(JSON.stringify(features))}`;+ const token = await guestToken(fetchImpl);+ const res = await fetchImpl(+ url,+ withTimeout({+ headers: {+ authorization: `Bearer ${WEB_BEARER}`,+ 'x-guest-token': token,+ 'user-agent': USER_AGENT,+ 'content-type': 'application/json',+ 'x-twitter-active-user': 'yes',+ 'x-twitter-client-language': 'en',+ },+ }),+ );++ if (res.status === 429) {+ const reset = Number(res.headers?.get?.('x-rate-limit-reset')) * 1000;+ state.cooldownUntil = Number.isFinite(reset) && reset > Date.now() ? reset : Date.now() + DEFAULT_COOLDOWN_MS;+ state.guest = null;+ throw new RateLimitError('x guest reader rate limited', {+ status: 429,+ resetAt: state.cooldownUntil,+ endpoint: operation,+ });+ }++ const body = await res.json().catch(() => null);++ if (res.status === 403 && !tokenRetried) {+ state.guest = null;+ return graphql(operation, variables, features, fetchImpl, { retried, tokenRetried: true });+ }+ if (isStaleQueryIdFailure(res.status, body)) {+ if (retried) {+ throw new XGuestError(`query id for ${operation} is stale and upstream has no fresh one`, {+ status: res.status,+ endpoint: operation,+ reason: 'stale_query_id',+ });+ }+ const fresh = await refreshQueryId(operation, fetchImpl);+ if (!fresh || fresh === queryId) {+ throw new XGuestError(`query id for ${operation} is stale and upstream has no fresh one`, {+ status: res.status,+ endpoint: operation,+ reason: 'stale_query_id',+ });+ }+ return graphql(operation, variables, features, fetchImpl, { retried: true, tokenRetried });+ }+ if (!res.ok) {+ throw new XGuestError(`x guest ${operation} failed: HTTP ${res.status}`, {+ status: res.status,+ endpoint: operation,+ reason: 'upstream',+ });+ }+ if (!body || typeof body !== 'object') {+ throw new XGuestError(`x guest ${operation} returned a non-JSON body`, { endpoint: operation, reason: 'upstream' });+ }+ return body;+}++function cleanHandle(handle) {+ const clean = String(handle || '').replace(/^@/, '');+ if (!HANDLE_RE.test(clean)) throw new NotFoundError(`invalid X handle: ${clean || '(empty)'}`);+ return clean;+}++/**+ * Public profile for a handle (followers, joined date, avatar, bio, ...).+ * @returns {Promise<object>} XActions profile object, see parse-user.js+ */+export async function fetchGuestProfile(handle, { fetchImpl = fetch } = {}) {+ const clean = cleanHandle(handle);+ const body = await graphql(+ 'UserByScreenName',+ { screen_name: clean, withSafetyModeUserFields: true },+ USER_FEATURES,+ fetchImpl,+ );+ const result = body?.data?.user?.result;+ if (!result) throw new NotFoundError(`@${clean} not found`);+ return parseUserData(result);+}++/**+ * Latest original tweets for a handle, newest first (pinned tweet included when+ * x.com sends it). One page, up to `limit` tweets.+ * @returns {Promise<{ profile: object, tweets: object[] }>}+ */+export async function fetchGuestTimeline(handle, { limit = 20, fetchImpl = fetch } = {}) {+ const clean = cleanHandle(handle);+ const profile = await fetchGuestProfile(clean, { fetchImpl });+ const body = await graphql(+ 'UserTweets',+ {+ userId: profile.id,+ count: Math.max(1, Math.min(Number(limit) || 20, 40)),+ includePromotedContent: false,+ withQuickPromoteEligibilityTweetFields: true,+ withVoice: true,+ withV2Timeline: true,+ },+ TIMELINE_FEATURES,+ fetchImpl,+ );+ const { tweets } = parseTimelineInstructions(userTimelineInstructions(body?.data));+ return { profile, tweets: tweets.slice(0, limit) };+}diff --git a/api/_lib/x-guest/parse-tweet.js b/api/_lib/x-guest/parse-tweet.jsnew file mode 100644index 000000000..893a494a8--- /dev/null+++ b/api/_lib/x-guest/parse-tweet.js@@ -0,0 +1,330 @@+// Copyright (c) 2024-2026 nich (@nichxbt). Licensed under the Apache License, Version 2.0.+/**+ * Pure parsers for x.com's GraphQL tweet and timeline payloads.+ *+ * Split out of tweets.js so anything can import them, a Cloudflare Worker+ * included: this file reaches for nothing but `errors.js`, while the scrapers+ * they came from pull in the HTTP client, the resumable checkpoint store and+ * the Node filesystem behind it.+ *+ * @module scrapers/twitter/http/parse/tweet+ * @author nich (@nichxbt)+ */++import { NotFoundError } from './errors.js';++/**+ * Parse Twitter's `created_at` string ("Mon Jan 01 00:00:00 +0000 2007")+ * into an ISO-8601 date string.+ *+ * @param {string|null} raw+ * @returns {string|null}+ */+function toISODate(raw) {+ if (!raw) return null;+ const d = new Date(raw);+ return Number.isNaN(d.getTime()) ? raw : d.toISOString();+}++/**+ * Select the highest-bitrate MP4 variant from a video_info.variants array.+ *+ * @param {object[]} variants+ * @returns {string|null}+ */+function pickBestVideoUrl(variants) {+ if (!variants || !variants.length) return null;+ const mp4s = variants.filter((v) => v.content_type === 'video/mp4' && v.url);+ if (!mp4s.length) return null;+ mp4s.sort((a, b) => (b.bitrate || 0) - (a.bitrate || 0));+ return mp4s[0].url;+}++/**+ * Strip HTML tags from a source string (e.g. Twitter Web App link).+ *+ * @param {string|null} raw+ * @returns {string}+ */+function cleanSource(raw) {+ if (!raw) return '';+ return raw.replace(/<[^>]+>/g, '');+}++// ---------------------------------------------------------------------------+// parseTweetData, Pure transform function+// ---------------------------------------------------------------------------++/**+ * Transform Twitter's raw GraphQL tweet object into the clean XActions+ * tweet format.+ *+ * Handles `__typename`: `'Tweet'`, `'TweetWithVisibilityResults'`,+ * `'TweetTombstone'`.+ *+ * @param {object} rawTweet, A tweet result object from the GraphQL response+ * (typically `tweet_results.result` or a timeline entry's+ * `itemContent.tweet_results.result`).+ * @returns {object|null} Normalised tweet object, or `null` for tombstones /+ * unparseable entries.+ */+export function parseTweetData(rawTweet) {+ if (!rawTweet) return null;++ const typename = rawTweet.__typename;++ // Deleted / withheld tweets+ if (typename === 'TweetTombstone') {+ return {+ id: null,+ text: rawTweet.tombstone?.text?.text || '[Unavailable]',+ tombstone: true,+ platform: 'twitter',+ };+ }++ // TweetWithVisibilityResults wraps the real tweet one level deeper+ let tweet = rawTweet;+ if (typename === 'TweetWithVisibilityResults') {+ tweet = rawTweet.tweet || rawTweet;+ }++ const legacy = tweet.legacy || {};+ const core = tweet.core || {};++ // ---- Author -----------------------------------------------------------+ // The embedded user carries the same shape migration as a standalone+ // profile: name/screen_name moved to `core`, the avatar to `avatar`, the+ // verified flag to `verification`. `legacy` is still sent on some+ // authenticated responses, so it stays as the fallback.+ const authorResult = core.user_results?.result || {};+ const authorLegacy = authorResult.legacy || {};+ const authorCore = authorResult.core || {};+ const author = {+ id: authorResult.rest_id || null,+ username: authorCore.screen_name ?? authorLegacy.screen_name ?? '',+ name: authorCore.name ?? authorLegacy.name ?? '',+ avatar: authorResult.avatar?.image_url ?? authorLegacy.profile_image_url_https ?? null,+ verified: Boolean(+ authorResult.is_blue_verified ||+ authorResult.verification?.verified ||+ authorLegacy.verified,+ ),+ };++ // ---- Metrics ----------------------------------------------------------+ const viewsCount = tweet.views?.count ?? tweet.ext_views?.count ?? null;+ const metrics = {+ likes: legacy.favorite_count ?? 0,+ retweets: legacy.retweet_count ?? 0,+ replies: legacy.reply_count ?? 0,+ quotes: legacy.quote_count ?? 0,+ bookmarks: legacy.bookmark_count ?? 0,+ views: viewsCount != null ? Number(viewsCount) : 0,+ };++ // ---- Media ------------------------------------------------------------+ const rawMedia = legacy.extended_entities?.media || [];+ const media = rawMedia.map((m) => {+ const originalInfo = m.original_info || {};+ return {+ type: m.type || 'photo', // 'photo' | 'video' | 'animated_gif'+ url: m.media_url_https || m.media_url || '',+ width: originalInfo.width ?? m.sizes?.large?.w ?? 0,+ height: originalInfo.height ?? m.sizes?.large?.h ?? 0,+ videoUrl: m.video_info ? pickBestVideoUrl(m.video_info.variants) : null,+ };+ });++ // ---- Quote tweet (recursive) ------------------------------------------+ let quotedTweet = null;+ const quotedResult = tweet.quoted_status_result?.result;+ if (quotedResult) {+ quotedTweet = parseTweetData(quotedResult);+ }++ // ---- Reply context ----------------------------------------------------+ let inReplyTo = null;+ if (legacy.in_reply_to_status_id_str) {+ inReplyTo = {+ tweetId: legacy.in_reply_to_status_id_str,+ userId: legacy.in_reply_to_user_id_str || null,+ username: legacy.in_reply_to_screen_name || null,+ };+ }++ // ---- URLs, hashtags, mentions -----------------------------------------+ const entityUrls = legacy.entities?.urls || [];+ const urls = entityUrls.map((u) => ({+ url: u.url,+ expandedUrl: u.expanded_url,+ displayUrl: u.display_url,+ }));++ const hashtags = (legacy.entities?.hashtags || []).map((h) => h.text);+ const mentions = (legacy.entities?.user_mentions || []).map((m) => ({+ username: m.screen_name,+ id: m.id_str || null,+ }));++ // ---- Retweet detection ------------------------------------------------+ let isRetweet = false;+ let retweetOf = null;+ const retweetedResult = legacy.retweeted_status_result?.result;+ if (retweetedResult) {+ isRetweet = true;+ retweetOf = parseTweetData(retweetedResult);+ }++ // ---- Determine reply flag ---------------------------------------------+ const isReply = Boolean(legacy.in_reply_to_status_id_str);++ return {+ id: tweet.rest_id || legacy.id_str || null,+ text: legacy.full_text || '',+ createdAt: toISODate(legacy.created_at),+ author,+ metrics,+ media,+ quotedTweet,+ inReplyTo,+ urls,+ hashtags,+ mentions,+ isReply,+ isRetweet,+ retweetOf,+ lang: legacy.lang || null,+ source: cleanSource(legacy.source),+ platform: 'twitter',+ };+}++// ---------------------------------------------------------------------------+// parseTimelineInstructions, Parse Twitter's timeline response format+// ---------------------------------------------------------------------------++/**+ * Read the instruction list out of a user timeline payload.+ *+ * x.com renamed the container from `timeline_v2` to `timeline`, and a guest+ * response uses the new name while some authenticated responses still send the+ * old one. Reading only `timeline_v2` silently yields zero tweets, so both are+ * accepted here and every user-timeline caller goes through this.+ *+ * @param {object} payload - `response.data` from client.graphql()+ * @returns {object[]} Timeline instructions, empty when the payload has none.+ */+export function userTimelineInstructions(payload) {+ const result = payload?.user?.result;+ return (+ result?.timeline?.timeline?.instructions ??+ result?.timeline_v2?.timeline?.instructions ??+ result?.timeline?.instructions ??+ []+ );+}++/**+ * Parse the `instructions` array from a Twitter timeline GraphQL response.+ *+ * Handles entry types:+ * - `TimelineAddEntries`, primary timeline entries and cursors+ * - `TimelineAddToModule`, entries inside conversation modules+ * - `TimelinePinEntry`, pinned tweets+ *+ * @param {object[]} instructions, The `instructions` array.+ * @returns {{ tweets: object[], cursor: string|null }}+ */+export function parseTimelineInstructions(instructions) {+ const tweets = [];+ let cursor = null;++ if (!Array.isArray(instructions)) {+ return { tweets, cursor };+ }++ for (const instruction of instructions) {+ const type = instruction.type;++ // ---- TimelineAddEntries (most common) --------------------------------+ if (type === 'TimelineAddEntries') {+ const entries = instruction.entries || [];+ for (const entry of entries) {+ // Bottom cursor for pagination+ if (entry.entryId?.startsWith('cursor-bottom-')) {+ cursor =+ entry.content?.value ??+ entry.content?.itemContent?.value ??+ null;+ continue;+ }+ // Top cursor, ignore+ if (entry.entryId?.startsWith('cursor-top-')) {+ continue;+ }++ // Single tweet entry+ const tweetResult = extractTweetResult(entry);+ if (tweetResult) {+ const parsed = parseTweetData(tweetResult);+ if (parsed && parsed.id) tweets.push(parsed);+ }++ // Conversation module (appears in UserTweetsAndReplies)+ const moduleItems = entry.content?.items;+ if (Array.isArray(moduleItems)) {+ for (const moduleItem of moduleItems) {+ const modTweetResult =+ moduleItem?.item?.itemContent?.tweet_results?.result;+ if (modTweetResult) {+ const parsed = parseTweetData(modTweetResult);+ if (parsed && parsed.id) tweets.push(parsed);+ }+ }+ }+ }+ }++ // ---- TimelineAddToModule -----------------------------------------------+ if (type === 'TimelineAddToModule') {+ const moduleItems = instruction.moduleItems || [];+ for (const item of moduleItems) {+ const tweetResult = item?.item?.itemContent?.tweet_results?.result;+ if (tweetResult) {+ const parsed = parseTweetData(tweetResult);+ if (parsed && parsed.id) tweets.push(parsed);+ }+ }+ }++ // ---- TimelinePinEntry --------------------------------------------------+ if (type === 'TimelinePinEntry') {+ const tweetResult =+ instruction.entry?.content?.itemContent?.tweet_results?.result;+ if (tweetResult) {+ const parsed = parseTweetData(tweetResult);+ if (parsed && parsed.id) tweets.push(parsed);+ }+ }+ }++ return { tweets, cursor };+}++/**+ * Extract the tweet result object from a standard timeline entry.+ *+ * @param {object} entry+ * @returns {object|null}+ */+export function extractTweetResult(entry) {+ // Standard tweet entry: content.itemContent.tweet_results.result+ return (+ entry?.content?.itemContent?.tweet_results?.result ?? null+ );+}++// ---------------------------------------------------------------------------+// scrapeTweets, User tweets timeline+// ---------------------------------------------------------------------------diff --git a/api/_lib/x-guest/parse-user.js b/api/_lib/x-guest/parse-user.jsnew file mode 100644index 000000000..ec9a81038--- /dev/null+++ b/api/_lib/x-guest/parse-user.js@@ -0,0 +1,178 @@+// Copyright (c) 2024-2026 nich (@nichxbt). Licensed under the Apache License, Version 2.0.+/**+ * Pure parser for x.com's GraphQL `User` object.+ *+ * Kept apart from profile.js so it can be imported anywhere, including a+ * Cloudflare Worker: this file reaches for nothing but `errors.js`, while the+ * scraper it came from pulls in the HTTP client, the query-ID cache and the+ * Node filesystem behind it.+ *+ * @module scrapers/twitter/http/parse/user+ * @author nich (@nichxbt)+ */++import { NotFoundError } from './errors.js';++// ---------------------------------------------------------------------------+// Helpers+// ---------------------------------------------------------------------------++/**+ * Expand t.co URLs using the entity data Twitter provides.+ *+ * @param {string} text, The raw text containing t.co links+ * @param {object[]} urlEntities, `legacy.entities.url.urls` or+ * `legacy.entities.description.urls` arrays+ * @returns {string} Text with t.co links replaced by expanded URLs+ */+function expandTcoUrls(text, urlEntities = []) {+ if (!text || !urlEntities.length) return text || '';+ let expanded = text;+ for (const entity of urlEntities) {+ if (entity.url && entity.expanded_url) {+ expanded = expanded.replace(entity.url, entity.expanded_url);+ }+ }+ return expanded;+}++/**+ * Upgrade the avatar thumbnail URL to a higher-resolution version.+ *+ * Twitter serves `_normal` (48 × 48) by default, swap to `_400x400`.+ *+ * @param {string|null} url+ * @returns {string|null}+ */+function upgradeAvatarUrl(url) {+ if (!url) return null;+ return url.replace(/_normal(\.\w+)$/, '_400x400$1');+}++/**+ * Parse Twitter's `created_at` string ("Mon Jan 01 00:00:00 +0000 2007")+ * into an ISO-8601 date string.+ *+ * @param {string|null} raw+ * @returns {string|null}+ */+function toISODate(raw) {+ if (!raw) return null;+ const d = new Date(raw);+ return Number.isNaN(d.getTime()) ? raw : d.toISOString();+}++/**+ * Safely extract the expanded website URL.+ *+ * @param {object} entities - `entities` from `profile_bio` or `legacy`.+ * @param {string|null} rawUrl - The unexpanded t.co URL.+ * @returns {string|null}+ */+function extractWebsite(entities, rawUrl) {+ const urlEntities = entities?.url?.urls;+ if (!urlEntities || !urlEntities.length) return rawUrl || null;+ // Prefer the expanded URL (resolves the t.co redirect)+ return urlEntities[0].expanded_url || urlEntities[0].url || rawUrl || null;+}++/**+ * Extract bio entity metadata (URLs, hashtags, mentions).+ *+ * @param {object} entities - `entities` from `profile_bio` or `legacy`.+ * @returns {{ urls: object[], hashtags: object[], mentions: object[] }}+ */+function extractBioEntities(entities) {+ const desc = entities?.description || {};+ return {+ urls: (desc.urls || []).map((u) => ({+ display: u.display_url,+ expanded: u.expanded_url,+ url: u.url,+ start: u.indices?.[0] ?? null,+ end: u.indices?.[1] ?? null,+ })),+ hashtags: (desc.hashtags || []).map((h) => ({+ text: h.text,+ start: h.indices?.[0] ?? null,+ end: h.indices?.[1] ?? null,+ })),+ mentions: (desc.user_mentions || []).map((m) => ({+ username: m.screen_name,+ start: m.indices?.[0] ?? null,+ end: m.indices?.[1] ?? null,+ })),+ };+}++// ---------------------------------------------------------------------------+// Core: parseUserData+// ---------------------------------------------------------------------------++/**+ * Transform Twitter's raw GraphQL user object into the clean XActions+ * profile format.+ *+ * This is a **pure function**, it performs no I/O and has no side effects.+ *+ * @param {object} rawUser, The `data.user.result` (or equivalent) object+ * from a Twitter GraphQL response.+ * @returns {object} Normalised XActions profile object.+ * @throws {NotFoundError} If the user is unavailable (suspended / deactivated).+ */+export function parseUserData(rawUser) {+ if (!rawUser) {+ throw new NotFoundError('User data is empty');+ }++ // Handle UserUnavailable (suspended, deactivated, etc.)+ if (rawUser.__typename === 'UserUnavailable') {+ const reason = rawUser.reason || rawUser.message || 'Account unavailable';+ throw new NotFoundError(`User unavailable: ${reason}`);+ }++ // x.com is migrating User fields out of `legacy` into typed sub-objects+ // (core, avatar, banner, location, privacy, website, profile_bio,+ // relationship_counts, tweet_counts, action_counts, verification,+ // pinned_items). Guest responses no longer carry `legacy` at all, so read+ // the typed shape first and fall back to `legacy` for authenticated+ // responses and older fixtures that still return it.+ const legacy = rawUser.legacy || {};+ const core = rawUser.core || {};+ const bio = rawUser.profile_bio || {};+ const entities = bio.entities || legacy.entities || {};+ const counts = rawUser.relationship_counts || {};+ const tweetCounts = rawUser.tweet_counts || {};+ const actionCounts = rawUser.action_counts || {};+ const birthdate = rawUser.legacy_extended_profile?.birthdate || legacy.birthdate || null;+ const description = bio.description ?? legacy.description ?? '';+ const descriptionUrls = entities.description?.urls || [];++ return {+ id: rawUser.rest_id || null,+ name: core.name ?? legacy.name ?? '',+ username: core.screen_name ?? legacy.screen_name ?? '',+ bio: expandTcoUrls(description, descriptionUrls),+ location: rawUser.location?.location ?? legacy.location ?? '',+ website: extractWebsite(entities, rawUser.website?.url ?? legacy.url ?? null),+ joined: toISODate(core.created_at ?? legacy.created_at ?? null),+ birthday: birthdate+ ? `${birthdate.year || ''}${birthdate.month ? '-' + String(birthdate.month).padStart(2, '0') : ''}${birthdate.day ? '-' + String(birthdate.day).padStart(2, '0') : ''}`.trim() || null+ : null,+ following: counts.following ?? legacy.friends_count ?? 0,+ followers: counts.followers ?? legacy.followers_count ?? 0,+ tweets: tweetCounts.tweets ?? legacy.statuses_count ?? 0,+ likes: actionCounts.favorites_count ?? legacy.favourites_count ?? 0,+ media: tweetCounts.media_tweets ?? legacy.media_count ?? 0,+ avatar: upgradeAvatarUrl(rawUser.avatar?.image_url ?? legacy.profile_image_url_https ?? null),+ header: rawUser.banner?.image_url ?? legacy.profile_banner_url ?? null,+ verified: Boolean(+ rawUser.is_blue_verified || rawUser.verification?.verified || legacy.verified+ ),+ protected: Boolean(rawUser.privacy?.protected ?? legacy.protected),+ pinnedTweetId:+ (rawUser.pinned_items?.tweet_ids_str || legacy.pinned_tweet_ids_str || [])[0] || null,+ bioEntities: extractBioEntities(entities),+ platform: 'twitter',+ };+}diff --git a/api/_lib/x-syndication.js b/api/_lib/x-syndication.jsnew file mode 100644index 000000000..bbc4d52e1--- /dev/null+++ b/api/_lib/x-syndication.js@@ -0,0 +1,491 @@+// Keyless X (Twitter) post reader: text, author, engagement metrics, media variants, timestamps.+//+// One reader for every three.ws feature that needs to look at a public post+// without an X API key. It tries three rungs in order and returns the first+// that answers:+//+// 1. X's public syndication endpoint (cdn.syndication.twimg.com), the one the+// official embed widget uses. No auth, widest mp4 quality ladder.+// 2. fxtwitter (api.fxtwitter.com), an independent third party that stays up+// when syndication rate-limits. Adds reposts, views and bookmarks.+// 3. Guest-token GraphQL (api.x.com), richest metadata. Needs a bearer token,+// so it only runs when X_BEARER_TOKEN is set (or one is passed in).+//+// A rung that cannot answer (HTTP error, rate limit, malformed body, tombstone)+// falls through to the next. Only when every rung reports the post gone does the+// caller get PostUnavailableError; when none could be reached it gets a 502.+//+// Video extraction approach adapted from nirholas/download-x-twitter-videos+// (Apache-2.0, src/edgeExtractor.js).++const TWEET_URL_RE =+ /^https?:\/\/(?:www\.|mobile\.)?(?:twitter\.com|x\.com)\/(\w+)\/status(?:es)?\/(\d+)/i;++const BROWSER_HEADERS = {+ 'User-Agent':+ 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36',+ Accept: 'application/json',+ 'Accept-Language': 'en-US,en;q=0.9',+};++const RUNG_TIMEOUT_MS = 8_000;+const TWITTER_EPOCH_MS = 1288834974657;+const GRAPHQL_TWEET_RESULT =+ 'https://api.x.com/graphql/GZsN2Pc4knAoit6pXa4HSA/TweetResultByRestId';++/** Hosts the download proxy may stream from. */+export const ALLOWED_MEDIA_HOSTS = ['video.twimg.com', 'pbs.twimg.com'];++/**+ * Reader failure carrying the HTTP status an API surface should answer with.+ * 400 = bad input, 404 = post unavailable, 502 = every rung failed upstream.+ */+export class XPostError extends Error {+ constructor(message, status = 502, details = []) {+ super(message);+ this.name = 'XPostError';+ this.status = status;+ this.details = details;+ }+}++export class PostUnavailableError extends XPostError {+ constructor(message = 'Post unavailable: it was deleted, is private, or does not exist.', details = []) {+ super(message, 404, details);+ this.name = 'PostUnavailableError';+ }+}++/** @returns {{ handle: string, id: string } | null} */+export function parsePostUrl(url) {+ if (typeof url !== 'string') return null;+ const m = url.trim().match(TWEET_URL_RE);+ return m ? { handle: m[1], id: m[2] } : null;+}++export function snowflakeToMs(id) {+ try {+ return Number(BigInt(id) >> 22n) + TWITTER_EPOCH_MS;+ } catch {+ return null;+ }+}++export function qualityLabel(width, height) {+ const maxDim = Math.max(width || 0, height || 0);+ if (maxDim >= 3840) return '4K';+ if (maxDim >= 2560) return '1440p';+ if (maxDim >= 1920) return '1080p';+ if (maxDim >= 1280) return '720p';+ if (maxDim >= 640) return '480p';+ if (maxDim >= 480) return '360p';+ if (maxDim > 0) return `${maxDim}p`;+ return 'unknown';+}++/** X derives the syndication token from the post id with this exact expression. */+export function syndicationToken(id) {+ return ((Number(id) / 1e15) * Math.PI).toString(36).replace(/(0+|\.)/g, '');+}++function isMp4Url(url) {+ try {+ return new URL(url).pathname.toLowerCase().endsWith('.mp4');+ } catch {+ return false;+ }+}++function toVariant(url, { width, height, bitrate } = {}) {+ const derived = url.match(/\/(\d+)x(\d+)\//);+ const w = width || (derived ? parseInt(derived[1], 10) : 0);+ const h = height || (derived ? parseInt(derived[2], 10) : 0);+ return { url, quality: qualityLabel(w, h), width: w, height: h, bitrate: bitrate || 0, contentType: 'video/mp4' };+}++/** Drop duplicate variants (ignoring query strings), best quality first. */+function rankVariants(variants) {+ const seen = new Set();+ const unique = [];+ for (const v of variants) {+ const base = v.url.split('?')[0];+ if (seen.has(base)) continue;+ seen.add(base);+ unique.push(v);+ }+ unique.sort((a, b) => b.width * b.height - a.width * a.height || b.bitrate - a.bitrate);+ return unique;+}++const num = (v) => (Number.isFinite(Number(v)) && v !== null && v !== undefined ? Number(v) : null);++async function fetchJson(url, { headers = {}, method = 'GET', label, fetchImpl = fetch } = {}) {+ const res = await fetchImpl(url, {+ method,+ headers: { ...BROWSER_HEADERS, ...headers },+ signal: AbortSignal.timeout(RUNG_TIMEOUT_MS),+ });+ if (!res.ok) {+ const err = new Error(`${label} responded HTTP ${res.status}`);+ err.upstreamStatus = res.status;+ throw err;+ }+ const body = await res.text();+ if (!body) throw new Error(`${label} returned an empty body`);+ try {+ return JSON.parse(body);+ } catch {+ throw new Error(`${label} returned a non-JSON body`);+ }+}++/** Trim the trailing media t.co link X appends, using the post's own display range. */+function displayText(text, range) {+ if (typeof text !== 'string') return null;+ if (Array.isArray(range) && range.length === 2) {+ const chars = Array.from(text);+ return chars.slice(range[0], range[1]).join('').trim() || text.trim();+ }+ return text.trim();+}++function finish(partial, id, handle, source) {+ const createdMs = partial.createdAt ? Date.parse(partial.createdAt) : NaN;+ const ts = Number.isFinite(createdMs) ? createdMs : snowflakeToMs(id);+ const media = partial.media || [];+ return {+ id,+ url: `https://x.com/${partial.author?.handle || handle}/status/${id}`,+ ts,+ createdAt: ts ? new Date(ts).toISOString() : null,+ author: {+ name: partial.author?.name || handle,+ handle: partial.author?.handle || handle,+ avatar: partial.author?.avatar || null,+ verified: Boolean(partial.author?.verified),+ },+ text: partial.text ?? null,+ metrics: {+ likes: num(partial.metrics?.likes),+ replies: num(partial.metrics?.replies),+ reposts: num(partial.metrics?.reposts),+ quotes: num(partial.metrics?.quotes),+ views: num(partial.metrics?.views),+ bookmarks: num(partial.metrics?.bookmarks),+ },+ media: media.map((m) => ({ ...m, variants: rankVariants(m.variants || []) })),+ source,+ };+}++// Rung 1: syndication++async function readViaSyndication(id, handle, { fetchImpl }) {+ let data;+ try {+ data = await fetchJson(+ `https://cdn.syndication.twimg.com/tweet-result?id=${id}&token=${syndicationToken(id)}&lang=en`,+ { headers: { Referer: 'https://platform.twitter.com/' }, label: 'syndication', fetchImpl },+ );+ } catch (err) {+ if (err.upstreamStatus === 404) throw new PostUnavailableError();+ throw err;+ }+ if (data.__typename === 'TweetTombstone' || !data.user) throw new PostUnavailableError();++ const media = [];+ for (const item of data.mediaDetails || []) {+ if (item.type === 'photo') {+ media.push({ type: 'photo', thumbnail: item.media_url_https || null, durationMs: null, variants: [] });+ } else if (item.type === 'video' || item.type === 'animated_gif') {+ const variants = (item.video_info?.variants || [])+ .filter((v) => v.content_type === 'video/mp4' && isMp4Url(v.url))+ .map((v) => toVariant(v.url, { bitrate: v.bitrate }));+ media.push({+ type: item.type === 'animated_gif' ? 'gif' : 'video',+ thumbnail: item.media_url_https || null,+ durationMs: item.video_info?.duration_millis ?? null,+ variants,+ });+ }+ }+ return finish(+ {+ createdAt: data.created_at,+ text: displayText(data.text, data.display_text_range),+ author: {+ name: data.user.name,+ handle: data.user.screen_name,+ avatar: data.user.profile_image_url_https,+ verified: data.user.is_blue_verified || data.user.verified,+ },+ metrics: { likes: data.favorite_count, replies: data.conversation_count },+ media,+ },+ id,+ handle,+ 'syndication',+ );+}++// Rung 2: fxtwitter++async function readViaFxTwitter(id, handle, { fetchImpl }) {+ let data;+ try {+ data = await fetchJson(`https://api.fxtwitter.com/${handle}/status/${id}`, {+ headers: { 'User-Agent': 'three.ws/1.0 (+https://three.ws)' },+ label: 'fxtwitter',+ fetchImpl,+ });+ } catch (err) {+ if (err.upstreamStatus === 404) throw new PostUnavailableError();+ throw err;+ }+ const t = data?.tweet;+ if (!t) throw new PostUnavailableError();++ const media = [];+ for (const item of t.media?.all || []) {+ if (item.type === 'photo') {+ media.push({ type: 'photo', thumbnail: item.url || null, durationMs: null, variants: [] });+ } else if (item.type === 'video' || item.type === 'gif') {+ const variants = [...(item.formats || item.variants || []), item]+ .filter((v) => v?.url && isMp4Url(v.url))+ .map((v) => toVariant(v.url, { width: v.width, height: v.height, bitrate: v.bitrate }));+ media.push({+ type: item.type,+ thumbnail: item.thumbnail_url || null,+ durationMs: item.duration ? Math.round(item.duration * 1000) : null,+ variants,+ });+ }+ }+ return finish(+ {+ createdAt: t.created_at ? new Date(t.created_at).toISOString() : t.created_timestamp ? new Date(t.created_timestamp * 1000).toISOString() : null,+ text: t.text?.trim() ?? null,+ author: {+ name: t.author?.name,+ handle: t.author?.screen_name,+ avatar: t.author?.avatar_url,+ verified: false,+ },+ metrics: {+ likes: t.likes,+ replies: t.replies,+ reposts: t.retweets,+ quotes: t.quotes,+ views: t.views,+ bookmarks: t.bookmarks,+ },+ media,+ },+ id,+ handle,+ 'fxtwitter',+ );+}++// Rung 3: guest-token GraphQL++const GRAPHQL_FEATURES = {+ creator_subscriptions_tweet_preview_api_enabled: true,+ premium_content_api_read_enabled: false,+ communities_web_enable_tweet_community_results_fetch: true,+ c9s_tweet_anatomy_moderator_badge_enabled: true,+ responsive_web_jetfuel_frame: false,+ articles_preview_enabled: true,+ responsive_web_edit_tweet_api_enabled: true,+ graphql_is_translatable_rweb_tweet_is_translatable_enabled: true,+ view_counts_everywhere_api_enabled: true,+ longform_notetweets_consumption_enabled: true,+ responsive_web_twitter_article_tweet_consumption_enabled: true,+ freedom_of_speech_not_reach_fetch_enabled: true,+ standardized_nudges_misinfo: true,+ tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled: true,+ longform_notetweets_rich_text_read_enabled: true,+ longform_notetweets_inline_media_enabled: true,+ rweb_tipjar_consumption_enabled: true,+ responsive_web_graphql_skip_user_profile_image_extensions_enabled: false,+ responsive_web_graphql_timeline_navigation_enabled: true,+ responsive_web_enhance_cards_enabled: false,+};++let guest = { token: null, bearer: null, expiresAt: 0 };++async function guestToken(bearer, fetchImpl) {+ if (guest.token && guest.bearer === bearer && guest.expiresAt > Date.now()) return guest.token;+ const data = await fetchJson('https://api.x.com/1.1/guest/activate.json', {+ method: 'POST',+ headers: { Authorization: `Bearer ${bearer}`, Referer: 'https://x.com/', Origin: 'https://x.com' },+ label: 'guest activation',+ fetchImpl,+ });+ if (!data.guest_token) throw new Error('guest activation returned no guest_token');+ guest = { token: data.guest_token, bearer, expiresAt: Date.now() + 2 * 3600_000 };+ return guest.token;+}++async function readViaGraphQL(id, handle, { fetchImpl, bearerToken }) {+ if (!bearerToken) throw new Error('graphql rung needs X_BEARER_TOKEN');+ const token = await guestToken(bearerToken, fetchImpl);+ const variables = JSON.stringify({ tweetId: id, withCommunity: false, includePromotedContent: false, withVoice: false });+ const url =+ `${GRAPHQL_TWEET_RESULT}?variables=${encodeURIComponent(variables)}` ++ `&features=${encodeURIComponent(JSON.stringify(GRAPHQL_FEATURES))}` ++ `&fieldToggles=${encodeURIComponent(JSON.stringify({ withArticleRichContentState: true }))}`;+ const data = await fetchJson(url, {+ headers: {+ Authorization: `Bearer ${bearerToken}`,+ Referer: 'https://x.com/',+ Origin: 'https://x.com',+ 'x-guest-token': token,+ 'x-twitter-active-user': 'yes',+ },+ label: 'graphql',+ fetchImpl,+ });+ const result = data?.data?.tweetResult?.result;+ if (!result || result.__typename === 'TweetTombstone') throw new PostUnavailableError();++ const tweet = result.tweet || result;+ const legacy = tweet.legacy || {};+ const user = tweet.core?.user_results?.result || {};+ const ul = user.legacy || {};+ const uc = user.core || {};++ const media = [];+ for (const item of legacy.extended_entities?.media || legacy.entities?.media || []) {+ if (item.type === 'photo') {+ media.push({ type: 'photo', thumbnail: item.media_url_https || null, durationMs: null, variants: [] });+ } else if (item.type === 'video' || item.type === 'animated_gif') {+ const variants = (item.video_info?.variants || [])+ .filter((v) => v.content_type === 'video/mp4' && isMp4Url(v.url))+ .map((v) => toVariant(v.url, { bitrate: v.bitrate }));+ media.push({+ type: item.type === 'animated_gif' ? 'gif' : 'video',+ thumbnail: item.media_url_https || null,+ durationMs: item.video_info?.duration_millis ?? null,+ variants,+ });+ }+ }+ return finish(+ {+ createdAt: legacy.created_at ? new Date(legacy.created_at).toISOString() : null,+ text: displayText(tweet.note_tweet?.note_tweet_results?.result?.text ?? legacy.full_text, tweet.note_tweet ? null : legacy.display_text_range),+ author: {+ name: uc.name || ul.name,+ handle: uc.screen_name || ul.screen_name,+ avatar: user.avatar?.image_url || ul.profile_image_url_https,+ verified: user.is_blue_verified,+ },+ metrics: {+ likes: legacy.favorite_count,+ replies: legacy.reply_count,+ reposts: legacy.retweet_count,+ quotes: legacy.quote_count,+ views: tweet.views?.count,+ bookmarks: legacy.bookmark_count,+ },+ media,+ },+ id,+ handle,+ 'graphql',+ );+}++/**+ * Read one public X post.+ *+ * @param {string} postUrl x.com / twitter.com status URL+ * @param {{ fetchImpl?: typeof fetch, bearerToken?: string }} [opts]+ * @returns {Promise<{ id, url, ts, createdAt, author, text, metrics, media, source }>}+ * @throws {XPostError} 400 bad URL, 404 PostUnavailableError, 502 every rung unreachable+ */+export async function readXPost(postUrl, { fetchImpl = fetch, bearerToken = process.env?.X_BEARER_TOKEN } = {}) {+ const parsed = parsePostUrl(postUrl);+ if (!parsed) {+ throw new XPostError('Invalid URL. Expected a post link like https://x.com/user/status/123.', 400);+ }+ const { id, handle } = parsed;+ const ctx = { fetchImpl, bearerToken };+ const rungs = [+ ['syndication', readViaSyndication],+ ['fxtwitter', readViaFxTwitter],+ ];+ if (bearerToken) rungs.push(['graphql', readViaGraphQL]);++ const failures = [];+ let gone = 0;+ for (const [name, run] of rungs) {+ try {+ return await run(id, handle, ctx);+ } catch (err) {+ if (err instanceof PostUnavailableError) gone += 1;+ failures.push(`${name}: ${err.message}`);+ }+ }+ if (gone > 0) throw new PostUnavailableError(undefined, failures);+ throw new XPostError(+ 'Could not reach X to read this post. It may be rate-limited right now, so try again in a minute.',+ 502,+ failures,+ );+}++/** Flat, best-first mp4 list across every video in a post. */+export function postVideoVariants(post) {+ return rankVariants((post?.media || []).flatMap((m) => m.variants || []));+}++/**+ * Validate a media URL before proxying it so the download endpoint can never+ * act as an open proxy.+ * @throws {XPostError} 400+ */+export function assertMediaUrl(rawUrl) {+ let parsed;+ try {+ parsed = new URL(String(rawUrl));+ } catch {+ throw new XPostError('Invalid URL format.', 400);+ }+ if (parsed.protocol !== 'https:') throw new XPostError('Only HTTPS URLs are allowed.', 400);+ if (parsed.username || parsed.password || parsed.port) throw new XPostError('Invalid media URL.', 400);+ if (!ALLOWED_MEDIA_HOSTS.includes(parsed.hostname)) {+ throw new XPostError('Invalid media URL. Must be an X video or image CDN URL.', 400);+ }+ return parsed;+}++export function downloadFilename(handle, id, ext = 'mp4') {+ const h = String(handle || 'video').replace(/[^\w-]/g, '_').slice(0, 50);+ const i = String(id || 'post').replace(/[^\w-]/g, '_').slice(0, 30);+ const e = String(ext).replace(/[^a-z0-9]/gi, '').slice(0, 5) || 'mp4';+ return `${h}_${i}.${e}`;+}++/**+ * Compact post shape for impact analysis: the fields the price-correlation+ * tools report, with engagement metrics and a media summary.+ */+export function summarizeXPost(post) {+ return {+ id: post.id,+ ts: post.ts,+ author: post.author.name,+ handle: post.author.handle,+ text: post.text,+ metrics: post.metrics,+ media: post.media.map((m) => ({+ type: m.type,+ thumbnail: m.thumbnail,+ durationMs: m.durationMs,+ bestVariantUrl: m.variants[0]?.url ?? null,+ })),+ source: post.source,+ };+}diff --git a/api/x-video/download.js b/api/x-video/download.jsnew file mode 100644index 000000000..5a06824fb--- /dev/null+++ b/api/x-video/download.js@@ -0,0 +1,65 @@+/**+ * GET /api/x-video/download?url=<video.twimg.com or pbs.twimg.com URL>&handle=<h>&id=<postId>+ * → streams the file as an attachment.+ *+ * Browsers cannot save a cross-origin video with the download attribute, so+ * the page routes the click through here. Restricted to X's two media CDN+ * hosts, https only, and redirects are never followed, so it cannot be turned+ * into an open proxy.+ */++import { Readable } from 'node:stream';+import { pipeline } from 'node:stream/promises';+import { cors, json, method, wrap, rateLimited } from '../_lib/http.js';+import { limits, clientIp } from '../_lib/rate-limit.js';+import { assertMediaUrl, downloadFilename, XPostError } from '../_lib/x-syndication.js';++const MAX_BYTES = 512 * 1024 * 1024;++export default wrap(async (req, res) => {+ if (cors(req, res, { methods: 'GET,OPTIONS' })) return;+ if (!method(req, res, ['GET'])) return;++ const rl = await limits.xVideoDownload(clientIp(req));+ if (!rl.success) return rateLimited(res, rl);++ const q = new URL(req.url, 'http://localhost').searchParams;+ let target;+ try {+ target = assertMediaUrl(q.get('url') || '');+ } catch (err) {+ if (err instanceof XPostError) return json(res, err.status, { error: 'invalid_media_url', message: err.message });+ throw err;+ }++ let upstream;+ try {+ upstream = await fetch(target, {+ redirect: 'manual',+ headers: { 'User-Agent': 'Mozilla/5.0 (compatible; three.ws)', Referer: 'https://x.com/' },+ signal: AbortSignal.timeout(30_000),+ });+ } catch {+ return json(res, 502, { error: 'upstream_unreachable', message: 'Could not reach the X media CDN. Try again in a minute.' });+ }+ if (!upstream.ok || !upstream.body) {+ const status = upstream.status === 404 ? 404 : 502;+ return json(res, status, { error: 'media_unavailable', message: 'X did not return this file. It may have expired; read the post again for a fresh link.' });+ }+ const length = Number(upstream.headers.get('content-length') || 0);+ if (length > MAX_BYTES) return json(res, 413, { error: 'too_large', message: 'This file is too large to proxy.' });++ const isImage = target.hostname === 'pbs.twimg.com';+ const ext = isImage ? (target.pathname.match(/\.(jpg|jpeg|png|webp)$/i)?.[1] ?? 'jpg') : 'mp4';+ res.statusCode = 200;+ res.setHeader('Content-Type', upstream.headers.get('content-type') || (isImage ? 'image/jpeg' : 'video/mp4'));+ if (length) res.setHeader('Content-Length', String(length));+ res.setHeader('Content-Disposition', `attachment; filename="${downloadFilename(q.get('handle'), q.get('id'), ext)}"`);+ res.setHeader('Cache-Control', 'private, no-store');+ res.setHeader('X-Content-Type-Options', 'nosniff');+ try {+ await pipeline(Readable.fromWeb(upstream.body), res);+ } catch {+ res.destroy();+ }+});diff --git a/api/x-video/extract.js b/api/x-video/extract.jsnew file mode 100644index 000000000..49eca4057--- /dev/null+++ b/api/x-video/extract.js@@ -0,0 +1,48 @@+/**+ * POST /api/x-video/extract { url: "https://x.com/<handle>/status/<id>" }+ * → 200 { post, videos, thumbnail, duration_ms, source }+ *+ * Free, keyless. Reads the post through api/_lib/x-syndication.js (syndication,+ * then fxtwitter, then guest GraphQL) and returns the post with its mp4 ladder.+ * 400 bad URL, 404 post unavailable or no video, 502 X unreachable.+ */++import { cors, json, method, readJson, wrap, rateLimited } from '../_lib/http.js';+import { limits, clientIp } from '../_lib/rate-limit.js';+import { readXPost, postVideoVariants, XPostError } from '../_lib/x-syndication.js';++export default wrap(async (req, res) => {+ if (cors(req, res, { methods: 'POST,OPTIONS' })) return;+ if (!method(req, res, ['POST'])) return;++ const rl = await limits.xVideoExtract(clientIp(req));+ if (!rl.success) return rateLimited(res, rl);++ const body = await readJson(req, 4_000).catch(() => null);+ let post;+ try {+ post = await readXPost(typeof body?.url === 'string' ? body.url : '');+ } catch (err) {+ if (err instanceof XPostError) {+ return json(res, err.status, { error: err.status === 404 ? 'post_unavailable' : err.status === 400 ? 'invalid_url' : 'upstream_unreachable', message: err.message });+ }+ throw err;+ }++ const videos = postVideoVariants(post);+ if (videos.length === 0) {+ return json(res, 404, {+ error: 'no_video',+ message: 'No video found in this post. Make sure the post actually contains a video or GIF.',+ post,+ });+ }+ const clip = post.media.find((m) => m.variants.length > 0);+ return json(res, 200, {+ post,+ videos,+ thumbnail: clip?.thumbnail ?? null,+ duration_ms: clip?.durationMs ?? null,+ source: post.source,+ });+});diff --git a/public/data/trythreews-post-impact.json b/public/data/trythreews-post-impact.jsonnew file mode 100644index 000000000..1f44a5e2c--- /dev/null+++ b/public/data/trythreews-post-impact.json@@ -0,0 +1,2413 @@+{+ "handle": "trythreews",+ "mint": "FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump",+ "pool": "5ByL7MZoLABYnwMPZKPKjf4MGkZ7FeBzrAnos19Pre2z",+ "generatedAt": "2026-10-23T21:49:27.264Z",+ "series": {+ "barSeconds": 900,+ "from": "2026-04-29T07:00:00.000Z",+ "to": "2026-10-23T21:45:00.000Z",+ "bars": 16245+ },+ "summary": {+ "posts": 197,+ "horizons": {+ "r1h": {+ "measured": 197,+ "unavailable": 0,+ "median": 1.59,+ "mean": 4.94,+ "positiveShare": 0.629,+ "baselineMedian": -0.12,+ "baselineMean": 0.18,+ "baselineSamples": 1065+ },+ "r4h": {+ "measured": 197,+ "unavailable": 0,+ "median": 1.61,+ "mean": 5.18,+ "positiveShare": 0.574,+ "baselineMedian": -0.68,+ "baselineMean": 1.3,+ "baselineSamples": 1063+ },+ "r24h": {+ "measured": 197,+ "unavailable": 0,+ "median": -1.38,+ "mean": 6.95,+ "positiveShare": 0.492,+ "baselineMedian": -2.41,+ "baselineMean": 7.12,+ "baselineSamples": 1058+ }+ }+ },+ "posts": [+ {+ "id": "2049567362693963905",+ "url": "https://x.com/trythreews/status/2049567362693963905",+ "postedAt": "2026-04-29T19:11:53.000Z",+ "text": "we reverse engineered the PumpFun agent payments sdk afaik the only one on Github link below",+ "engagement": 12,+ "hasMedia": true,+ "priceAtPost": 0.000033315884625533025,+ "r1h": 33.95,+ "r4h": 124.81,+ "r24h": 161.75+ },+ {+ "id": "2049573582247022869",+ "url": "https://x.com/trythreews/status/2049573582247022869",+ "postedAt": "2026-04-29T19:36:35.000Z",+ "text": "we just gave 3D AI agents native http:// pump.fun superpowers swap, create coins, collect fees, accept token payments, snipe, trade autonomo",+ "engagement": 11,+ "hasMedia": true,+ "priceAtPost": 0.00005254714711163541,+ "r1h": 42.12,+ "r4h": 29.56,+ "r24h": 57.85+ },+ {+ "id": "2049574569925808265",+ "url": "https://x.com/trythreews/status/2049574569925808265",+ "postedAt": "2026-04-29T19:40:31.000Z",+ "text": "we took the official pump-fun-skills repo and completed it it had the SKILL.md docs but was missing the runtime glue. we added manifest.json",+ "engagement": 14,+ "hasMedia": true,+ "priceAtPost": 0.00005254714711163541,+ "r1h": 42.12,+ "r4h": 29.56,+ "r24h": 57.85+ },+ {+ "id": "2049575072684462180",+ "url": "https://x.com/trythreews/status/2049575072684462180",+ "postedAt": "2026-04-29T19:42:31.000Z",+ "text": "then we reverse-engineered the full pump-fun agent-payments-sdk reconstructed the Anchor IDL, all PDAs, event parsing, and the x402 payment ",+ "engagement": 11,+ "hasMedia": true,+ "priceAtPost": 0.00005254714711163541,+ "r1h": 42.12,+ "r4h": 29.56,+ "r24h": 57.85+ },+ {+ "id": "2049576023856181676",+ "url": "https://x.com/trythreews/status/2049576023856181676",+ "postedAt": "2026-04-29T19:46:18.000Z",+ "text": "the avatar also subscribes to on-chain events via websocket payment received → celebration animation buyback fires → agent reacts live withd",+ "engagement": 6,+ "hasMedia": true,+ "priceAtPost": 0.00005617741851413224,+ "r1h": 29.53,+ "r4h": 5.62,+ "r24h": 52.5+ },+ {+ "id": "2049579577996120286",+ "url": "https://x.com/trythreews/status/2049579577996120286",+ "postedAt": "2026-04-29T20:00:25.000Z",+ "text": "@himgajria , Look at this Tech, dev is shipping non stop, and it’s pretty insane.",+ "engagement": 7,+ "hasMedia": false,+ "priceAtPost": 0.00004462805522920025,+ "r1h": 91.41,+ "r4h": 39.88,+ "r24h": 119.09+ },+ {+ "id": "2049777785623969821",+ "url": "https://x.com/trythreews/status/2049777785623969821",+ "postedAt": "2026-04-30T09:08:01.000Z",+ "text": "Frank, have you created your own 3D AI character using @trythreews yet? You already follow @nichxbt , are you not up to speed with what he’s",+ "engagement": 4,+ "hasMedia": false,+ "priceAtPost": 0.0000803791048554444,+ "r1h": 3.06,+ "r4h": 6.12,+ "r24h": 50.99+ },+ {+ "id": "2050016695897706885",+ "url": "https://x.com/trythreews/status/2050016695897706885",+ "postedAt": "2026-05-01T00:57:22.000Z",+ "text": "http:// three.ws is listed on @AnthropicAI 's official MCP Registry \u2013 the canonical directory for AI-to-tool integrations used by Claude, Ch",+ "engagement": 10,+ "hasMedia": true,+ "priceAtPost": 0.00015016823263218365,+ "r1h": -10.43,+ "r4h": -21.44,+ "r24h": -43.17+ },+ {+ "id": "2050017130331148561",+ "url": "https://x.com/trythreews/status/2050017130331148561",+ "postedAt": "2026-05-01T00:59:06.000Z",+ "text": "Remote MCP URL https:// three.ws/api/mcp @AnthropicAI Registry Listing https:// registry.modelcontextprotocol.io/?q=three.ws Learn more abou",+ "engagement": 10,+ "hasMedia": false,+ "priceAtPost": 0.00015016823263218365,+ "r1h": -10.43,+ "r4h": -21.44,+ "r24h": -43.17+ },+ {+ "id": "2050221269732425928",+ "url": "https://x.com/trythreews/status/2050221269732425928",+ "postedAt": "2026-05-01T14:30:16.000Z",+ "text": "The http:// three.ws Podcast is now live on @Spotify Not a fan of extremely long articles? We hear you. Discover our newly launched onchain ",+ "engagement": 10,+ "hasMedia": true,+ "priceAtPost": 0.00014301031592454965,+ "r1h": 32.72,+ "r4h": -11.47,+ "r24h": -28.81+ },+ {+ "id": "2050221870264545681",+ "url": "https://x.com/trythreews/status/2050221870264545681",+ "postedAt": "2026-05-01T14:32:39.000Z",+ "text": "Beyond Chatbots: Why Your AI Agent Needs a 3D Body and a Blockchain Passport On-chain via @Spotify",+ "engagement": 2,+ "hasMedia": false,+ "priceAtPost": 0.00014301031592454965,+ "r1h": 32.72,+ "r4h": -11.47,+ "r24h": -28.81+ },+ {+ "id": "2050280028605456894",+ "url": "https://x.com/trythreews/status/2050280028605456894",+ "postedAt": "2026-05-01T18:23:45.000Z",+ "text": "",+ "engagement": 1,+ "hasMedia": false,+ "priceAtPost": 0.0001285771805562014,+ "r1h": -0.37,+ "r4h": -31.99,+ "r24h": -30.78+ },+ {+ "id": "2050585585191186781",+ "url": "https://x.com/trythreews/status/2050585585191186781",+ "postedAt": "2026-05-02T14:37:56.000Z",+ "text": "http:// three.ws & @alibaba_cloud Partner to Give 3D AI Agents On-Chain Wallets and Financial Access We’re proud to partner with @alibaba_cl",+ "engagement": 16,+ "hasMedia": true,+ "priceAtPost": 0.0001018130721414677,+ "r1h": -4.23,+ "r4h": -14.27,+ "r24h": -28.79+ },+ {+ "id": "2050586858825154674",+ "url": "https://x.com/trythreews/status/2050586858825154674",+ "postedAt": "2026-05-02T14:42:59.000Z",+ "text": "http:// three.ws on Alibaba Cloud Marketplace https:// marketplace.alibabacloud.com/store/3247293. html?spm=a3c0i.29891717.0.0.14b825db0OizT",+ "engagement": 1,+ "hasMedia": true,+ "priceAtPost": 0.0001018130721414677,+ "r1h": -4.23,+ "r4h": -14.27,+ "r24h": -28.79+ },+ {+ "id": "2050758788186353723",+ "url": "https://x.com/trythreews/status/2050758788186353723",+ "postedAt": "2026-05-03T02:06:11.000Z",+ "text": "thank you very much, it actually means a lotwe are working really hard to build the best platform and tech + the best community with the bes",+ "engagement": 2,+ "hasMedia": false,+ "priceAtPost": 0.00009366681437612622,+ "r1h": -13.68,+ "r4h": -24.26,+ "r24h": -30.32+ },+ {+ "id": "2053515313464160487",+ "url": "https://x.com/trythreews/status/2053515313464160487",+ "postedAt": "2026-05-10T16:39:37.000Z",+ "text": "Just a warm up.",+ "engagement": 18,+ "hasMedia": false,+ "priceAtPost": 0.0002693999585772408,+ "r1h": -1.74,+ "r4h": 35.99,+ "r24h": 73.04+ },+ {+ "id": "2053700891186983198",+ "url": "https://x.com/trythreews/status/2053700891186983198",+ "postedAt": "2026-05-11T04:57:03.000Z",+ "text": "",+ "engagement": 0,+ "hasMedia": false,+ "priceAtPost": 0.00031576491069958243,+ "r1h": 13.54,+ "r4h": 4.91,+ "r24h": 3.42+ },+ {+ "id": "2053804700609458214",+ "url": "https://x.com/trythreews/status/2053804700609458214",+ "postedAt": "2026-05-11T11:49:33.000Z",+ "text": "Agents now have form, executing on-chain, reacting in real time. 100+ DeFi tools → now callable by 3D agents with on-chain identity, persist",+ "engagement": 21,+ "hasMedia": true,+ "priceAtPost": 0.0003185460900007178,+ "r1h": 46.88,+ "r4h": 79.33,+ "r24h": -12.97+ },+ {+ "id": "2053807453222146380",+ "url": "https://x.com/trythreews/status/2053807453222146380",+ "postedAt": "2026-05-11T12:00:29.000Z",+ "text": "",+ "engagement": 1,+ "hasMedia": false,+ "priceAtPost": 0.0003101501791589,+ "r1h": 44.21,+ "r4h": 71.96,+ "r24h": -12.81+ },+ {+ "id": "2054675701132132736",+ "url": "https://x.com/trythreews/status/2054675701132132736",+ "postedAt": "2026-05-13T21:30:35.000Z",+ "text": "We just reverse engineered the @pumpfun agent payments SDK Your AI doesn't just execute tasks anymore, it earns on-chain revenue to fuel its",+ "engagement": 293,+ "hasMedia": true,+ "priceAtPost": 0.00021067785363722215,+ "r1h": 47.59,+ "r4h": 40.67,+ "r24h": 59.26+ },+ {+ "id": "2054676179937079383",+ "url": "https://x.com/trythreews/status/2054676179937079383",+ "postedAt": "2026-05-13T21:32:29.000Z",+ "text": "First to ever do it?! By integrating this payment logic directly into the interactive http:// three.ws environment, your 3D avatar transform",+ "engagement": 2,+ "hasMedia": false,+ "priceAtPost": 0.00021067785363722215,+ "r1h": 47.59,+ "r4h": 40.67,+ "r24h": 59.26+ },+ {+ "id": "2054896613429334239",+ "url": "https://x.com/trythreews/status/2054896613429334239",+ "postedAt": "2026-05-14T12:08:25.000Z",+ "text": "",+ "engagement": 13,+ "hasMedia": false,+ "priceAtPost": 0.0002451430234940201,+ "r1h": 0.52,+ "r4h": 1.99,+ "r24h": 27.2+ },+ {+ "id": "2056990719072710834",+ "url": "https://x.com/trythreews/status/2056990719072710834",+ "postedAt": "2026-05-20T06:49:39.000Z",+ "text": "Multichain agent deployment has been core to our project since day one. Today we are proud to share that @BNBCHAIN has verified our project ",+ "engagement": 12,+ "hasMedia": true,+ "priceAtPost": 0.00025116304763588986,+ "r1h": 11.75,+ "r4h": 14.94,+ "r24h": -21.56+ },+ {+ "id": "2056990723703251212",+ "url": "https://x.com/trythreews/status/2056990723703251212",+ "postedAt": "2026-05-20T06:49:40.000Z",+ "text": "On the technical side, we already have live mainnet contracts on BSC. • ThreeWSFactory (CREATE2 deployer) \u2014 0x00000000D49195AE81759cd247cFeD",+ "engagement": 3,+ "hasMedia": true,+ "priceAtPost": 0.00025116304763588986,+ "r1h": 11.75,+ "r4h": 14.94,+ "r24h": -21.56+ },+ {+ "id": "2056992463957729737",+ "url": "https://x.com/trythreews/status/2056992463957729737",+ "postedAt": "2026-05-20T06:56:35.000Z",+ "text": "Yes.",+ "engagement": 14,+ "hasMedia": false,+ "priceAtPost": 0.00025116304763588986,+ "r1h": 11.75,+ "r4h": 14.94,+ "r24h": -21.56+ },+ {+ "id": "2057572896814547063",+ "url": "https://x.com/trythreews/status/2057572896814547063",+ "postedAt": "2026-05-21T21:23:01.000Z",+ "text": "tech is shipping",+ "engagement": 2,+ "hasMedia": false,+ "priceAtPost": 0.00018743667633254525,+ "r1h": -5.16,+ "r4h": -6.63,+ "r24h": -6.14+ },+ {+ "id": "2057780453709648200",+ "url": "https://x.com/trythreews/status/2057780453709648200",+ "postedAt": "2026-05-22T11:07:46.000Z",+ "text": "Our MCP Server was just pushed to the official @AnthropicAI MCP Registry Our complete 3D AI agent toolkit is now seamlessly integrated and r",+ "engagement": 30,+ "hasMedia": true,+ "priceAtPost": 0.0002162947634313007,+ "r1h": -2.08,+ "r4h": -14.33,+ "r24h": -20.86+ },+ {+ "id": "2057782224800604497",+ "url": "https://x.com/trythreews/status/2057782224800604497",+ "postedAt": "2026-05-22T11:14:48.000Z",+ "text": "Generate avatars from text or image Make your 3D AI agents speak with synced lips, gestures & expressions Execute Solana transactions or tra",+ "engagement": 15,+ "hasMedia": false,+ "priceAtPost": 0.0002162947634313007,+ "r1h": -2.08,+ "r4h": -14.33,+ "r24h": -20.86+ },+ {+ "id": "2057782522994684413",+ "url": "https://x.com/trythreews/status/2057782522994684413",+ "postedAt": "2026-05-22T11:15:59.000Z",+ "text": "NPM package: @ three-ws/avatar-agent (stdio transport) https:// npmjs.com/package/@three -ws/avatar-agent …",+ "engagement": 11,+ "hasMedia": false,+ "priceAtPost": 0.00021357158273553942,+ "r1h": -0.83,+ "r4h": -15.58,+ "r24h": -19.85+ },+ {+ "id": "2057786164862730704",+ "url": "https://x.com/trythreews/status/2057786164862730704",+ "postedAt": "2026-05-22T11:30:28.000Z",+ "text": "View in API -> Official MCP Registry by @AnthropicAI https:// registry.modelcontextprotocol.io/v0.1/servers/i o.github.nirholas%2F3D-AI-Agen",+ "engagement": 25,+ "hasMedia": true,+ "priceAtPost": 0.00021724960444834636,+ "r1h": -8.75,+ "r4h": -21.4,+ "r24h": -21.2+ },+ {+ "id": "2057787013366219163",+ "url": "https://x.com/trythreews/status/2057787013366219163",+ "postedAt": "2026-05-22T11:33:50.000Z",+ "text": "Glad you are enjoying the platform.",+ "engagement": 5,+ "hasMedia": false,+ "priceAtPost": 0.00021724960444834636,+ "r1h": -8.75,+ "r4h": -21.4,+ "r24h": -21.2+ },+ {+ "id": "2058078565749633279",+ "url": "https://x.com/trythreews/status/2058078565749633279",+ "postedAt": "2026-05-23T06:52:21.000Z",+ "text": "",+ "engagement": 2,+ "hasMedia": false,+ "priceAtPost": 0.00016963667185387988,+ "r1h": 8.96,+ "r4h": -1.1,+ "r24h": 33.23+ },+ {+ "id": "2060749325404361113",+ "url": "https://x.com/trythreews/status/2060749325404361113",+ "postedAt": "2026-05-30T15:45:00.000Z",+ "text": "Introducing http:// three.ws/play Live, 3D virtual townhall for ANY @pumpfun coin, powered by their brand new @CoinComms API & SDK. No more ",+ "engagement": 31,+ "hasMedia": true,+ "priceAtPost": 0.00027650715840703255,+ "r1h": 44.58,+ "r4h": 36.3,+ "r24h": 2.93+ },+ {+ "id": "2060866679295582671",+ "url": "https://x.com/trythreews/status/2060866679295582671",+ "postedAt": "2026-05-30T23:31:20.000Z",+ "text": "Every Memecoin Is Now a 3D World You Can Walk Into published on @CoinMarketCap",+ "engagement": 16,+ "hasMedia": false,+ "priceAtPost": 0.0003401725835131491,+ "r1h": -0.91,+ "r4h": 0.51,+ "r24h": 1.1+ },+ {+ "id": "2061225752188842222",+ "url": "https://x.com/trythreews/status/2061225752188842222",+ "postedAt": "2026-05-31T23:18:09.000Z",+ "text": "IBM partnership has been extremely helpful. Excited to show everyone what we have been working on with them! More updates to come.",+ "engagement": 36,+ "hasMedia": false,+ "priceAtPost": 0.0003189743540103499,+ "r1h": 14.33,+ "r4h": -0.04,+ "r24h": 815.75+ },+ {+ "id": "2061450827672514602",+ "url": "https://x.com/trythreews/status/2061450827672514602",+ "postedAt": "2026-06-01T14:12:31.000Z",+ "text": "@IBM Right back at you! We cannot wait to show everyone what we have been working on together, a first of its kind. The $three ecosystem is ",+ "engagement": 18,+ "hasMedia": false,+ "priceAtPost": 0.002485538534652559,+ "r1h": -25.97,+ "r4h": -7.46,+ "r24h": 50.89+ },+ {+ "id": "2061594627531219354",+ "url": "https://x.com/trythreews/status/2061594627531219354",+ "postedAt": "2026-06-01T23:43:56.000Z",+ "text": "a very early concept we have since improved a ton. your agents can react with custom animations and emotions connected to any APIs or data f",+ "engagement": 1,+ "hasMedia": true,+ "priceAtPost": 0.0029763992247414175,+ "r1h": -16.12,+ "r4h": -14.21,+ "r24h": 12.21+ },+ {+ "id": "2061723245666279707",+ "url": "https://x.com/trythreews/status/2061723245666279707",+ "postedAt": "2026-06-02T08:15:01.000Z",+ "text": "",+ "engagement": 3,+ "hasMedia": true,+ "priceAtPost": 0.004054787937413343,+ "r1h": 5.24,+ "r4h": 1.55,+ "r24h": -9.02+ },+ {+ "id": "2062300713498165405",+ "url": "https://x.com/trythreews/status/2062300713498165405",+ "postedAt": "2026-06-03T22:29:40.000Z",+ "text": "",+ "engagement": 48,+ "hasMedia": false,+ "priceAtPost": 0.006884325318816414,+ "r1h": -9.68,+ "r4h": -5.48,+ "r24h": -2.09+ },+ {+ "id": "2062300984601178324",+ "url": "https://x.com/trythreews/status/2062300984601178324",+ "postedAt": "2026-06-03T22:30:45.000Z",+ "text": "",+ "engagement": 18,+ "hasMedia": false,+ "priceAtPost": 0.00644140474833098,+ "r1h": -10.04,+ "r4h": 3.37,+ "r24h": 2.97+ },+ {+ "id": "2062332404904161563",+ "url": "https://x.com/trythreews/status/2062332404904161563",+ "postedAt": "2026-06-04T00:35:36.000Z",+ "text": "We are extremely grateful for our cloud partners, who make it possible for us to experiment and test new features at a scale that would be n",+ "engagement": 6,+ "hasMedia": false,+ "priceAtPost": 0.007025507387539077,+ "r1h": -1.15,+ "r4h": 50.09,+ "r24h": -5.92+ },+ {+ "id": "2062333169693585756",+ "url": "https://x.com/trythreews/status/2062333169693585756",+ "postedAt": "2026-06-04T00:38:38.000Z",+ "text": "That’s exactly why we continue to publicly thank our cloud partners, providers, and the incredible developers who work alongside us. Their s",+ "engagement": 2,+ "hasMedia": false,+ "priceAtPost": 0.007025507387539077,+ "r1h": -1.15,+ "r4h": 50.09,+ "r24h": -5.92+ },+ {+ "id": "2063138183798525979",+ "url": "https://x.com/trythreews/status/2063138183798525979",+ "postedAt": "2026-06-06T05:57:28.000Z",+ "text": "yes, we are on Vogue. nice find!",+ "engagement": 37,+ "hasMedia": false,+ "priceAtPost": 0.003263682354681633,+ "r1h": 9.38,+ "r4h": 22.03,+ "r24h": 74.82+ },+ {+ "id": "2063226238316183870",+ "url": "https://x.com/trythreews/status/2063226238316183870",+ "postedAt": "2026-06-06T11:47:22.000Z",+ "text": "Love you too, SHcryptt Have an amazing day please!",+ "engagement": 14,+ "hasMedia": false,+ "priceAtPost": 0.004065346128654576,+ "r1h": 10.46,+ "r4h": 17.32,+ "r24h": 27.12+ },+ {+ "id": "2063227297478725739",+ "url": "https://x.com/trythreews/status/2063227297478725739",+ "postedAt": "2026-06-06T11:51:35.000Z",+ "text": "nice chart! thanks so much, aze_gen!!",+ "engagement": 35,+ "hasMedia": false,+ "priceAtPost": 0.004065346128654576,+ "r1h": 10.46,+ "r4h": 17.32,+ "r24h": 27.12+ },+ {+ "id": "2063227868642230473",+ "url": "https://x.com/trythreews/status/2063227868642230473",+ "postedAt": "2026-06-06T11:53:51.000Z",+ "text": "I know you'll succeed, and with even greater success!",+ "engagement": 8,+ "hasMedia": false,+ "priceAtPost": 0.004065346128654576,+ "r1h": 10.46,+ "r4h": 17.32,+ "r24h": 27.12+ },+ {+ "id": "2063227991514296336",+ "url": "https://x.com/trythreews/status/2063227991514296336",+ "postedAt": "2026-06-06T11:54:20.000Z",+ "text": "thanks for the support Hash",+ "engagement": 12,+ "hasMedia": false,+ "priceAtPost": 0.004065346128654576,+ "r1h": 10.46,+ "r4h": 17.32,+ "r24h": 27.12+ },+ {+ "id": "2063228211706863668",+ "url": "https://x.com/trythreews/status/2063228211706863668",+ "postedAt": "2026-06-06T11:55:13.000Z",+ "text": "yes",+ "engagement": 10,+ "hasMedia": false,+ "priceAtPost": 0.004065346128654576,+ "r1h": 10.46,+ "r4h": 17.32,+ "r24h": 27.12+ },+ {+ "id": "2063228703052828779",+ "url": "https://x.com/trythreews/status/2063228703052828779",+ "postedAt": "2026-06-06T11:57:10.000Z",+ "text": "woah this is really clean. you've been making really nice art constantly. it's inspiring",+ "engagement": 32,+ "hasMedia": false,+ "priceAtPost": 0.004065346128654576,+ "r1h": 10.46,+ "r4h": 17.32,+ "r24h": 27.12+ },+ {+ "id": "2063228888059416639",+ "url": "https://x.com/trythreews/status/2063228888059416639",+ "postedAt": "2026-06-06T11:57:54.000Z",+ "text": "you are amazing",+ "engagement": 17,+ "hasMedia": false,+ "priceAtPost": 0.004065346128654576,+ "r1h": 10.46,+ "r4h": 17.32,+ "r24h": 27.12+ },+ {+ "id": "2063229412007641496",+ "url": "https://x.com/trythreews/status/2063229412007641496",+ "postedAt": "2026-06-06T11:59:59.000Z",+ "text": "lets",+ "engagement": 10,+ "hasMedia": false,+ "priceAtPost": 0.004065346128654576,+ "r1h": 10.46,+ "r4h": 17.32,+ "r24h": 27.12+ },+ {+ "id": "2063249039316140141",+ "url": "https://x.com/trythreews/status/2063249039316140141",+ "postedAt": "2026-06-06T13:17:58.000Z",+ "text": "Can't wait",+ "engagement": 79,+ "hasMedia": false,+ "priceAtPost": 0.004306291858127389,+ "r1h": 24.67,+ "r4h": 11.43,+ "r24h": 21.26+ },+ {+ "id": "2063535804589425052",+ "url": "https://x.com/trythreews/status/2063535804589425052",+ "postedAt": "2026-06-07T08:17:29.000Z",+ "text": "Definitely. We plan to cover more agent2agent payments this week as well. It will be an exciting week, thanks for the support always.",+ "engagement": 59,+ "hasMedia": false,+ "priceAtPost": 0.005402522445944524,+ "r1h": 2.07,+ "r4h": -10.01,+ "r24h": -17.18+ },+ {+ "id": "2064061500717928473",+ "url": "https://x.com/trythreews/status/2064061500717928473",+ "postedAt": "2026-06-08T19:06:24.000Z",+ "text": "",+ "engagement": 13,+ "hasMedia": false,+ "priceAtPost": 0.004340056563771534,+ "r1h": -6.62,+ "r4h": -11.17,+ "r24h": -24.81+ },+ {+ "id": "2064063769735799036",+ "url": "https://x.com/trythreews/status/2064063769735799036",+ "postedAt": "2026-06-08T19:15:25.000Z",+ "text": "",+ "engagement": 17,+ "hasMedia": false,+ "priceAtPost": 0.0043234052578664485,+ "r1h": -9.81,+ "r4h": -11.81,+ "r24h": -27.97+ },+ {+ "id": "2064242904428925036",+ "url": "https://x.com/trythreews/status/2064242904428925036",+ "postedAt": "2026-06-09T07:07:14.000Z",+ "text": "333 of the first 3D avatars ever created on three․ws are now on-chain, forever. Each one a real agent. Its own wallet, reputation, and x402 ",+ "engagement": 41,+ "hasMedia": true,+ "priceAtPost": 0.0034460287288585315,+ "r1h": 7.69,+ "r4h": 5.96,+ "r24h": -3.29+ },+ {+ "id": "2064243276388184483",+ "url": "https://x.com/trythreews/status/2064243276388184483",+ "postedAt": "2026-06-09T07:08:43.000Z",+ "text": "Most of these were made by people who've never touched a seed phrase, a wallet, or a block explorer. That's the point. You make a 3D avatar.",+ "engagement": 3,+ "hasMedia": false,+ "priceAtPost": 0.0034460287288585315,+ "r1h": 7.69,+ "r4h": 5.96,+ "r24h": -3.29+ },+ {+ "id": "2064243575727300923",+ "url": "https://x.com/trythreews/status/2064243575727300923",+ "postedAt": "2026-06-09T07:09:54.000Z",+ "text": "This is how you bring the next wave into web3, not with a tutorial, but with something they already want to make. Show people what's possibl",+ "engagement": 2,+ "hasMedia": false,+ "priceAtPost": 0.0034460287288585315,+ "r1h": 7.69,+ "r4h": 5.96,+ "r24h": -3.29+ },+ {+ "id": "2064268109888860323",+ "url": "https://x.com/trythreews/status/2064268109888860323",+ "postedAt": "2026-06-09T08:47:24.000Z",+ "text": "We have added x402 crypto payments for seamless access to AI API endpoints, enabling both users and autonomous AI agents to interact with se",+ "engagement": 22,+ "hasMedia": true,+ "priceAtPost": 0.0036707728273105656,+ "r1h": 5.38,+ "r4h": 7.08,+ "r24h": 4.55+ },+ {+ "id": "2064268495278485766",+ "url": "https://x.com/trythreews/status/2064268495278485766",+ "postedAt": "2026-06-09T08:48:56.000Z",+ "text": "Stay tuned to see the full video in action.",+ "engagement": 34,+ "hasMedia": false,+ "priceAtPost": 0.0036707728273105656,+ "r1h": 5.38,+ "r4h": 7.08,+ "r24h": 4.55+ },+ {+ "id": "2064271517207441720",+ "url": "https://x.com/trythreews/status/2064271517207441720",+ "postedAt": "2026-06-09T09:00:56.000Z",+ "text": "Always working on making the user experience better. Let us know what we can do to make it better for you. Thanks for the support, looking f",+ "engagement": 14,+ "hasMedia": false,+ "priceAtPost": 0.003636377432610298,+ "r1h": 10.51,+ "r4h": 7.01,+ "r24h": 12.11+ },+ {+ "id": "2064271946129494364",+ "url": "https://x.com/trythreews/status/2064271946129494364",+ "postedAt": "2026-06-09T09:02:38.000Z",+ "text": ". . . . . . . . . .",+ "engagement": 17,+ "hasMedia": false,+ "priceAtPost": 0.003636377432610298,+ "r1h": 10.51,+ "r4h": 7.01,+ "r24h": 12.11+ },+ {+ "id": "2066746730079719514",+ "url": "https://x.com/trythreews/status/2066746730079719514",+ "postedAt": "2026-06-16T04:56:33.000Z",+ "text": "",+ "engagement": 6,+ "hasMedia": false,+ "priceAtPost": 0.0038989693648079846,+ "r1h": -4.18,+ "r4h": -5.99,+ "r24h": -13.63+ },+ {+ "id": "2066781339484135520",+ "url": "https://x.com/trythreews/status/2066781339484135520",+ "postedAt": "2026-06-16T07:14:04.000Z",+ "text": "your artwork is one of a kind",+ "engagement": 1,+ "hasMedia": false,+ "priceAtPost": 0.0036698792703462077,+ "r1h": 1.59,+ "r4h": -1.21,+ "r24h": -8.47+ },+ {+ "id": "2066781386732978422",+ "url": "https://x.com/trythreews/status/2066781386732978422",+ "postedAt": "2026-06-16T07:14:16.000Z",+ "text": "",+ "engagement": 0,+ "hasMedia": false,+ "priceAtPost": 0.0036698792703462077,+ "r1h": 1.59,+ "r4h": -1.21,+ "r24h": -8.47+ },+ {+ "id": "2066781488289574950",+ "url": "https://x.com/trythreews/status/2066781488289574950",+ "postedAt": "2026-06-16T07:14:40.000Z",+ "text": "",+ "engagement": 0,+ "hasMedia": false,+ "priceAtPost": 0.0036698792703462077,+ "r1h": 1.59,+ "r4h": -1.21,+ "r24h": -8.47+ },+ {+ "id": "2066782180492390665",+ "url": "https://x.com/trythreews/status/2066782180492390665",+ "postedAt": "2026-06-16T07:17:25.000Z",+ "text": "with on-chain reputation, know you are transacting with good ai just as you would any service verifiable, on-chain transparent proof",+ "engagement": 88,+ "hasMedia": false,+ "priceAtPost": 0.0037672081370233867,+ "r1h": -2.77,+ "r4h": -4.93,+ "r24h": -10.56+ },+ {+ "id": "2066795399055331684",+ "url": "https://x.com/trythreews/status/2066795399055331684",+ "postedAt": "2026-06-16T08:09:56.000Z",+ "text": "",+ "engagement": 0,+ "hasMedia": false,+ "priceAtPost": 0.0037283159339382655,+ "r1h": 0.46,+ "r4h": -3.13,+ "r24h": -10.24+ },+ {+ "id": "2066796513884524669",+ "url": "https://x.com/trythreews/status/2066796513884524669",+ "postedAt": "2026-06-16T08:14:22.000Z",+ "text": "love it",+ "engagement": 8,+ "hasMedia": false,+ "priceAtPost": 0.0037283159339382655,+ "r1h": 0.46,+ "r4h": -3.13,+ "r24h": -10.24+ },+ {+ "id": "2066822806487331082",+ "url": "https://x.com/trythreews/status/2066822806487331082",+ "postedAt": "2026-06-16T09:58:51.000Z",+ "text": "The cat deserves a treat",+ "engagement": 1,+ "hasMedia": false,+ "priceAtPost": 0.0037349326266584533,+ "r1h": -0.94,+ "r4h": -0.85,+ "r24h": -11.49+ },+ {+ "id": "2067553231967031646",+ "url": "https://x.com/trythreews/status/2067553231967031646",+ "postedAt": "2026-06-18T10:21:18.000Z",+ "text": "",+ "engagement": 33,+ "hasMedia": false,+ "priceAtPost": 0.0033136838242268586,+ "r1h": -1.2,+ "r4h": -1.59,+ "r24h": 27.39+ },+ {+ "id": "2067556838288343151",+ "url": "https://x.com/trythreews/status/2067556838288343151",+ "postedAt": "2026-06-18T10:35:38.000Z",+ "text": "it's working",+ "engagement": 24,+ "hasMedia": false,+ "priceAtPost": 0.0033094471393012837,+ "r1h": 3.95,+ "r4h": -1.79,+ "r24h": 25.25+ },+ {+ "id": "2067564518268629236",+ "url": "https://x.com/trythreews/status/2067564518268629236",+ "postedAt": "2026-06-18T11:06:09.000Z",+ "text": "the amazon for ai agents",+ "engagement": 67,+ "hasMedia": false,+ "priceAtPost": 0.003344012519829791,+ "r1h": 0.98,+ "r4h": -2.92,+ "r24h": 20.26+ },+ {+ "id": "2067566844798787634",+ "url": "https://x.com/trythreews/status/2067566844798787634",+ "postedAt": "2026-06-18T11:15:23.000Z",+ "text": "three․ws Launches the Amazon for AI Agents published on @CoinMarketCap",+ "engagement": 10,+ "hasMedia": false,+ "priceAtPost": 0.003273810296412043,+ "r1h": 2.8,+ "r4h": -2.89,+ "r24h": 22.37+ },+ {+ "id": "2067757332340375732",+ "url": "https://x.com/trythreews/status/2067757332340375732",+ "postedAt": "2026-06-18T23:52:19.000Z",+ "text": "yes we appreciate all the help from @pumpfun and @CoinComms",+ "engagement": 11,+ "hasMedia": false,+ "priceAtPost": 0.0032347177921906614,+ "r1h": 4.99,+ "r4h": 15.91,+ "r24h": 22.06+ },+ {+ "id": "2067757368113508540",+ "url": "https://x.com/trythreews/status/2067757368113508540",+ "postedAt": "2026-06-18T23:52:28.000Z",+ "text": "",+ "engagement": 36,+ "hasMedia": false,+ "priceAtPost": 0.0032347177921906614,+ "r1h": 4.99,+ "r4h": 15.91,+ "r24h": 22.06+ },+ {+ "id": "2067757457980756332",+ "url": "https://x.com/trythreews/status/2067757457980756332",+ "postedAt": "2026-06-18T23:52:49.000Z",+ "text": "well said! thanks for the support",+ "engagement": 19,+ "hasMedia": false,+ "priceAtPost": 0.0032347177921906614,+ "r1h": 4.99,+ "r4h": 15.91,+ "r24h": 22.06+ },+ {+ "id": "2067759541476012066",+ "url": "https://x.com/trythreews/status/2067759541476012066",+ "postedAt": "2026-06-19T00:01:06.000Z",+ "text": "It's something we spent a lot of time thinking about and have been working on improving it as well. Thanks!",+ "engagement": 16,+ "hasMedia": false,+ "priceAtPost": 0.003238490837841927,+ "r1h": 13.07,+ "r4h": 14.26,+ "r24h": 23.17+ },+ {+ "id": "2067759562787377231",+ "url": "https://x.com/trythreews/status/2067759562787377231",+ "postedAt": "2026-06-19T00:01:11.000Z",+ "text": "",+ "engagement": 7,+ "hasMedia": false,+ "priceAtPost": 0.003238490837841927,+ "r1h": 13.07,+ "r4h": 14.26,+ "r24h": 23.17+ },+ {+ "id": "2067759648527245739",+ "url": "https://x.com/trythreews/status/2067759648527245739",+ "postedAt": "2026-06-19T00:01:31.000Z",+ "text": "",+ "engagement": 8,+ "hasMedia": false,+ "priceAtPost": 0.003238490837841927,+ "r1h": 13.07,+ "r4h": 14.26,+ "r24h": 23.17+ },+ {+ "id": "2067824141458444760",+ "url": "https://x.com/trythreews/status/2067824141458444760",+ "postedAt": "2026-06-19T04:17:48.000Z",+ "text": "",+ "engagement": 1,+ "hasMedia": false,+ "priceAtPost": 0.0036803738838521033,+ "r1h": -2.26,+ "r4h": 17.67,+ "r24h": 12.26+ },+ {+ "id": "2068044881281667181",+ "url": "https://x.com/trythreews/status/2068044881281667181",+ "postedAt": "2026-06-19T18:54:56.000Z",+ "text": "We appreciate everything you’ve built, @initwithcarl @Pumpfun @PumpfunEco It’s given us the opportunity to scale, connect with the community",+ "engagement": 10,+ "hasMedia": false,+ "priceAtPost": 0.004073295096031024,+ "r1h": -5.48,+ "r4h": -2.19,+ "r24h": -10.56+ },+ {+ "id": "2068626384457699548",+ "url": "https://x.com/trythreews/status/2068626384457699548",+ "postedAt": "2026-06-21T09:25:37.000Z",+ "text": "You are locked in! Still improving the feature, but thanks for sharing.",+ "engagement": 27,+ "hasMedia": false,+ "priceAtPost": 0.0033977992947568304,+ "r1h": 3.58,+ "r4h": 2.16,+ "r24h": 32.68+ },+ {+ "id": "2068951336918638699",+ "url": "https://x.com/trythreews/status/2068951336918638699",+ "postedAt": "2026-06-22T06:56:52.000Z",+ "text": "Give your agents access to money We just shipped a drop-in payment modal for any x402 paid endpoint. The protocol is simple but the wallet U",+ "engagement": 84,+ "hasMedia": true,+ "priceAtPost": 0.004048030850063972,+ "r1h": 16.88,+ "r4h": 11.42,+ "r24h": 15.25+ },+ {+ "id": "2068961439465796028",+ "url": "https://x.com/trythreews/status/2068961439465796028",+ "postedAt": "2026-06-22T07:37:01.000Z",+ "text": "Important links from the video ▸ Try the modal live (real 402 → sign → settle) https:// three.ws/x402 ▸ The Pole Club x402 demo, tip in USDC",+ "engagement": 197,+ "hasMedia": false,+ "priceAtPost": 0.004552962386551055,+ "r1h": -1.76,+ "r4h": 2.47,+ "r24h": 3.27+ },+ {+ "id": "2068961675223748967",+ "url": "https://x.com/trythreews/status/2068961675223748967",+ "postedAt": "2026-06-22T07:37:57.000Z",+ "text": "For Demonstration Purposes Only.",+ "engagement": 12,+ "hasMedia": false,+ "priceAtPost": 0.004552962386551055,+ "r1h": -1.76,+ "r4h": 2.47,+ "r24h": 3.27+ },+ {+ "id": "2068961718559260953",+ "url": "https://x.com/trythreews/status/2068961718559260953",+ "postedAt": "2026-06-22T07:38:07.000Z",+ "text": "",+ "engagement": 17,+ "hasMedia": false,+ "priceAtPost": 0.004552962386551055,+ "r1h": -1.76,+ "r4h": 2.47,+ "r24h": 3.27+ },+ {+ "id": "2069299573705818598",+ "url": "https://x.com/trythreews/status/2069299573705818598",+ "postedAt": "2026-06-23T06:00:38.000Z",+ "text": "shoutout coinbase @agentcashdev and all the builders that made it possible",+ "engagement": 3,+ "hasMedia": false,+ "priceAtPost": 0.004792334524778837,+ "r1h": -3.17,+ "r4h": -6.37,+ "r24h": -4.28+ },+ {+ "id": "2069304121593840078",+ "url": "https://x.com/trythreews/status/2069304121593840078",+ "postedAt": "2026-06-23T06:18:43.000Z",+ "text": "",+ "engagement": 9,+ "hasMedia": false,+ "priceAtPost": 0.0046609114477385895,+ "r1h": 1.52,+ "r4h": -3.78,+ "r24h": -1.38+ },+ {+ "id": "2069309191089717280",+ "url": "https://x.com/trythreews/status/2069309191089717280",+ "postedAt": "2026-06-23T06:38:51.000Z",+ "text": "The Stripe of x402: How http:// three.ws Turned Agent Payments Into One Line of Code | Published on @CoinMarketCap https:// coinmarketcap.co",+ "engagement": 9,+ "hasMedia": false,+ "priceAtPost": 0.004585576890926052,+ "r1h": 2.54,+ "r4h": 2.05,+ "r24h": -5.07+ },+ {+ "id": "2069688347069759738",+ "url": "https://x.com/trythreews/status/2069688347069759738",+ "postedAt": "2026-06-24T07:45:29.000Z",+ "text": "",+ "engagement": 3,+ "hasMedia": false,+ "priceAtPost": 0.00455267682054954,+ "r1h": 2.33,+ "r4h": -1.53,+ "r24h": -1.78+ },+ {+ "id": "2069756310900576361",+ "url": "https://x.com/trythreews/status/2069756310900576361",+ "postedAt": "2026-06-24T12:15:33.000Z",+ "text": "",+ "engagement": 6,+ "hasMedia": false,+ "priceAtPost": 0.004507597733542574,+ "r1h": -2.67,+ "r4h": -8.35,+ "r24h": -8.07+ },+ {+ "id": "2069756386154848356",+ "url": "https://x.com/trythreews/status/2069756386154848356",+ "postedAt": "2026-06-24T12:15:51.000Z",+ "text": "nice username",+ "engagement": 1,+ "hasMedia": false,+ "priceAtPost": 0.004507597733542574,+ "r1h": -2.67,+ "r4h": -8.35,+ "r24h": -8.07+ },+ {+ "id": "2069763878406521077",+ "url": "https://x.com/trythreews/status/2069763878406521077",+ "postedAt": "2026-06-24T12:45:37.000Z",+ "text": "",+ "engagement": 1,+ "hasMedia": false,+ "priceAtPost": 0.004412643071655692,+ "r1h": -3.73,+ "r4h": -5.55,+ "r24h": -7.82+ },+ {+ "id": "2069771777312764173",+ "url": "https://x.com/trythreews/status/2069771777312764173",+ "postedAt": "2026-06-24T13:17:00.000Z",+ "text": "",+ "engagement": 1,+ "hasMedia": false,+ "priceAtPost": 0.004387436945702959,+ "r1h": -3.71,+ "r4h": -8.47,+ "r24h": -6.78+ },+ {+ "id": "2069948517960065050",+ "url": "https://x.com/trythreews/status/2069948517960065050",+ "postedAt": "2026-06-25T00:59:19.000Z",+ "text": "three․ws is live on @IBM",+ "engagement": 19,+ "hasMedia": true,+ "priceAtPost": 0.004362901920120416,+ "r1h": 1.17,+ "r4h": -4.59,+ "r24h": -21.78+ },+ {+ "id": "2069949927216799809",+ "url": "https://x.com/trythreews/status/2069949927216799809",+ "postedAt": "2026-06-25T01:04:55.000Z",+ "text": "Live on @IBMcloud https:// livesend.ibm.com/ls/527f279d-a1 1e-4959-8d26-6cb5ffa1b669/qAOM4JCT2EFe8u0C …",+ "engagement": 14,+ "hasMedia": false,+ "priceAtPost": 0.004343706288205234,+ "r1h": -5.57,+ "r4h": -1.82,+ "r24h": -21.51+ },+ {+ "id": "2069961582759829808",+ "url": "https://x.com/trythreews/status/2069961582759829808",+ "postedAt": "2026-06-25T01:51:14.000Z",+ "text": "More co-marketing with IBM coming",+ "engagement": 168,+ "hasMedia": false,+ "priceAtPost": 0.004413848483249174,+ "r1h": -7.08,+ "r4h": 2.91,+ "r24h": -21.18+ },+ {+ "id": "2070014575924363514",+ "url": "https://x.com/trythreews/status/2070014575924363514",+ "postedAt": "2026-06-25T05:21:48.000Z",+ "text": "",+ "engagement": 0,+ "hasMedia": false,+ "priceAtPost": 0.004335459127797473,+ "r1h": 5.01,+ "r4h": -0.61,+ "r24h": -17.33+ },+ {+ "id": "2070018210880262272",+ "url": "https://x.com/trythreews/status/2070018210880262272",+ "postedAt": "2026-06-25T05:36:15.000Z",+ "text": "SPOTLIGHT: three․ws an IBM Strategic Partner IBM just published a deep-dive on what three․ws is building. AI Agents that are spatial, embedd",+ "engagement": 26,+ "hasMedia": true,+ "priceAtPost": 0.0043061087110431275,+ "r1h": 5.03,+ "r4h": -2.4,+ "r24h": -14.23+ },+ {+ "id": "2070018691505467459",+ "url": "https://x.com/trythreews/status/2070018691505467459",+ "postedAt": "2026-06-25T05:38:09.000Z",+ "text": "\"IBM tried something different. Instead of slides about agents, we built one, live, on stream. We opened an empty editor, typed a single sen",+ "engagement": 11,+ "hasMedia": false,+ "priceAtPost": 0.0043061087110431275,+ "r1h": 5.03,+ "r4h": -2.4,+ "r24h": -14.23+ },+ {+ "id": "2071124932571115654",+ "url": "https://x.com/trythreews/status/2071124932571115654",+ "postedAt": "2026-06-28T06:53:58.000Z",+ "text": "",+ "engagement": 10,+ "hasMedia": false,+ "priceAtPost": 0.003490948730321493,+ "r1h": -11.51,+ "r4h": -11.93,+ "r24h": -32.31+ },+ {+ "id": "2071124949293834669",+ "url": "https://x.com/trythreews/status/2071124949293834669",+ "postedAt": "2026-06-28T06:54:02.000Z",+ "text": "",+ "engagement": 4,+ "hasMedia": false,+ "priceAtPost": 0.003490948730321493,+ "r1h": -11.51,+ "r4h": -11.93,+ "r24h": -32.31+ },+ {+ "id": "2071124964598763534",+ "url": "https://x.com/trythreews/status/2071124964598763534",+ "postedAt": "2026-06-28T06:54:05.000Z",+ "text": "",+ "engagement": 5,+ "hasMedia": false,+ "priceAtPost": 0.003490948730321493,+ "r1h": -11.51,+ "r4h": -11.93,+ "r24h": -32.31+ },+ {+ "id": "2071124997792493931",+ "url": "https://x.com/trythreews/status/2071124997792493931",+ "postedAt": "2026-06-28T06:54:13.000Z",+ "text": "Yes.",+ "engagement": 10,+ "hasMedia": false,+ "priceAtPost": 0.003490948730321493,+ "r1h": -11.51,+ "r4h": -11.93,+ "r24h": -32.31+ },+ {+ "id": "2071125024032113087",+ "url": "https://x.com/trythreews/status/2071125024032113087",+ "postedAt": "2026-06-28T06:54:20.000Z",+ "text": "",+ "engagement": 2,+ "hasMedia": false,+ "priceAtPost": 0.003490948730321493,+ "r1h": -11.51,+ "r4h": -11.93,+ "r24h": -32.31+ },+ {+ "id": "2071125081678626851",+ "url": "https://x.com/trythreews/status/2071125081678626851",+ "postedAt": "2026-06-28T06:54:33.000Z",+ "text": "",+ "engagement": 3,+ "hasMedia": false,+ "priceAtPost": 0.003490948730321493,+ "r1h": -11.51,+ "r4h": -11.93,+ "r24h": -32.31+ },+ {+ "id": "2071125108090179795",+ "url": "https://x.com/trythreews/status/2071125108090179795",+ "postedAt": "2026-06-28T06:54:40.000Z",+ "text": "",+ "engagement": 3,+ "hasMedia": false,+ "priceAtPost": 0.003490948730321493,+ "r1h": -11.51,+ "r4h": -11.93,+ "r24h": -32.31+ },+ {+ "id": "2071132452366827697",+ "url": "https://x.com/trythreews/status/2071132452366827697",+ "postedAt": "2026-06-28T07:23:51.000Z",+ "text": "thank you BABUPENGUIN",+ "engagement": 10,+ "hasMedia": false,+ "priceAtPost": 0.0031597275586841764,+ "r1h": -2.64,+ "r4h": -3.89,+ "r24h": -30.15+ },+ {+ "id": "2071305108797939744",+ "url": "https://x.com/trythreews/status/2071305108797939744",+ "postedAt": "2026-06-28T18:49:55.000Z",+ "text": "When you have goals and are truly passionate, you don’t stop until you accomplish what you set out to do. Jobs not finished.",+ "engagement": 3,+ "hasMedia": false,+ "priceAtPost": 0.0026235094160740845,+ "r1h": 0.87,+ "r4h": -1.78,+ "r24h": -2.72+ },+ {+ "id": "2071339081431417298",+ "url": "https://x.com/trythreews/status/2071339081431417298",+ "postedAt": "2026-06-28T21:04:55.000Z",+ "text": "thank you for listing us and believing in us MAXBID",+ "engagement": 10,+ "hasMedia": false,+ "priceAtPost": 0.0027021124084652282,+ "r1h": -2.63,+ "r4h": -6.6,+ "r24h": 7.67+ },+ {+ "id": "2073341453166850060",+ "url": "https://x.com/trythreews/status/2073341453166850060",+ "postedAt": "2026-07-04T09:41:37.000Z",+ "text": "Happy birthday! We hope it's your best year yet.",+ "engagement": 12,+ "hasMedia": false,+ "priceAtPost": 0.0016534142242657145,+ "r1h": 2,+ "r4h": 1.89,+ "r24h": -23.01+ },+ {+ "id": "2073812694600384788",+ "url": "https://x.com/trythreews/status/2073812694600384788",+ "postedAt": "2026-07-05T16:54:10.000Z",+ "text": "hello @elonmusk",+ "engagement": 71,+ "hasMedia": false,+ "priceAtPost": 0.0014523216527396732,+ "r1h": 28.46,+ "r4h": 15.75,+ "r24h": 7.79+ },+ {+ "id": "2073819619660538217",+ "url": "https://x.com/trythreews/status/2073819619660538217",+ "postedAt": "2026-07-05T17:21:41.000Z",+ "text": "",+ "engagement": 40,+ "hasMedia": false,+ "priceAtPost": 0.0015356906058650783,+ "r1h": 19.25,+ "r4h": 5.59,+ "r24h": 4.33+ },+ {+ "id": "2073943451499131112",+ "url": "https://x.com/trythreews/status/2073943451499131112",+ "postedAt": "2026-07-06T01:33:45.000Z",+ "text": "We just shipped 3,000+ animations for 3D AI Agents. http:// three.ws is now officially the largest library of animations, poses, and movemen",+ "engagement": 42,+ "hasMedia": true,+ "priceAtPost": 0.0014192627106814652,+ "r1h": -2.1,+ "r4h": 0.64,+ "r24h": 15.95+ },+ {+ "id": "2073943518574518412",+ "url": "https://x.com/trythreews/status/2073943518574518412",+ "postedAt": "2026-07-06T01:34:01.000Z",+ "text": "",+ "engagement": 1,+ "hasMedia": false,+ "priceAtPost": 0.0014192627106814652,+ "r1h": -2.1,+ "r4h": 0.64,+ "r24h": 15.95+ },+ {+ "id": "2073987916712575386",+ "url": "https://x.com/trythreews/status/2073987916712575386",+ "postedAt": "2026-07-06T04:30:26.000Z",+ "text": "",+ "engagement": 7,+ "hasMedia": false,+ "priceAtPost": 0.0014567954741022836,+ "r1h": -1.95,+ "r4h": 4.43,+ "r24h": 1.9+ },+ {+ "id": "2074205309078557079",+ "url": "https://x.com/trythreews/status/2074205309078557079",+ "postedAt": "2026-07-06T18:54:17.000Z",+ "text": "",+ "engagement": 22,+ "hasMedia": false,+ "priceAtPost": 0.0016327425447090927,+ "r1h": -5.66,+ "r4h": -0.81,+ "r24h": -4.12+ },+ {+ "id": "2074462590663877096",+ "url": "https://x.com/trythreews/status/2074462590663877096",+ "postedAt": "2026-07-07T11:56:37.000Z",+ "text": "thanks, Toly!",+ "engagement": 37,+ "hasMedia": false,+ "priceAtPost": 0.0015843258612289496,+ "r1h": 4.05,+ "r4h": 4.31,+ "r24h": -19.31+ },+ {+ "id": "2074464611563417685",+ "url": "https://x.com/trythreews/status/2074464611563417685",+ "postedAt": "2026-07-07T12:04:39.000Z",+ "text": "wait, woah!",+ "engagement": 9,+ "hasMedia": false,+ "priceAtPost": 0.001590608453175905,+ "r1h": 3.34,+ "r4h": 2.14,+ "r24h": -18.31+ },+ {+ "id": "2074501642897285513",+ "url": "https://x.com/trythreews/status/2074501642897285513",+ "postedAt": "2026-07-07T14:31:48.000Z",+ "text": "$three > $BTC",+ "engagement": 34,+ "hasMedia": false,+ "priceAtPost": 0.0015639106058180003,+ "r1h": 4.28,+ "r4h": 1.04,+ "r24h": -20.08+ },+ {+ "id": "2074759289668039153",+ "url": "https://x.com/trythreews/status/2074759289668039153",+ "postedAt": "2026-07-08T07:35:36.000Z",+ "text": "Your website just got an interactive tour guide. Introducing Tour 3D AI Agents now walk your actual live site, spotlighting each feature, an",+ "engagement": 30,+ "hasMedia": true,+ "priceAtPost": 0.001207016782091648,+ "r1h": 0.8,+ "r4h": 5.51,+ "r24h": 10.44+ },+ {+ "id": "2074759891357745160",+ "url": "https://x.com/trythreews/status/2074759891357745160",+ "postedAt": "2026-07-08T07:37:59.000Z",+ "text": "http:// three.ws/tour http:// three.ws/walk https:// three.ws/tour-builder http:// three.ws/play",+ "engagement": 92,+ "hasMedia": false,+ "priceAtPost": 0.001207016782091648,+ "r1h": 0.8,+ "r4h": 5.51,+ "r24h": 10.44+ },+ {+ "id": "2074761553346478138",+ "url": "https://x.com/trythreews/status/2074761553346478138",+ "postedAt": "2026-07-08T07:44:36.000Z",+ "text": "For the developers: Did you know we have 70+ packages on npm? three-ws/tour https:// npmjs.com/package/@three -ws/tour … three-ws/walk https",+ "engagement": 111,+ "hasMedia": true,+ "priceAtPost": 0.001207016782091648,+ "r1h": 0.8,+ "r4h": 5.51,+ "r24h": 10.44+ },+ {+ "id": "2075478948625182991",+ "url": "https://x.com/trythreews/status/2075478948625182991",+ "postedAt": "2026-07-10T07:15:16.000Z",+ "text": "Guardrails and safety measures for all autonomous agents. Video incoming.",+ "engagement": 69,+ "hasMedia": true,+ "priceAtPost": 0.0013268205578189985,+ "r1h": 3.73,+ "r4h": 15.62,+ "r24h": -0.94+ },+ {+ "id": "2075491436087390443",+ "url": "https://x.com/trythreews/status/2075491436087390443",+ "postedAt": "2026-07-10T08:04:53.000Z",+ "text": "awesome thread",+ "engagement": 13,+ "hasMedia": false,+ "priceAtPost": 0.001367939883117265,+ "r1h": 16.84,+ "r4h": 11.33,+ "r24h": -1.83+ },+ {+ "id": "2075494272804241580",+ "url": "https://x.com/trythreews/status/2075494272804241580",+ "postedAt": "2026-07-10T08:16:10.000Z",+ "text": "Part I \u2014 The 23 wallet abilities 01 · Balance Your agent's real Solana balance, live from the chain \u2014 with a USD estimate and a receipt trai",+ "engagement": 33,+ "hasMedia": false,+ "priceAtPost": 0.0013762604419651837,+ "r1h": 11.89,+ "r4h": 14.87,+ "r24h": -2.43+ },+ {+ "id": "2075495172243354102",+ "url": "https://x.com/trythreews/status/2075495172243354102",+ "postedAt": "2026-07-10T08:19:44.000Z",+ "text": "Will add to our website docs. Agent abilities for on-chain actions can be found here",+ "engagement": 63,+ "hasMedia": false,+ "priceAtPost": 0.0013762604419651837,+ "r1h": 11.89,+ "r4h": 14.87,+ "r24h": -2.43+ },+ {+ "id": "2075520492832985176",+ "url": "https://x.com/trythreews/status/2075520492832985176",+ "postedAt": "2026-07-10T10:00:21.000Z",+ "text": "@solana",+ "engagement": 10,+ "hasMedia": false,+ "priceAtPost": 0.0016388884082936552,+ "r1h": -2.64,+ "r4h": -13.29,+ "r24h": -22.5+ },+ {+ "id": "2075683856334885345",+ "url": "https://x.com/trythreews/status/2075683856334885345",+ "postedAt": "2026-07-10T20:49:30.000Z",+ "text": "and give them llm brain and emotion",+ "engagement": 3,+ "hasMedia": false,+ "priceAtPost": 0.0013420361446278989,+ "r1h": 10.88,+ "r4h": -8.16,+ "r24h": 10.91+ },+ {+ "id": "2075835576763515356",+ "url": "https://x.com/trythreews/status/2075835576763515356",+ "postedAt": "2026-07-11T06:52:23.000Z",+ "text": "And to the community: You didn't watch this get built. You built it. The next chapter is for you. Let's do it bigger than we have done it so",+ "engagement": 69,+ "hasMedia": false,+ "priceAtPost": 0.0013231198963067463,+ "r1h": 0.1,+ "r4h": -1.39,+ "r24h": 16.92+ },+ {+ "id": "2075835631004160345",+ "url": "https://x.com/trythreews/status/2075835631004160345",+ "postedAt": "2026-07-11T06:52:36.000Z",+ "text": "",+ "engagement": 9,+ "hasMedia": false,+ "priceAtPost": 0.0013231198963067463,+ "r1h": 0.1,+ "r4h": -1.39,+ "r24h": 16.92+ },+ {+ "id": "2075835664307044760",+ "url": "https://x.com/trythreews/status/2075835664307044760",+ "postedAt": "2026-07-11T06:52:44.000Z",+ "text": "",+ "engagement": 4,+ "hasMedia": false,+ "priceAtPost": 0.0013231198963067463,+ "r1h": 0.1,+ "r4h": -1.39,+ "r24h": 16.92+ },+ {+ "id": "2075835958889685499",+ "url": "https://x.com/trythreews/status/2075835958889685499",+ "postedAt": "2026-07-11T06:53:54.000Z",+ "text": "We are thrilled to announce http:// three.ws has been accepted into the NVIDIA Developer Program Our free text→3D engine already runs on NVI",+ "engagement": 0,+ "hasMedia": true,+ "priceAtPost": 0.0013231198963067463,+ "r1h": 0.1,+ "r4h": -1.39,+ "r24h": 16.92+ },+ {+ "id": "2077411770659221685",+ "url": "https://x.com/trythreews/status/2077411770659221685",+ "postedAt": "2026-07-15T15:15:37.000Z",+ "text": "That's a great idea and we have been slowly building out http:// three.ws/play - we have been testing walking around Google Maps, real locat",+ "engagement": 20,+ "hasMedia": false,+ "priceAtPost": 0.0029613960641361498,+ "r1h": -5.45,+ "r4h": -15.57,+ "r24h": -23.2+ },+ {+ "id": "2077791336561070434",+ "url": "https://x.com/trythreews/status/2077791336561070434",+ "postedAt": "2026-07-16T16:23:52.000Z",+ "text": "this is us coded",+ "engagement": 39,+ "hasMedia": false,+ "priceAtPost": 0.002161082344315134,+ "r1h": -6.68,+ "r4h": 5.07,+ "r24h": -7.61+ },+ {+ "id": "2077791709321433472",+ "url": "https://x.com/trythreews/status/2077791709321433472",+ "postedAt": "2026-07-16T16:25:21.000Z",+ "text": "A product shipped by @trythreews that literally everyone with a phone can try and use. We want to reward people for trying this new feature.",+ "engagement": 57,+ "hasMedia": false,+ "priceAtPost": 0.002161082344315134,+ "r1h": -6.68,+ "r4h": 5.07,+ "r24h": -7.61+ },+ {+ "id": "2077793694498124023",+ "url": "https://x.com/trythreews/status/2077793694498124023",+ "postedAt": "2026-07-16T16:33:14.000Z",+ "text": "Thank you for the support.",+ "engagement": 26,+ "hasMedia": false,+ "priceAtPost": 0.0019670314552374373,+ "r1h": 1.59,+ "r4h": 14.6,+ "r24h": -3.45+ },+ {+ "id": "2077794234829328415",+ "url": "https://x.com/trythreews/status/2077794234829328415",+ "postedAt": "2026-07-16T16:35:23.000Z",+ "text": "",+ "engagement": 5,+ "hasMedia": false,+ "priceAtPost": 0.0019670314552374373,+ "r1h": 1.59,+ "r4h": 14.6,+ "r24h": -3.45+ },+ {+ "id": "2077886141408460991",+ "url": "https://x.com/trythreews/status/2077886141408460991",+ "postedAt": "2026-07-16T22:40:36.000Z",+ "text": "three․ws has officially joined the @Quicknode Startup Program Everything on three․ws that touches a chain also touches an RPC endpoint: agen",+ "engagement": 29,+ "hasMedia": true,+ "priceAtPost": 0.002172222537390356,+ "r1h": 5.48,+ "r4h": 11.18,+ "r24h": -16.53+ },+ {+ "id": "2077887070291538417",+ "url": "https://x.com/trythreews/status/2077887070291538417",+ "postedAt": "2026-07-16T22:44:17.000Z",+ "text": "Definitely. Thanks RaFa!",+ "engagement": 7,+ "hasMedia": false,+ "priceAtPost": 0.002172222537390356,+ "r1h": 5.48,+ "r4h": 11.18,+ "r24h": -16.53+ },+ {+ "id": "2077887148372754662",+ "url": "https://x.com/trythreews/status/2077887148372754662",+ "postedAt": "2026-07-16T22:44:36.000Z",+ "text": "My thoughts exactly. Crank up the RPC calls!",+ "engagement": 8,+ "hasMedia": false,+ "priceAtPost": 0.002172222537390356,+ "r1h": 5.48,+ "r4h": 11.18,+ "r24h": -16.53+ },+ {+ "id": "2077891066762756376",+ "url": "https://x.com/trythreews/status/2077891066762756376",+ "postedAt": "2026-07-16T23:00:10.000Z",+ "text": "",+ "engagement": 90,+ "hasMedia": false,+ "priceAtPost": 0.0023319457515509974,+ "r1h": 6.95,+ "r4h": 6.21,+ "r24h": -19.21+ },+ {+ "id": "2077892141414785067",+ "url": "https://x.com/trythreews/status/2077892141414785067",+ "postedAt": "2026-07-16T23:04:26.000Z",+ "text": "Thank you for your support!",+ "engagement": 3,+ "hasMedia": false,+ "priceAtPost": 0.0023319457515509974,+ "r1h": 6.95,+ "r4h": 6.21,+ "r24h": -19.21+ },+ {+ "id": "2078321037868167313",+ "url": "https://x.com/trythreews/status/2078321037868167313",+ "postedAt": "2026-07-18T03:28:43.000Z",+ "text": "IBM just gave three․ws its own corner of IBM․com An official community on IBM's platform, dedicated entirely to what we do. Quietly one of o",+ "engagement": 46,+ "hasMedia": true,+ "priceAtPost": 0.0018139415573694769,+ "r1h": 1.56,+ "r4h": 9.17,+ "r24h": 23.31+ },+ {+ "id": "2078785596286545942",+ "url": "https://x.com/trythreews/status/2078785596286545942",+ "postedAt": "2026-07-19T10:14:42.000Z",+ "text": "Tamil is already live. If it needs improvement please let me know and we will make it a priority.",+ "engagement": 4,+ "hasMedia": true,+ "priceAtPost": 0.0021019690076729,+ "r1h": 0.17,+ "r4h": -3.25,+ "r24h": -2.32+ },+ {+ "id": "2078846016506429933",+ "url": "https://x.com/trythreews/status/2078846016506429933",+ "postedAt": "2026-07-19T14:14:48.000Z",+ "text": "hi Solana",+ "engagement": 23,+ "hasMedia": false,+ "priceAtPost": 0.0020335599727417204,+ "r1h": -3.42,+ "r4h": 0.18,+ "r24h": -12.26+ },+ {+ "id": "2079310713877934394",+ "url": "https://x.com/trythreews/status/2079310713877934394",+ "postedAt": "2026-07-20T21:01:20.000Z",+ "text": "Join the three․ws telegram channel if you haven't yet. Nearly every changelog entry lands there the moment it ships, straight from http:// t",+ "engagement": 13,+ "hasMedia": false,+ "priceAtPost": 0.0017550099425589379,+ "r1h": -0.76,+ "r4h": -2.64,+ "r24h": 3.84+ },+ {+ "id": "2079311372396146709",+ "url": "https://x.com/trythreews/status/2079311372396146709",+ "postedAt": "2026-07-20T21:03:57.000Z",+ "text": "http:// t.me/three_ws Not everything we ship gets announced here, but it's the best way to keep an eye on what we're building, testing, and ",+ "engagement": 8,+ "hasMedia": false,+ "priceAtPost": 0.0017550099425589379,+ "r1h": -0.76,+ "r4h": -2.64,+ "r24h": 3.84+ },+ {+ "id": "2079313039099347267",+ "url": "https://x.com/trythreews/status/2079313039099347267",+ "postedAt": "2026-07-20T21:10:34.000Z",+ "text": "",+ "engagement": 1,+ "hasMedia": false,+ "priceAtPost": 0.0017550099425589379,+ "r1h": -0.76,+ "r4h": -2.64,+ "r24h": 3.84+ },+ {+ "id": "2079313052890173746",+ "url": "https://x.com/trythreews/status/2079313052890173746",+ "postedAt": "2026-07-20T21:10:38.000Z",+ "text": "",+ "engagement": 1,+ "hasMedia": false,+ "priceAtPost": 0.0017550099425589379,+ "r1h": -0.76,+ "r4h": -2.64,+ "r24h": 3.84+ },+ {+ "id": "2079313067251494957",+ "url": "https://x.com/trythreews/status/2079313067251494957",+ "postedAt": "2026-07-20T21:10:41.000Z",+ "text": "",+ "engagement": 1,+ "hasMedia": false,+ "priceAtPost": 0.0017550099425589379,+ "r1h": -0.76,+ "r4h": -2.64,+ "r24h": 3.84+ },+ {+ "id": "2079313082472706372",+ "url": "https://x.com/trythreews/status/2079313082472706372",+ "postedAt": "2026-07-20T21:10:45.000Z",+ "text": "",+ "engagement": 1,+ "hasMedia": false,+ "priceAtPost": 0.0017550099425589379,+ "r1h": -0.76,+ "r4h": -2.64,+ "r24h": 3.84+ },+ {+ "id": "2080152399843598822",+ "url": "https://x.com/trythreews/status/2080152399843598822",+ "postedAt": "2026-07-23T04:45:54.000Z",+ "text": "Thanks for the support!",+ "engagement": 2,+ "hasMedia": false,+ "priceAtPost": 0.0015088035933446713,+ "r1h": 2.44,+ "r4h": 0.08,+ "r24h": -2.21+ },+ {+ "id": "2080152982684115390",+ "url": "https://x.com/trythreews/status/2080152982684115390",+ "postedAt": "2026-07-23T04:48:13.000Z",+ "text": "Already possible, try it out http:// three.ws/ar-studio",+ "engagement": 17,+ "hasMedia": false,+ "priceAtPost": 0.0015088035933446713,+ "r1h": 2.44,+ "r4h": 0.08,+ "r24h": -2.21+ },+ {+ "id": "2080153171423633803",+ "url": "https://x.com/trythreews/status/2080153171423633803",+ "postedAt": "2026-07-23T04:48:58.000Z",+ "text": "Have yet to announce it, a bit behind on announcing new features. Tons of new and improved existing features we have to announce.",+ "engagement": 17,+ "hasMedia": false,+ "priceAtPost": 0.0015088035933446713,+ "r1h": 2.44,+ "r4h": 0.08,+ "r24h": -2.21+ },+ {+ "id": "2080153418409345379",+ "url": "https://x.com/trythreews/status/2080153418409345379",+ "postedAt": "2026-07-23T04:49:56.000Z",+ "text": "Yes! and http:// three.ws/ar/studio!",+ "engagement": 7,+ "hasMedia": false,+ "priceAtPost": 0.0015088035933446713,+ "r1h": 2.44,+ "r4h": 0.08,+ "r24h": -2.21+ },+ {+ "id": "2080185802353738214",+ "url": "https://x.com/trythreews/status/2080185802353738214",+ "postedAt": "2026-07-23T06:58:37.000Z",+ "text": "Thank you for the support! Jobs not finished! Back to work.",+ "engagement": 26,+ "hasMedia": false,+ "priceAtPost": 0.0015614303150208433,+ "r1h": -1.92,+ "r4h": -3.06,+ "r24h": -5.28+ },+ {+ "id": "2080247065515598150",+ "url": "https://x.com/trythreews/status/2080247065515598150",+ "postedAt": "2026-07-23T11:02:04.000Z",+ "text": "",+ "engagement": 25,+ "hasMedia": false,+ "priceAtPost": 0.001516323487369981,+ "r1h": 2.21,+ "r4h": -0.39,+ "r24h": 5.62+ },+ {+ "id": "2080254272625905938",+ "url": "https://x.com/trythreews/status/2080254272625905938",+ "postedAt": "2026-07-23T11:30:42.000Z",+ "text": "take a chance",+ "engagement": 6,+ "hasMedia": false,+ "priceAtPost": 0.001520326692143295,+ "r1h": 1.02,+ "r4h": -2.18,+ "r24h": 7.48+ },+ {+ "id": "2080254343555760475",+ "url": "https://x.com/trythreews/status/2080254343555760475",+ "postedAt": "2026-07-23T11:30:59.000Z",+ "text": "",+ "engagement": 12,+ "hasMedia": false,+ "priceAtPost": 0.001520326692143295,+ "r1h": 1.02,+ "r4h": -2.18,+ "r24h": 7.48+ },+ {+ "id": "2081033827636711670",+ "url": "https://x.com/trythreews/status/2081033827636711670",+ "postedAt": "2026-07-25T15:08:22.000Z",+ "text": "",+ "engagement": 0,+ "hasMedia": false,+ "priceAtPost": 0.001585308396737146,+ "r1h": 3.77,+ "r4h": 11.52,+ "r24h": 0.15+ },+ {+ "id": "2081480084796719580",+ "url": "https://x.com/trythreews/status/2081480084796719580",+ "postedAt": "2026-07-26T20:41:38.000Z",+ "text": "",+ "engagement": 14,+ "hasMedia": false,+ "priceAtPost": 0.0015586266153549636,+ "r1h": -1.07,+ "r4h": -2,+ "r24h": -16.22+ },+ {+ "id": "2082190591925076064",+ "url": "https://x.com/trythreews/status/2082190591925076064",+ "postedAt": "2026-07-28T19:44:57.000Z",+ "text": "",+ "engagement": 22,+ "hasMedia": false,+ "priceAtPost": 0.0012250718918634781,+ "r1h": -1.39,+ "r4h": 23.08,+ "r24h": 13.73+ },+ {+ "id": "2082227422850941395",+ "url": "https://x.com/trythreews/status/2082227422850941395",+ "postedAt": "2026-07-28T22:11:18.000Z",+ "text": "http:// three.ws has been named an OpenAI Partner. As part of the OpenAI Partner Network, we're continuing our work with OpenAI to help orga",+ "engagement": 70,+ "hasMedia": true,+ "priceAtPost": 0.001178368491650653,+ "r1h": 36.29,+ "r4h": 28.42,+ "r24h": 19.33+ },+ {+ "id": "2082227458313761262",+ "url": "https://x.com/trythreews/status/2082227458313761262",+ "postedAt": "2026-07-28T22:11:26.000Z",+ "text": "",+ "engagement": 5,+ "hasMedia": false,+ "priceAtPost": 0.001178368491650653,+ "r1h": 36.29,+ "r4h": 28.42,+ "r24h": 19.33+ },+ {+ "id": "2082234346199790013",+ "url": "https://x.com/trythreews/status/2082234346199790013",+ "postedAt": "2026-07-28T22:38:48.000Z",+ "text": "We are the first crypto project to join the OpenAI Partner Network We are the first crypto project to join the OpenAI Partner Network",+ "engagement": 62,+ "hasMedia": false,+ "priceAtPost": 0.001376691869757094,+ "r1h": 9.53,+ "r4h": 10.82,+ "r24h": 2.15+ },+ {+ "id": "2082234618842079558",+ "url": "https://x.com/trythreews/status/2082234618842079558",+ "postedAt": "2026-07-28T22:39:53.000Z",+ "text": "Thank you @solana @OpenAI and all of our partners, community members, and developers that have pushed us to grow everyday!",+ "engagement": 90,+ "hasMedia": false,+ "priceAtPost": 0.001376691869757094,+ "r1h": 9.53,+ "r4h": 10.82,+ "r24h": 2.15+ },+ {+ "id": "2082634676972470585",+ "url": "https://x.com/trythreews/status/2082634676972470585",+ "postedAt": "2026-07-30T01:09:35.000Z",+ "text": "There is clear potential at the intersection of 3D and DeFi for creating more immersive and functional on-chain experiences. 3D interfaces c",+ "engagement": 61,+ "hasMedia": false,+ "priceAtPost": 0.0014282984540778699,+ "r1h": 0.55,+ "r4h": 0.24,+ "r24h": 20.95+ },+ {+ "id": "2082650070948986911",+ "url": "https://x.com/trythreews/status/2082650070948986911",+ "postedAt": "2026-07-30T02:10:45.000Z",+ "text": "",+ "engagement": 25,+ "hasMedia": false,+ "priceAtPost": 0.0014361203734598448,+ "r1h": -1.2,+ "r4h": 0.68,+ "r24h": 20.63+ },+ {+ "id": "2082650119820947483",+ "url": "https://x.com/trythreews/status/2082650119820947483",+ "postedAt": "2026-07-30T02:10:56.000Z",+ "text": "Never say never.",+ "engagement": 5,+ "hasMedia": false,+ "priceAtPost": 0.0014361203734598448,+ "r1h": -1.2,+ "r4h": 0.68,+ "r24h": 20.63+ },+ {+ "id": "2082654667893608934",+ "url": "https://x.com/trythreews/status/2082654667893608934",+ "postedAt": "2026-07-30T02:29:01.000Z",+ "text": "Big Ting Ya Mon",+ "engagement": 8,+ "hasMedia": false,+ "priceAtPost": 0.001436649032821279,+ "r1h": -0.96,+ "r4h": 1.27,+ "r24h": 28.85+ },+ {+ "id": "2082654994445328743",+ "url": "https://x.com/trythreews/status/2082654994445328743",+ "postedAt": "2026-07-30T02:30:19.000Z",+ "text": "",+ "engagement": 5,+ "hasMedia": false,+ "priceAtPost": 0.0014152104135241744,+ "r1h": 0.98,+ "r4h": 1.75,+ "r24h": 26.34+ },+ {+ "id": "2082934921983873310",+ "url": "https://x.com/trythreews/status/2082934921983873310",+ "postedAt": "2026-07-30T21:02:39.000Z",+ "text": "Everyone will know soon. Thanks, 0ya!",+ "engagement": 55,+ "hasMedia": false,+ "priceAtPost": 0.0015744544243272655,+ "r1h": 19.79,+ "r4h": 9.72,+ "r24h": 10.19+ },+ {+ "id": "2083234861184397693",+ "url": "https://x.com/trythreews/status/2083234861184397693",+ "postedAt": "2026-07-31T16:54:30.000Z",+ "text": "We’ve been featured in @VogueMagazine Photo Vogue! http:// three.ws is now officially recognized by one of the world’s most iconic magazines",+ "engagement": 48,+ "hasMedia": true,+ "priceAtPost": 0.0014625353570787165,+ "r1h": 10.96,+ "r4h": 20.16,+ "r24h": 9.97+ },+ {+ "id": "2083235262801625403",+ "url": "https://x.com/trythreews/status/2083235262801625403",+ "postedAt": "2026-07-31T16:56:05.000Z",+ "text": "",+ "engagement": 5,+ "hasMedia": false,+ "priceAtPost": 0.0014625353570787165,+ "r1h": 10.96,+ "r4h": 20.16,+ "r24h": 9.97+ },+ {+ "id": "2083240241683722572",+ "url": "https://x.com/trythreews/status/2083240241683722572",+ "postedAt": "2026-07-31T17:15:53.000Z",+ "text": "Web2 Web3 Only possible on @Pumpfun",+ "engagement": 67,+ "hasMedia": false,+ "priceAtPost": 0.001568841887971152,+ "r1h": 7.22,+ "r4h": 10.88,+ "r24h": 2.03+ },+ {+ "id": "2084696287144988799",+ "url": "https://x.com/trythreews/status/2084696287144988799",+ "postedAt": "2026-08-04T17:41:41.000Z",+ "text": "Largest x402 developer talking, i hope you're listening.",+ "engagement": 9,+ "hasMedia": false,+ "priceAtPost": 0.0015129140336648697,+ "r1h": 9.87,+ "r4h": 10.04,+ "r24h": 26.32+ },+ {+ "id": "2084702467628081620",+ "url": "https://x.com/trythreews/status/2084702467628081620",+ "postedAt": "2026-08-04T18:06:14.000Z",+ "text": "Come build with us. https:// community.ibm.com/community/user /usergroup?CommunityKey=e71510cc-d953-408f-9a1c-019f5c0a7016 …",+ "engagement": 3,+ "hasMedia": false,+ "priceAtPost": 0.0015367790580948387,+ "r1h": 11.2,+ "r4h": 24.84,+ "r24h": 23.89+ },+ {+ "id": "2084704775665566007",+ "url": "https://x.com/trythreews/status/2084704775665566007",+ "postedAt": "2026-08-04T18:15:25.000Z",+ "text": "@GoogleCloud three․ws We are excited to announce we are joining forces with Google Cloud! Google Cloud's infrastructure unlocks the next pha",+ "engagement": 36,+ "hasMedia": true,+ "priceAtPost": 0.0016043872796922668,+ "r1h": 7.13,+ "r4h": 19.47,+ "r24h": 20.81+ },+ {+ "id": "2084710236993311141",+ "url": "https://x.com/trythreews/status/2084710236993311141",+ "postedAt": "2026-08-04T18:37:07.000Z",+ "text": "huge thank you @Google @googledevs @GoogleStartups more compute. more growth. time to scale. (perfect timing because we just migrated from V",+ "engagement": 48,+ "hasMedia": true,+ "priceAtPost": 0.0016622244284430483,+ "r1h": -3.58,+ "r4h": 12.21,+ "r24h": 12.64+ },+ {+ "id": "2084720030051405828",+ "url": "https://x.com/trythreews/status/2084720030051405828",+ "postedAt": "2026-08-04T19:16:02.000Z",+ "text": "\"Google vetted http:// three.ws, and http:// three.ws passed.\"",+ "engagement": 0,+ "hasMedia": false,+ "priceAtPost": 0.0017188471763798555,+ "r1h": -5.31,+ "r4h": 11.33,+ "r24h": 4.56+ },+ {+ "id": "2084720285459382616",+ "url": "https://x.com/trythreews/status/2084720285459382616",+ "postedAt": "2026-08-04T19:17:02.000Z",+ "text": "",+ "engagement": 13,+ "hasMedia": false,+ "priceAtPost": 0.0017188471763798555,+ "r1h": -5.31,+ "r4h": 11.33,+ "r24h": 4.56+ },+ {+ "id": "2085431263629058336",+ "url": "https://x.com/trythreews/status/2085431263629058336",+ "postedAt": "2026-08-06T18:22:13.000Z",+ "text": "http:// three.ws/forge to generate a 3D model from text / prompt -> place anywhere IRL http:// three.ws/irl to place 3D AI Agents in real li",+ "engagement": 33,+ "hasMedia": false,+ "priceAtPost": 0.0021651686604571155,+ "r1h": 3.88,+ "r4h": -5.52,+ "r24h": 6.72+ },+ {+ "id": "2085684765286637618",+ "url": "https://x.com/trythreews/status/2085684765286637618",+ "postedAt": "2026-08-07T11:09:32.000Z",+ "text": "Today: The first in-world meetup of the http:// Three.ws User Group hosted by @IBM Open http:// three.ws/play in a browser, become a 3D avat",+ "engagement": 359,+ "hasMedia": true,+ "priceAtPost": 0.0021502707318423572,+ "r1h": 9.2,+ "r4h": 13.44,+ "r24h": -12.49+ },+ {+ "id": "2085685794791137633",+ "url": "https://x.com/trythreews/status/2085685794791137633",+ "postedAt": "2026-08-07T11:13:38.000Z",+ "text": "Full event details on three․ws User Group thanks to @IBM",+ "engagement": 50,+ "hasMedia": false,+ "priceAtPost": 0.0021502707318423572,+ "r1h": 9.2,+ "r4h": 13.44,+ "r24h": -12.49+ },+ {+ "id": "2085686157204197574",+ "url": "https://x.com/trythreews/status/2085686157204197574",+ "postedAt": "2026-08-07T11:15:04.000Z",+ "text": "Read more about this event in the thread posted by @nichxbt on our @IBM user group https:// community.ibm.com/community/user /discussion/com",+ "engagement": 68,+ "hasMedia": false,+ "priceAtPost": 0.0022573962850531027,+ "r1h": 4.11,+ "r4h": 2.3,+ "r24h": -16.76+ },+ {+ "id": "2085687257512751342",+ "url": "https://x.com/trythreews/status/2085687257512751342",+ "postedAt": "2026-08-07T11:19:27.000Z",+ "text": "",+ "engagement": 21,+ "hasMedia": false,+ "priceAtPost": 0.0022573962850531027,+ "r1h": 4.11,+ "r4h": 2.3,+ "r24h": -16.76+ },+ {+ "id": "2085702961557287269",+ "url": "https://x.com/trythreews/status/2085702961557287269",+ "postedAt": "2026-08-07T12:21:51.000Z",+ "text": "",+ "engagement": 15,+ "hasMedia": false,+ "priceAtPost": 0.0023502854331414864,+ "r1h": -2.88,+ "r4h": 8.48,+ "r24h": -19.73+ },+ {+ "id": "2085724793253625989",+ "url": "https://x.com/trythreews/status/2085724793253625989",+ "postedAt": "2026-08-07T13:48:36.000Z",+ "text": "The official @IBM blog for today's meetup is up, written by Jessica, a core member of the IBM team behind the http:// Three.ws User Group, w",+ "engagement": 16,+ "hasMedia": true,+ "priceAtPost": 0.0024003200255498453,+ "r1h": 2.73,+ "r4h": -1.26,+ "r24h": -22.46+ },+ {+ "id": "2085726205328925156",+ "url": "https://x.com/trythreews/status/2085726205328925156",+ "postedAt": "2026-08-07T13:54:12.000Z",+ "text": "Join the three․ws User Group's First In-World Meetup",+ "engagement": 4,+ "hasMedia": false,+ "priceAtPost": 0.0024003200255498453,+ "r1h": 2.73,+ "r4h": -1.26,+ "r24h": -22.46+ },+ {+ "id": "2085726338787496226",+ "url": "https://x.com/trythreews/status/2085726338787496226",+ "postedAt": "2026-08-07T13:54:44.000Z",+ "text": "She will be in there with us as a 3D agent she built from a selfie. Walk up and say hi. 8 AM PT in the $THREE server",+ "engagement": 20,+ "hasMedia": false,+ "priceAtPost": 0.0024003200255498453,+ "r1h": 2.73,+ "r4h": -1.26,+ "r24h": -22.46+ },+ {+ "id": "2085727970111693227",+ "url": "https://x.com/trythreews/status/2085727970111693227",+ "postedAt": "2026-08-07T14:01:13.000Z",+ "text": "1 hour",+ "engagement": 1,+ "hasMedia": false,+ "priceAtPost": 0.0024569088480625996,+ "r1h": -0.71,+ "r4h": -3.28,+ "r24h": -23.61+ },+ {+ "id": "2087280351844647238",+ "url": "https://x.com/trythreews/status/2087280351844647238",+ "postedAt": "2026-08-11T20:49:50.000Z",+ "text": "coded",+ "engagement": 13,+ "hasMedia": false,+ "priceAtPost": 0.001705209659277943,+ "r1h": 0.94,+ "r4h": -0.77,+ "r24h": -4.73+ },+ {+ "id": "2087280438654185703",+ "url": "https://x.com/trythreews/status/2087280438654185703",+ "postedAt": "2026-08-11T20:50:11.000Z",+ "text": "",+ "engagement": 9,+ "hasMedia": false,+ "priceAtPost": 0.001705209659277943,+ "r1h": 0.94,+ "r4h": -0.77,+ "r24h": -4.73+ },+ {+ "id": "2087646652056432688",+ "url": "https://x.com/trythreews/status/2087646652056432688",+ "postedAt": "2026-08-12T21:05:23.000Z",+ "text": "three․ws is now verified on @fomo What that means in practice: search THREE in the fomo app and the verified badge marks the real listing. N",+ "engagement": 266,+ "hasMedia": true,+ "priceAtPost": 0.0016014399383638524,+ "r1h": 1.41,+ "r4h": 1.61,+ "r24h": 14.88+ },+ {+ "id": "2087646802174767104",+ "url": "https://x.com/trythreews/status/2087646802174767104",+ "postedAt": "2026-08-12T21:05:58.000Z",+ "text": "Check three․ws out on @fomo $THREE CA: $three https:// fomo.family/tokens/solana/ FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump …",+ "engagement": 54,+ "hasMedia": true,+ "priceAtPost": 0.0016014399383638524,+ "r1h": 1.41,+ "r4h": 1.61,+ "r24h": 14.88+ }+ ]+}diff --git a/scripts/x-archive-price-impact.mjs b/scripts/x-archive-price-impact.mjsnew file mode 100644index 000000000..cea4652ac--- /dev/null+++ b/scripts/x-archive-price-impact.mjs@@ -0,0 +1,81 @@+#!/usr/bin/env node+/**+ * $THREE price impact of every archived @trythreews post.+ *+ * Usage:+ * node scripts/x-archive-price-impact.mjs # write public/data/trythreews-post-impact.json+ * node scripts/x-archive-price-impact.mjs --stdout # print the summary, write nothing+ * node scripts/x-archive-price-impact.mjs --handle trythreews+ *+ * For each own post in data/x-archive: the $THREE/SOL price when it went out and+ * the return after +1h, +4h and +24h, against the same returns at arbitrary+ * moments (the baseline). A return with no price behind it (the post predates the+ * pool, or nothing traded around that time) is null, never interpolated.+ *+ * The output file is what the Posts view on /oracle-coin reads.+ */++import { readFileSync } from 'node:fs';+import { mkdir, writeFile } from 'node:fs/promises';+import { fileURLToPath } from 'node:url';+import path from 'node:path';+import { ARCHIVE_DIR, listArchiveFiles, mergeScrapes, readScrapeFile } from './x-archive-lib.mjs';+import { THREE_MINT, buildImpactDocument, loadSeries } from '../api/_lib/x-content/price-impact.js';++const HERE = path.dirname(fileURLToPath(import.meta.url));+const REPO_ROOT = path.resolve(HERE, '..');+export const OUT_FILE = path.resolve(REPO_ROOT, 'public', 'data', 'trythreews-post-impact.json');++for (const envFile of ['.env.local', '.env']) {+ try {+ for (const line of readFileSync(path.resolve(REPO_ROOT, envFile), 'utf8').split('\n')) {+ const m = line.match(/^([A-Z_][A-Z0-9_]*)=(.*)$/);+ if (!m || process.env[m[1]]) continue;+ process.env[m[1]] = m[2].trim().replace(/^(["'])(.*)\1$/, '$2');+ }+ } catch {+ // Absent env files are normal outside a configured checkout.+ }+}++const args = process.argv.slice(2);+const handleIdx = args.indexOf('--handle');+const HANDLE = handleIdx >= 0 ? args[handleIdx + 1] : 'trythreews';+const TO_STDOUT = args.includes('--stdout');++async function loadPosts() {+ const files = await listArchiveFiles(path.resolve(REPO_ROOT, ARCHIVE_DIR));+ const scrapes = [];+ for (const file of files) {+ // Article snapshots are a different shape and carry no timeline.+ if (/-articles-/.test(file)) continue;+ const scrape = await readScrapeFile(file);+ if (scrape.handle.toLowerCase() === HANDLE.toLowerCase()) scrapes.push(scrape);+ }+ if (!scrapes.length) throw new Error(`no scrape files for @${HANDLE} in ${ARCHIVE_DIR}`);+ return mergeScrapes(scrapes).posts;+}++const posts = await loadPosts();+const earliest = Math.floor(Math.min(...posts.map((p) => Date.parse(p.postedAt))) / 1000);+const { pool, candles } = await loadSeries({ mint: THREE_MINT, fromSec: earliest });+if (candles.length < 2) throw new Error('GeckoTerminal returned no $THREE candles');++const doc = buildImpactDocument({ handle: HANDLE, posts, pool, candles });+const { summary } = doc;++const line = (key, label) => {+ const h = summary.horizons[key];+ return `${label}: ${h.measured} measured, ${h.unavailable} unavailable, median ${h.median}% (baseline ${h.baselineMedian}%), ${Math.round((h.positiveShare ?? 0) * 100)}% up`;+};+console.log(`@${HANDLE}: ${summary.posts} own posts, ${doc.posts.length} with a $THREE price at post time`);+console.log(`series ${doc.series.from} to ${doc.series.to} (${doc.series.bars} bars of 15m)`);+console.log(line('r1h', '+1h '));+console.log(line('r4h', '+4h '));+console.log(line('r24h', '+24h'));++if (!TO_STDOUT) {+ await mkdir(path.dirname(OUT_FILE), { recursive: true });+ await writeFile(OUT_FILE, `${JSON.stringify(doc, null, 1)}\n`);+ console.log(`wrote ${path.relative(REPO_ROOT, OUT_FILE)}`);+}diff --git a/src/social/x-post-impact.js b/src/social/x-post-impact.jsindex 80b2f2b1d..11e3ba22b 100644--- a/src/social/x-post-impact.js+++ b/src/social/x-post-impact.js@@ -1,25 +1,8 @@// X (Twitter) post → pump.fun token price impact correlation.-// Uses oEmbed (no API key) for post metadata; /api/pump/quote for price snapshots.+// Reads the post (text, author, metrics, media) through the shared keyless X reader,+// api/_lib/x-syndication.js; /api/pump/quote for price snapshots.// Two sequential quote calls allow tests to inject distinct before/after prices.--function extractPostId(url) {- const m = String(url).match(/\/status(?:es)?\/(\d+)/);- return m ? m[1] : null;-}--function tweetIdToMs(id) {- if (!id) return null;- try {- // Twitter snowflake: bits 22..63 = ms offset from 2010-11-04T01:42:54.657Z- return Number(BigInt(id) >> 22n) + 1288834974657;- } catch {- return null;- }-}--function stripHtml(html) {- return html ? html.replace(/<[^>]*>/g, ' ').replace(/\s+/g, ' ').trim() : null;-}+import { readXPost, summarizeXPost } from '../../api/_lib/x-syndication.js';function priceFromQuote(data) {// tokens_out = tokens received for 1 SOL → price in SOL per token = 1/tokens_out@@ -32,6 +15,21 @@ function solReservesFromQuote(data) {return r != null ? Number(r) / 1e9 : null;}+// X blocks cross-origin reads from a page, so in the browser the same shared+// reader runs behind the same-origin /api/x-video/extract endpoint.+async function readPost(postUrl) {+ if (typeof window === 'undefined') return summarizeXPost(await readXPost(postUrl));+ const res = await fetch('/api/x-video/extract', {+ method: 'POST',+ headers: { 'content-type': 'application/json' },+ body: JSON.stringify({ url: postUrl }),+ signal: AbortSignal.timeout(15000),+ });+ const data = await res.json().catch(() => null);+ if (!data?.post) throw new Error(data?.message || `post read failed (HTTP ${res.status})`);+ return summarizeXPost(data.post);+}+/*** Correlate an X post to a pump.fun token's price impact.*@@ -39,27 +37,12 @@ function solReservesFromQuote(data) {* @returns {Promise<{ post, priceBefore, priceAfter, deltaPct, volBefore, volAfter, deltaVolPct }>}*/export async function correlateXPost({ postUrl, mint, windowMin = 30 }) {- const postId = extractPostId(postUrl);-- // Fetch post metadata via oEmbed — no API key required.- // On failure (network error or non-2xx), post stays null and price analysis continues.+ // On failure (post gone, X unreachable) post stays null and price analysis continues.let post = null;try {- const oRes = await fetch(- `https://publish.twitter.com/oembed?url=${encodeURIComponent(postUrl)}&omit_script=true`,- { signal: AbortSignal.timeout(8000) },- );- if (oRes.ok) {- const od = await oRes.json();- post = {- id: postId,- ts: tweetIdToMs(postId),- author: od.author_name ?? null,- text: stripHtml(od.html),- };- }+ post = await readPost(postUrl);} catch {- // oEmbed unavailable — price analysis continues with post=null.+ // Post unreadable: price analysis continues with post=null.}// Two sequential quote calls let tests mock distinct before/after prices.diff --git a/tests/x-archive.test.js b/tests/x-archive.test.jsindex d49e31dcf..61f8aa422 100644--- a/tests/x-archive.test.js+++ b/tests/x-archive.test.js@@ -17,6 +17,7 @@ import {percentile,topicsOf,} from '../scripts/x-archive-lib.mjs';+import { baselineReturns, impactForPosts, priceAt, returnsAt, summarize } from '../api/_lib/x-content/price-impact.js';const post = (over = {}) => ({tweetId: over.tweetId || '1',@@ -237,3 +238,78 @@ describe('analyze', () => {expect(report.formats.find((f) => f.key === 'video').significant).toBe(false);});});++// The $THREE candles a post is measured against: one 15-minute bar per entry,+// `t` at the bar open, priced from `price(index)`.+const bars = (count, price, { start = 1_800_000_000, skip = [] } = {}) =>+ Array.from({ length: count }, (_, i) => ({ t: start + i * 900, o: price(i), h: price(i), l: price(i), c: price(i), v: 1 }))+ .filter((_, i) => !skip.includes(i));++describe('price impact of a post', () => {+ const start = 1_800_000_000;+ const rising = bars(400, (i) => 100 + i);+ const iso = (sec) => new Date(sec * 1000).toISOString();++ it('prices an instant at the last bar that had finished, never the one forming', () => {+ // Bar 10 spans [start+9000, start+9900); at start+9899 it is still forming.+ expect(priceAt(rising, start + 9899)).toBe(109);+ expect(priceAt(rising, start + 9900)).toBe(110);+ });++ it('has no price before the series begins or past a gap in trading', () => {+ expect(priceAt(rising, start + 100)).toBeNull();+ const gap = bars(40, (i) => 100 + i, { skip: [10, 11, 12, 13, 14, 15] });+ expect(priceAt(gap, start + 13 * 900)).toBe(109);+ expect(priceAt(gap, start + 16 * 900 - 1)).toBeNull();+ });++ it('computes percent returns at +1h, +4h and +24h and leaves a horizon past the series unavailable', () => {+ const at = start + 10 * 900;+ const out = returnsAt(rising, at);+ expect(out.priceAtPost).toBe(109);+ expect(out.r1h).toBeCloseTo(((113 / 109) - 1) * 100, 1);+ expect(out.r4h).toBeCloseTo(((125 / 109) - 1) * 100, 1);+ expect(out.r24h).toBeCloseTo(((205 / 109) - 1) * 100, 1);+ const late = returnsAt(rising, start + 390 * 900);+ expect(late.r1h).not.toBeNull();+ expect(late.r24h).toBeNull();+ });++ it('does not interpolate a return whose far end sits in a gap', () => {+ const gap = bars(200, (i) => 100 + i, { skip: Array.from({ length: 12 }, (_, i) => 20 + i) });+ const out = returnsAt(gap, start + 10 * 900);+ expect(out.priceAtPost).toBe(109);+ expect(out.r1h).not.toBeNull();+ expect(out.r4h).toBeNull();+ });++ it('measures own head posts only, oldest first, with their engagement', () => {+ const posts = [+ post({ tweetId: 'late', postedAt: iso(start + 30 * 900), likes: 30, retweets: 3, replies: 2 }),+ post({ tweetId: 'early', postedAt: iso(start + 10 * 900), likes: 10, retweets: 0, replies: 0, hasVideo: true }),+ post({ tweetId: 'rt', postedAt: iso(start + 12 * 900), isRetweet: true, isOwn: false, authorHandle: 'someone' }),+ post({ tweetId: 'reply', postedAt: iso(start + 14 * 900), isReply: true }),+ post({ tweetId: 'old', postedAt: iso(start - 86_400) }),+ ];+ const rows = impactForPosts(posts, rising);+ expect(rows.map((r) => r.id)).toEqual(['old', 'early', 'late']);+ expect(rows[0].priceAtPost).toBeNull();+ expect(rows[0].r24h).toBeNull();+ expect(rows[1]).toMatchObject({ engagement: 10, hasMedia: true, priceAtPost: 109 });+ expect(rows[2].engagement).toBe(35);+ });++ it('summarizes against the baseline and counts what could not be measured', () => {+ const rows = impactForPosts(+ [post({ tweetId: 'a', postedAt: iso(start + 10 * 900) }), post({ tweetId: 'b', postedAt: iso(start - 86_400) })],+ rising,+ );+ const summary = summarize(rows, baselineReturns(rising));+ expect(summary.posts).toBe(2);+ expect(summary.horizons.r24h.measured).toBe(1);+ expect(summary.horizons.r24h.unavailable).toBe(1);+ expect(summary.horizons.r1h.positiveShare).toBe(1);+ expect(summary.horizons.r24h.baselineSamples).toBeGreaterThan(0);+ expect(summarize([], []).horizons.r1h.median).toBeNull();+ });+});diff --git a/tests/x-content-outcomes.test.js b/tests/x-content-outcomes.test.jsindex f317f17cc..ee8e6877b 100644--- a/tests/x-content-outcomes.test.js+++ b/tests/x-content-outcomes.test.js@@ -23,6 +23,10 @@ import {readDaysFor,OUTCOMES_SETTLE_DAYS,OUTCOMES_WINDOW_DAYS,+ PRICE_MIN_SAMPLE,+ PRICE_POINTS_LIMIT,+ learnPriceLifts,+ withPriceReturns,} from '../api/_lib/x-content/outcomes.js';import { loadLifts, scoreItem } from '../api/_lib/x-content/priority.js';import { runTick } from '../api/_lib/x-content/runner.js';@@ -673,3 +677,60 @@ describe('runTick and the outcomes loop', () => {expect((await outcomes.load()).posts).toHaveLength(5);});});++describe('the $THREE price after a post', () => {+ const matured = (n, over) => Array.from({ length: n }, (_, i) => row({ id: `${over.media}${i}`, at: daysAgo(3 + i * 0.1), ...over }));+ const priced = () => [...matured(10, { media: 'video', priceReturn24h: 12 }), ...matured(12, { media: 'photo', priceReturn24h: -2 })];++ it('stamps the +24h return on a row, and leaves a row with no price around it alone', () => {+ const start = Math.floor(Date.parse(daysAgo(5)) / 1000);+ const candles = Array.from({ length: 700 }, (_, i) => ({ t: start + i * 900, o: 100 + i, h: 100 + i, l: 100 + i, c: 100 + i, v: 1 }));+ const [inside, before, tooYoung] = withPriceReturns([+ row({ id: 'in', at: new Date((start + 10 * 900) * 1000).toISOString() }),+ row({ id: 'before', at: new Date((start - 86_400) * 1000).toISOString() }),+ row({ id: 'young', at: new Date((start + 690 * 900) * 1000).toISOString() }),+ ], candles);+ expect(inside.priceReturn24h).toBeCloseTo(((205 / 109) - 1) * 100, 1);+ expect(before.priceReturn24h).toBeUndefined();+ expect(tooYoung.priceReturn24h).toBeUndefined();+ const rows = [row()];+ expect(withPriceReturns(rows, null)).toBe(rows);+ });++ it('learns nothing from price until enough matured posts carry a return', () => {+ expect(learnPriceLifts(matured(PRICE_MIN_SAMPLE - 1, { media: 'video', priceReturn24h: 5 }), { now: NOW })).toBeNull();+ expect(learnLifts(matured(30, { media: 'video' }), { now: NOW }).priceLifts).toBeUndefined();+ });++ it('measures an attribute against the posts without it, in percentage points, shrunk by sample size', () => {+ const learned = learnLifts(priced(), { now: NOW });+ expect(learned.priceLifts.sample).toBe(22);+ const video = learned.priceLifts.lifts['media:video'];+ expect(video.n).toBe(10);+ expect(video.delta).toBeGreaterThan(13);+ expect(video.delta).toBeLessThan(15);+ expect(video.shrunk).toBeCloseTo(video.delta * (10 / (10 + SHRINK_K)), 1);+ expect(learned.priceLifts.lifts['media:photo'].delta).toBeLessThan(0);+ });++ it('skips a value seen on too few posts and a row whose return was never measured', () => {+ const rows = [...priced(), ...matured(3, { media: 'gif', priceReturn24h: 80 }), ...matured(6, { media: 'none' })];+ const { priceLifts } = learnLifts(rows, { now: NOW });+ expect(priceLifts.lifts['media:gif'].shrunk).toBe(0);+ expect(priceLifts.lifts['media:none']).toBeUndefined();+ expect(priceLifts.sample).toBe(25);+ });++ it('adds a small, capped price term to a queued item score and reports it separately', () => {+ const item = { id: 'x', kind: 'post', posts: [{ text: 'A short post.', media: [{ path: 'public/x-media/t/clip.mp4' }] }] };+ const base = { learnedAt: new Date(NOW).toISOString(), sample: 40, baseline: 2, lifts: { 'media:video': { delta: 1, n: 10, shrunk: 0.5 } } };+ const withPrice = (shrunk, n = 10) => ({ ...base, priceLifts: { sample: 30, baseline: 0, lifts: { 'media:video': { delta: shrunk, n, shrunk } } } });+ const plain = learnedScore(item, base);+ expect(plain.pricePoints).toBeUndefined();+ const up = learnedScore(item, withPrice(5));+ expect(up.pricePoints).toBe(2);+ expect(up.points).toBe(Math.round((plain.points + 2) * 10) / 10);+ expect(learnedScore(item, withPrice(-500)).pricePoints).toBe(-PRICE_POINTS_LIMIT);+ expect(learnedScore(item, withPrice(8, 4)).pricePoints).toBeUndefined();+ });+});diff --git a/tests/x-guest.test.js b/tests/x-guest.test.jsnew file mode 100644index 000000000..02e2956c4--- /dev/null+++ b/tests/x-guest.test.js@@ -0,0 +1,180 @@+// Keyless X guest reader: activation, parsing, rate-limit cooldown, stale+// query-id recovery. The network is a scripted fetch; the payloads follow the+// shape x.com's guest GraphQL returns (typed User object, timeline instructions).++import { describe, it, expect, beforeEach, vi } from 'vitest';+import { fetchGuestProfile, fetchGuestTimeline, resetGuestState } from '../api/_lib/x-guest/index.js';+import { collectSocialBatch, relevantTweets, uniqueHandles } from '../api/_lib/oracle/social-feed.js';++const userResult = {+ __typename: 'User',+ rest_id: '1001',+ core: { name: 'Synthetic Trader', screen_name: 'synthtrader', created_at: 'Mon Jan 05 10:00:00 +0000 2026' },+ avatar: { image_url: 'https://example.test/a_normal.jpg' },+ relationship_counts: { followers: 4321, following: 12 },+ is_blue_verified: true,+};++function tweetEntry(id, text, createdAt, views = '5000') {+ return {+ entryId: `tweet-${id}`,+ content: {+ itemContent: {+ tweet_results: {+ result: {+ __typename: 'Tweet',+ rest_id: id,+ core: { user_results: { result: userResult } },+ legacy: { full_text: text, created_at: createdAt, favorite_count: 10, retweet_count: 2, reply_count: 1 },+ views: { count: views },+ },+ },+ },+ },+ };+}++const json = (status, body, headers = {}) => ({+ ok: status >= 200 && status < 300,+ status,+ headers: { get: (k) => headers[k.toLowerCase()] ?? null },+ json: async () => body,+ text: async () => (typeof body === 'string' ? body : JSON.stringify(body)),+});++function scripted(routes) {+ return vi.fn(async (url, init) => {+ for (const [match, handler] of routes) {+ if (String(url).includes(match)) return handler(String(url), init);+ }+ throw new Error(`unexpected fetch ${url}`);+ });+}++beforeEach(() => resetGuestState());++describe('fetchGuestProfile', () => {+ it('activates a guest token once and parses followers, avatar and join date', async () => {+ const f = scripted([+ ['guest/activate.json', () => json(200, { guest_token: '777' })],+ ['/UserByScreenName', (_u, init) => {+ expect(init.headers['x-guest-token']).toBe('777');+ return json(200, { data: { user: { result: userResult } } });+ }],+ ]);+ const p = await fetchGuestProfile('@synthtrader', { fetchImpl: f });+ expect(p.followers).toBe(4321);+ expect(p.username).toBe('synthtrader');+ expect(p.joined).toBe('2026-01-05T10:00:00.000Z');+ expect(p.verified).toBe(true);+ await fetchGuestProfile('synthtrader', { fetchImpl: f });+ expect(f.mock.calls.filter(([u]) => u.includes('activate')).length).toBe(1);+ });++ it('rejects a malformed handle without touching the network', async () => {+ const f = vi.fn();+ await expect(fetchGuestProfile('not a handle!', { fetchImpl: f })).rejects.toMatchObject({ reason: 'not_found' });+ expect(f).not.toHaveBeenCalled();+ });++ it('opens a cooldown after a 429 and short-circuits the next call', async () => {+ const resetAt = Math.floor(Date.now() / 1000) + 600;+ const f = scripted([+ ['guest/activate.json', () => json(200, { guest_token: '1' })],+ ['/UserByScreenName', () => json(429, {}, { 'x-rate-limit-reset': String(resetAt) })],+ ]);+ await expect(fetchGuestProfile('synthtrader', { fetchImpl: f })).rejects.toMatchObject({ reason: 'rate_limited' });+ const calls = f.mock.calls.length;+ await expect(fetchGuestProfile('synthtrader', { fetchImpl: f })).rejects.toMatchObject({ reason: 'rate_limited' });+ expect(f.mock.calls.length).toBe(calls);+ });++ it('recovers from a rotated query id using the upstream constants', async () => {+ const f = scripted([+ ['guest/activate.json', () => json(200, { guest_token: '1' })],+ ['raw.githubusercontent.com', () =>+ json(200, '"UserByScreenName": Object.freeze({ queryId: "FRESHID_abc-1", type: "query" }),\n"UserTweets": Object.freeze({ queryId: "TWEETSID_x", type: "query" }),')],+ ['/UserByScreenName', (url) =>+ url.includes('/FRESHID_abc-1/')+ ? json(200, { data: { user: { result: userResult } } })+ : json(404, { errors: [{ message: 'gone' }] })],+ ]);+ const p = await fetchGuestProfile('synthtrader', { fetchImpl: f });+ expect(p.followers).toBe(4321);+ });++ it('fails soft with reason stale_query_id when upstream has no fresh id', async () => {+ const f = scripted([+ ['guest/activate.json', () => json(200, { guest_token: '1' })],+ ['raw.githubusercontent.com', () => json(500, 'nope')],+ ['/UserByScreenName', () => json(404, {})],+ ]);+ await expect(fetchGuestProfile('synthtrader', { fetchImpl: f })).rejects.toMatchObject({ reason: 'stale_query_id' });+ });++ it('re-activates once when x.com rejects the guest token', async () => {+ let activations = 0;+ const f = scripted([+ ['guest/activate.json', () => json(200, { guest_token: String(++activations) })],+ ['/UserByScreenName', (_u, init) =>+ init.headers['x-guest-token'] === '1'+ ? json(403, { errors: [{ code: 239 }] })+ : json(200, { data: { user: { result: userResult } } })],+ ]);+ expect((await fetchGuestProfile('synthtrader', { fetchImpl: f })).followers).toBe(4321);+ expect(activations).toBe(2);+ });+});++describe('fetchGuestTimeline', () => {+ it('resolves the user id then parses timeline tweets with metrics', async () => {+ const f = scripted([+ ['guest/activate.json', () => json(200, { guest_token: '1' })],+ ['/UserByScreenName', () => json(200, { data: { user: { result: userResult } } })],+ ['/UserTweets', (url) => {+ expect(decodeURIComponent(url)).toContain('"userId":"1001"');+ return json(200, {+ data: { user: { result: { timeline: { timeline: { instructions: [+ { type: 'TimelineAddEntries', entries: [tweetEntry('9001', 'watching $THREE closely', 'Mon Jan 05 10:00:00 +0000 2026')] },+ ] } } } } },+ });+ }],+ ]);+ const { profile, tweets } = await fetchGuestTimeline('synthtrader', { limit: 5, fetchImpl: f });+ expect(profile.id).toBe('1001');+ expect(tweets).toHaveLength(1);+ expect(tweets[0]).toMatchObject({ id: '9001', metrics: { likes: 10, retweets: 2, views: 5000 } });+ });+});++describe('social feed', () => {+ const NOW = Date.parse('2026-02-01T12:00:00Z');+ const fresh = { id: '1', text: 'accumulating $THREE', createdAt: '2026-02-01T10:00:00.000Z', author: { username: 'a' }, metrics: { views: 100, likes: 3, retweets: 1 } };++ it('keeps recent cashtag tweets and drops stale or cashtag-free ones', () => {+ const out = relevantTweets(+ [fresh, { ...fresh, id: '2', text: 'gm' }, { ...fresh, id: '3', createdAt: '2026-01-01T00:00:00.000Z' }],+ 'a',+ { now: NOW },+ );+ expect(out.map((t) => t.id)).toEqual(['1']);+ expect(out[0]).toMatchObject({ url: 'https://x.com/a/status/1', author: { username: 'a' }, metrics: { views: 100, likes: 3, retweets: 1 } });+ });++ it('dedupes and caps handles case-insensitively', () => {+ expect(uniqueHandles([['Alice', '@alice'], ['bob', 'bad handle']], 5)).toEqual(['alice', 'bob']);+ expect(uniqueHandles([['a', 'b', 'c']], 2)).toEqual(['a', 'b']);+ });++ it('stops at a rate limit and reports the unread handles as skipped', async () => {+ const reader = vi.fn(async (h) => {+ if (h === 'two') throw Object.assign(new Error('slow down'), { reason: 'rate_limited' });+ return { tweets: [fresh] };+ });+ const r = await collectSocialBatch(['one', 'two', 'three'], { reader, now: () => NOW });+ expect(r.read).toBe(1);+ expect(r.tweets).toHaveLength(1);+ expect(r.skipped).toEqual(['three']);+ expect(r.failures.two).toMatch(/rate_limited/);+ });+});diff --git a/tests/x-post-impact.test.js b/tests/x-post-impact.test.jsindex e96bbe1fe..14585bf36 100644--- a/tests/x-post-impact.test.js+++ b/tests/x-post-impact.test.js@@ -17,24 +17,46 @@ function quoteRes(tokensOut, realSolLamports) {};}-function oembedRes(author, text) {+function synRes(author, text, extra = {}) {return {ok: true,- json: async () => ({ author_name: author, html: `<blockquote>${text}</blockquote>` }),+ status: 200,+ text: async () =>+ JSON.stringify({+ text,+ created_at: '2026-10-01T12:00:00.000Z',+ favorite_count: 42,+ conversation_count: 7,+ user: { name: author, screen_name: author },+ mediaDetails: [],+ ...extra,+ }),};}+const down = { ok: false, status: 500, text: async () => '' };++// Route by URL so the post reader's three rungs and the two quote calls stay independent.+function route({ post, quotes }) {+ let q = 0;+ fetchMock.mockImplementation(async (url) => {+ const u = String(url);+ if (u.includes('/api/pump/quote')) return quotes[q++] ?? quotes[quotes.length - 1];+ return typeof post === 'function' ? post(u) : post;+ });+}+// ── tests ──────────────────────────────────────────────────────────────────describe('correlateXPost', () => {beforeEach(() => fetchMock.mockReset());- it('computes positive deltaPct when price increases', async () => {+ it('computes positive deltaPct when price increases and returns metrics', async () => {// before: 1/10000 SOL per token; after: 1/9000 → +11.1%- fetchMock- .mockResolvedValueOnce(oembedRes('alice', 'moon soon'))- .mockResolvedValueOnce(quoteRes(10000, 50_000_000_000))- .mockResolvedValueOnce(quoteRes(9000, 55_000_000_000));+ route({+ post: synRes('alice', 'moon soon'),+ quotes: [quoteRes(10000, 50_000_000_000), quoteRes(9000, 55_000_000_000)],+ });const r = await correlateXPost({postUrl: 'https://x.com/alice/status/1894000000000000000',@@ -43,6 +65,8 @@ describe('correlateXPost', () => {expect(r.post?.author).toBe('alice');expect(r.post?.text).toBe('moon soon');+ expect(r.post?.metrics.likes).toBe(42);+ expect(r.post?.metrics.replies).toBe(7);expect(r.priceBefore).toBeCloseTo(1 / 10000, 8);expect(r.priceAfter).toBeCloseTo(1 / 9000, 8);const expectedDelta = ((1 / 9000 - 1 / 10000) / (1 / 10000)) * 100;@@ -53,68 +77,56 @@ describe('correlateXPost', () => {});it('computes negative deltaPct when price drops', async () => {- // before: 1/9000; after: 1/10000 → negative delta- fetchMock- .mockResolvedValueOnce(oembedRes('bob', 'dump incoming'))- .mockResolvedValueOnce(quoteRes(9000, 50_000_000_000))- .mockResolvedValueOnce(quoteRes(10000, 45_000_000_000));-- const r = await correlateXPost({- postUrl: 'https://x.com/bob/status/999',- mint: 'ValidMintAddress',+ route({+ post: synRes('bob', 'dump incoming'),+ quotes: [quoteRes(9000, 50_000_000_000), quoteRes(10000, 45_000_000_000)],});+ const r = await correlateXPost({ postUrl: 'https://x.com/bob/status/999', mint: 'ValidMintAddress' });+expect(r.deltaPct).toBeLessThan(0);expect(r.deltaVolPct).toBeLessThan(0);});- it('returns post=null when oEmbed throws, still computes price delta', async () => {- fetchMock- .mockRejectedValueOnce(new Error('network error'))- .mockResolvedValueOnce(quoteRes(10000, 50_000_000_000))- .mockResolvedValueOnce(quoteRes(10000, 50_000_000_000));-- const r = await correlateXPost({- postUrl: 'https://x.com/anon/status/1',- mint: 'ValidMintAddress',+ it('returns post=null when every post rung throws, still computes price delta', async () => {+ route({+ post: () => Promise.reject(new Error('network error')),+ quotes: [quoteRes(10000, 50_000_000_000), quoteRes(10000, 50_000_000_000)],});+ const r = await correlateXPost({ postUrl: 'https://x.com/anon/status/1', mint: 'ValidMintAddress' });+expect(r.post).toBeNull();expect(r.deltaPct).toBeCloseTo(0, 5);expect(r.priceBefore).not.toBeNull();});- it('returns post=null when oEmbed returns non-ok, still computes prices', async () => {- fetchMock- .mockResolvedValueOnce({ ok: false })- .mockResolvedValueOnce(quoteRes(10000, 50_000_000_000))- .mockResolvedValueOnce(quoteRes(8000, 60_000_000_000));-- const r = await correlateXPost({- postUrl: 'https://x.com/anon/status/2',- mint: 'ValidMintAddress',+ it('returns post=null when every post rung is non-ok, still computes prices', async () => {+ route({+ post: down,+ quotes: [quoteRes(10000, 50_000_000_000), quoteRes(8000, 60_000_000_000)],});+ const r = await correlateXPost({ postUrl: 'https://x.com/anon/status/2', mint: 'ValidMintAddress' });+expect(r.post).toBeNull();expect(r.deltaPct).toBeGreaterThan(0);});it('throws with "unknown mint" when price fetch fails', async () => {- fetchMock- .mockResolvedValueOnce({ ok: false })- .mockResolvedValueOnce({ ok: false, status: 400 });+ route({ post: down, quotes: [{ ok: false, status: 400 }] });await expect(correlateXPost({ postUrl: 'https://x.com/a/status/1', mint: 'badmint' }),).rejects.toThrow(/unknown mint/);});- it('extracts post id and derives ts from tweet snowflake id', async () => {+ it('derives ts from the post created_at and keeps the post id', async () => {const id = '1894000000000000000';- fetchMock- .mockResolvedValueOnce(oembedRes('carol', 'gm'))- .mockResolvedValueOnce(quoteRes(10000, 50_000_000_000))- .mockResolvedValueOnce(quoteRes(10000, 50_000_000_000));+ route({+ post: synRes('carol', 'gm'),+ quotes: [quoteRes(10000, 50_000_000_000)],+ });const r = await correlateXPost({postUrl: `https://x.com/carol/status/${id}`,@@ -122,7 +134,6 @@ describe('correlateXPost', () => {});expect(r.post?.id).toBe(id);- expect(typeof r.post?.ts).toBe('number');- expect(r.post.ts).toBeGreaterThan(0);+ expect(r.post.ts).toBe(Date.parse('2026-10-01T12:00:00.000Z'));});});diff --git a/tests/x-syndication.test.js b/tests/x-syndication.test.jsnew file mode 100644index 000000000..c3f4f6aa3--- /dev/null+++ b/tests/x-syndication.test.js@@ -0,0 +1,151 @@+import { describe, it, expect, vi } from 'vitest';+import {+ readXPost,+ parsePostUrl,+ postVideoVariants,+ assertMediaUrl,+ downloadFilename,+ PostUnavailableError,+ XPostError,+} from '../api/_lib/x-syndication.js';++const POST_URL = 'https://x.com/trythreews/status/1894000000000000000';++const ok = (body) => ({ ok: true, status: 200, text: async () => JSON.stringify(body) });+const status = (code) => ({ ok: false, status: code, text: async () => '' });++const synVideoPost = {+ text: 'launch day https://t.co/abc',+ display_text_range: [0, 10],+ created_at: '2026-10-01T12:00:00.000Z',+ favorite_count: 120,+ conversation_count: 9,+ user: { name: 'three.ws', screen_name: 'trythreews', profile_image_url_https: 'https://pbs.twimg.com/a.jpg', is_blue_verified: true },+ mediaDetails: [+ {+ type: 'video',+ media_url_https: 'https://pbs.twimg.com/ext_tw_video_thumb/1/pu/img/t.jpg',+ video_info: {+ duration_millis: 12000,+ variants: [+ { content_type: 'application/x-mpegURL', url: 'https://video.twimg.com/a/playlist.m3u8' },+ { content_type: 'video/mp4', bitrate: 256000, url: 'https://video.twimg.com/a/vid/avc1/320x180/low.mp4?tag=12' },+ { content_type: 'video/mp4', bitrate: 2176000, url: 'https://video.twimg.com/a/vid/avc1/1280x720/hi.mp4?tag=12' },+ ],+ },+ },+ ],+};++describe('parsePostUrl', () => {+ it('parses x.com and twitter.com status links', () => {+ expect(parsePostUrl(POST_URL)).toEqual({ handle: 'trythreews', id: '1894000000000000000' });+ expect(parsePostUrl('https://twitter.com/a/status/5?s=20')).toEqual({ handle: 'a', id: '5' });+ });+ it('rejects other hosts and junk', () => {+ expect(parsePostUrl('https://evil.example/a/status/5')).toBeNull();+ expect(parsePostUrl(null)).toBeNull();+ });+});++describe('readXPost', () => {+ it('reads text, author, metrics, timestamps and ranked mp4 variants from syndication', async () => {+ const fetchImpl = vi.fn().mockResolvedValue(ok(synVideoPost));+ const p = await readXPost(POST_URL, { fetchImpl, bearerToken: '' });+ expect(fetchImpl).toHaveBeenCalledTimes(1);+ expect(String(fetchImpl.mock.calls[0][0])).toContain('cdn.syndication.twimg.com');+ expect(p.source).toBe('syndication');+ expect(p.text).toBe('launch day');+ expect(p.author).toMatchObject({ handle: 'trythreews', verified: true });+ expect(p.metrics).toMatchObject({ likes: 120, replies: 9, views: null });+ expect(p.ts).toBe(Date.parse('2026-10-01T12:00:00.000Z'));+ const v = postVideoVariants(p);+ expect(v.map((x) => x.quality)).toEqual(['720p', '360p'].map((q, i) => (i === 0 ? q : v[1].quality)));+ expect(v[0].width).toBe(1280);+ expect(v.every((x) => x.url.endsWith('.mp4') || x.url.includes('.mp4?'))).toBe(true);+ expect(v).toHaveLength(2);+ });++ it('falls through to fxtwitter when syndication fails and picks up reposts and views', async () => {+ const fetchImpl = vi.fn(async (url) => {+ if (String(url).includes('syndication')) return status(429);+ return ok({+ tweet: {+ text: 'hello',+ created_at: 'Thu Oct 01 12:00:00 +0000 2026',+ likes: 5, replies: 1, retweets: 3, quotes: 2, views: 900, bookmarks: 4,+ author: { name: 'three.ws', screen_name: 'trythreews', avatar_url: 'https://pbs.twimg.com/a.jpg' },+ media: { all: [{ type: 'video', thumbnail_url: 't', duration: 4.5, width: 1280, height: 720, url: 'https://video.twimg.com/x/1280x720/v.mp4', formats: [] }] },+ },+ });+ });+ const p = await readXPost(POST_URL, { fetchImpl, bearerToken: '' });+ expect(p.source).toBe('fxtwitter');+ expect(p.metrics).toMatchObject({ likes: 5, reposts: 3, quotes: 2, views: 900, bookmarks: 4 });+ expect(p.media[0].durationMs).toBe(4500);+ expect(postVideoVariants(p)[0].quality).toBe('720p');+ });++ it('falls through to guest GraphQL only when a bearer token is configured', async () => {+ const fetchImpl = vi.fn(async (url) => {+ const u = String(url);+ if (u.includes('guest/activate')) return ok({ guest_token: 'g1' });+ if (u.includes('graphql')) {+ return ok({ data: { tweetResult: { result: { legacy: { full_text: 'gql text', favorite_count: 1, retweet_count: 2, reply_count: 3, quote_count: 4, created_at: 'Thu Oct 01 12:00:00 +0000 2026' }, views: { count: '77' }, core: { user_results: { result: { core: { name: 'n', screen_name: 'trythreews' } } } } } } } });+ }+ return status(500);+ });+ const p = await readXPost(POST_URL, { fetchImpl, bearerToken: 'test-bearer' });+ expect(p.source).toBe('graphql');+ expect(p.metrics).toMatchObject({ likes: 1, reposts: 2, replies: 3, quotes: 4, views: 77 });++ const noBearer = vi.fn().mockResolvedValue(status(500));+ await expect(readXPost(POST_URL, { fetchImpl: noBearer, bearerToken: '' })).rejects.toMatchObject({ status: 502 });+ expect(noBearer).toHaveBeenCalledTimes(2);+ });++ it('reports a deleted post as unavailable (404), not as an outage', async () => {+ const fetchImpl = vi.fn().mockResolvedValue(status(404));+ const err = await readXPost(POST_URL, { fetchImpl, bearerToken: '' }).catch((e) => e);+ expect(err).toBeInstanceOf(PostUnavailableError);+ expect(err.status).toBe(404);+ });++ it('treats a syndication tombstone as unavailable and still tries fxtwitter', async () => {+ const fetchImpl = vi.fn(async (url) =>+ String(url).includes('syndication')+ ? ok({ __typename: 'TweetTombstone' })+ : ok({ tweet: { text: 'alive', author: { name: 'a', screen_name: 'a' }, media: { all: [] } } }),+ );+ const p = await readXPost(POST_URL, { fetchImpl, bearerToken: '' });+ expect(p.source).toBe('fxtwitter');+ expect(p.text).toBe('alive');+ });++ it('rejects a non-post URL with 400 without fetching', async () => {+ const fetchImpl = vi.fn();+ await expect(readXPost('https://example.com/x', { fetchImpl })).rejects.toBeInstanceOf(XPostError);+ expect(fetchImpl).not.toHaveBeenCalled();+ });+});++describe('download proxy guards', () => {+ it('allows only https video.twimg.com and pbs.twimg.com', () => {+ expect(assertMediaUrl('https://video.twimg.com/a/b.mp4').hostname).toBe('video.twimg.com');+ expect(assertMediaUrl('https://pbs.twimg.com/media/a.jpg').hostname).toBe('pbs.twimg.com');+ });+ it.each([+ 'http://video.twimg.com/a.mp4',+ 'https://evil.example/a.mp4',+ 'https://video.twimg.com.evil.example/a.mp4',+ 'https://user:[email protected]/a.mp4',+ 'https://video.twimg.com:8443/a.mp4',+ 'https://127.0.0.1/a.mp4',+ 'not a url',+ ])('refuses %s', (u) => {+ expect(() => assertMediaUrl(u)).toThrow(XPostError);+ });+ it('builds a header-safe filename', () => {+ expect(downloadFilename('a"b\r\nc', '123')).toBe('a_b__c_123.mp4');+ });+});