diff --git a/sites/twitter/xquik-article.js b/sites/twitter/xquik-article.js new file mode 100644 index 0000000..8be3abd --- /dev/null +++ b/sites/twitter/xquik-article.js @@ -0,0 +1,42 @@ +/* @meta +{ + "name": "twitter/xquik-article", + "description": "Fetch X / Twitter article by tweet ID via Xquik", + "domain": "xquik.com", + "args": { + "id": {"required": true, "description": "Tweet / article ID"} + }, + "runtime": "http", + "env": { + "XQUIK_API_KEY": {"required": true, "description": "API key for Xquik"} + }, + "headers": { + "x-api-key": "${XQUIK_API_KEY}", + "xquik-api-contract": "2026-04-29" + }, + "readOnly": true, + "example": "tap site twitter/xquik-article '1905545699552375179'" +} +*/ + +async function(args) { + if (!args.id) return {error: 'Missing argument: id', hint: 'Provide a tweet / article ID'}; + + const resp = await fetch(`https://xquik.com/api/v1/x/articles/${encodeURIComponent(args.id)}`, { + headers: {'accept': 'application/json'} + }); + + const text = await resp.text(); + let body = {}; + try { + body = JSON.parse(text); + } catch (_) { + body = {}; + } + + if (!resp.ok) { + return {error: body.message || body.error || ('HTTP ' + resp.status)}; + } + + return body; +} diff --git a/sites/twitter/xquik-tweet-detail.js b/sites/twitter/xquik-tweet-detail.js new file mode 100644 index 0000000..96c74d8 --- /dev/null +++ b/sites/twitter/xquik-tweet-detail.js @@ -0,0 +1,42 @@ +/* @meta +{ + "name": "twitter/xquik-tweet-detail", + "description": "Fetch tweet detail by ID via Xquik", + "domain": "xquik.com", + "args": { + "id": {"required": true, "description": "Tweet ID"} + }, + "runtime": "http", + "env": { + "XQUIK_API_KEY": {"required": true, "description": "API key for Xquik"} + }, + "headers": { + "x-api-key": "${XQUIK_API_KEY}", + "xquik-api-contract": "2026-04-29" + }, + "readOnly": true, + "example": "tap site twitter/xquik-tweet-detail '2019264360682778716'" +} +*/ + +async function(args) { + if (!args.id) return {error: 'Missing argument: id', hint: 'Provide a tweet ID'}; + + const resp = await fetch(`https://xquik.com/api/v1/x/tweets/${encodeURIComponent(args.id)}`, { + headers: {'accept': 'application/json'} + }); + + const text = await resp.text(); + let body = {}; + try { + body = JSON.parse(text); + } catch (_) { + body = {}; + } + + if (!resp.ok) { + return {error: body.message || body.error || ('HTTP ' + resp.status)}; + } + + return body; +}