1Use todoist for quick notes to add to notion. Uses project to decide which project to fetch to add stuff to notion. Can add to page or database based on config below. Demarkation using sections in the todoist project. Extracts date for page blocks that are added as callouts.
2
3Migrated from folder: Public/add_to_notion_from_todoist
1import process from "node:process";
2import { Client } from "npm:@notionhq/client";
3import { fetch } from "npm:cross-fetch";
4
5export default async function(interval: Interval) {
50 let fields = `url,title,abstract,authors,year,externalIds`;
51
52 const j = await fetch(
53 `https://api.semanticscholar.org/graph/v1/paper/search?query=${
54 encodeURIComponent(
92
93 if (doi_to_add) {
94 // const bib = await fetch('https://api.paperpile.com/api/public/convert', {
95 // method: 'POST',
96 // headers: {
108 // }
109
110 let bib = await fetch("https://doi.org/" + doi_to_add, {
111 method: "GET",
112 headers: {
150 let sem_scholar_ppid = paper.paperId;
151 let tldr = null;
152 const tl_f = await fetch(
153 `https://api.semanticscholar.org/graph/v1/paper/${encodeURIComponent(sem_scholar_ppid)}?fields=${
154 encodeURIComponent("tldr")
41
42async function valtown(path: string): Promise<[number, object | null]> {
43 const req = await fetch(path, {
44 headers: {
45 Authorization: "Bearer " + Deno.env.get("valtown"),
29
30export const client = createClient<typeof router>({
31 fetchFn: router.fetch,
32 endpoint: `https://${val.author}-${val.name}.web.val.run`,
33});
34
35export default router.fetch;
2
3export default async function(interval: Interval) {
4 const versions = await fetch("https://www.figma.com/api/plugins/1323092380415927575/versions").then(r => r.json());
5 const { install_count, like_count, view_count } = versions.meta.plugin;
6
10
11 {
12 const versions = await fetch("https://www.figma.com/api/plugins/1189962635826293304/versions").then(r => r.json());
13 const { install_count, like_count, view_count } = versions.meta.plugin;
14
1export async function slackPost(token, channel, text) {
2 const resp = await fetch(
3 `https://slack.com/api/chat.postMessage`,
4 {
1fetch the contents of the Wikipedia "On this day in history" page. defaults to JSON output, but specify `?format=text`or `?format=html` for other outputs. e.g.
2
3- https://jamiedubs-wikipediatoday.web.val.run/?format=json
3
4export const stevekrouseRSS = async () => {
5 const response = await fetch("https://stevekrouse.com/");
6 const body = await response.text();
7 const $ = cheerio.load(body);
1import { fetch } from "https://esm.town/v/std/fetch";
2import { notFound } from "https://esm.town/v/wilt/notFound";
3import { thisUrl } from "https://esm.town/v/wilt/thisUrl";
122 console.log(widget);
123 if (!widget) return;
124 const templateResp = await fetch(widget.definition.msAcTemplate);
125 const template = await templateResp.text(); // Not json!
126 const dataResp = await fetch(widget.definition.data);
127 const data = await dataResp.text();
128 await self.widgets.updateByTag('simplepwa', {template, data});
150 case "/img.jpg":
151 return new Response(
152 await fetch(tinyLogomark).then((r) => r.blob()),
153 { headers: { "Content-Type": "image/jpeg" } },
154 );
2import { Readability } from "npm:@mozilla/readability";
3
4// inspired by https://www.val.town/v/stevekrouse/fetchJSON
5interface Readable {
6 title: string;
18}
19
20export const fetchReadable = async (url: string): Promise<Readable> => {
21 const r = await fetch(url, { headers: { "content-type": "text/html" }, redirect: "follow" });
22
23 try {
36 return data;
37 } catch (err) {
38 throw new Error(`fetchReadable error: ${err.message} in ${url}`);
39 }
40};