Open post-url-to-tana in Script Kit
// Name: Post URL with Metadata to Tanaimport "@johnlindquist/kit"let og = await npm("opengraph-io")// You'll need to sign-up for https://www.opengraph.io/// Create a free account and grab an API key from: https://dashboard.opengraph.io/apis/Opengraphio// Paste the token when prompted for OPENGRAPH_API_ID_TOKENlet openGraph = og({appId: await env("OPENGRAPH_API_ID_TOKEN", {hint: `Grab a token from [here](https://dashboard.opengraph.io/apis/Opengraphio)`,}),cacheOk: true, // If a cached result is available, use it for quicknessuseProxy: false, // Proxies help avoid being blocked and can bypass capchasmaxCacheAge: 432000000, // The maximum cache age to acceptacceptLang: "en-US,en;q=0.9", // Language to present to the site.fullRender: false, // This will cause JS to execute when rendering to deal with JS dependant sites})let url = await getActiveTab()// on windows, remove above and use:// let url = await arg("Paste URL here")let result = await openGraph.getSiteInfo(url)debuggerif (result.openGraph.error) {await editor(result.openGraph.error)} else {let { title, site_name, description } = result.openGraph// In the future, Tana will support more than just raw text// For now, only text is supported.// This gives you a chance to tweak the Title/Description before posting:let note = await template(`${title} - ${site_name}- ${url}- ${description}`.trim())let TANA_URL ="https://europe-west1-tagr-prod.cloudfunctions.net"// Select a node in Tana, hit cmd+K from mac, ctrl+K for windows, search for "API" to generate a token// Paste the token when promptedlet TANA_TOKEN_TODOS = await env("TANA_TOKEN_TODOS_TWO")await hide()// await copy(note.trim()) if you prefer to copy/paste you can use this insteadawait get(`${TANA_URL}/addToNode`, {headers: {authorization: `Bearer ${TANA_TOKEN_TODOS}`,},params: {note: note.trim(),},})}debugger