11How does this new shiny search engine work? Well, it's quite simple.
12
131. I wrote a Deno script that fetches all vals from the Val Town API.
14
15```ts
27const vals = [];
28while (true) {
29 console.log("fetching", url);
30 const resp = await fetch(url);
31 if (!resp.ok) {
32 console.error(resp.statusText);
76const vals = [];
77while (true) {
78 console.log("fetching", url);
79 const resp = await fetch(url);
80 if (!resp.ok) {
81 console.error(resp.statusText);
84 let selection = await blob.getJSON(`ph-${version}-selection-${weight}`);
85 if (!selection) {
86 const res = await fetch(this.selectionURL(weight, version), {
87 method: "GET",
88 mode: "cors",
109
110 if (!buffer) {
111 const res = await fetch(this.fontURL(weight, version), {
112 method: "GET",
113 mode: "cors",
134
135 if (!css) {
136 const res = await fetch(this.cssURL(weight, version), {
137 method: "GET",
138 mode: "cors",
7 body.append("client_secret", Deno.env.get("NOTEHUB_CLIENT_SECRET"));
8
9 const res = await fetch("https://notehub.io/oauth2/token", {
10 method: "POST",
11 headers: {
22 try {
23 const token = await authenticate();
24 const res = await fetch(
25 `https://api.notefile.net/v1/projects/${projectUID}/devices/${deviceUID}/notes/${fileName}`,
26 {
103 }
104
105 const dom_promise = fetch(url.toString(), {
106 method: req.method,
107 headers: new Headers({
110 "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8",
111 "Accept-Language": "en-US,en;q=0.5",
112 "Sec-Fetch-Site": "cross-site",
113 "Sec-Fetch-Mode": "navigate",
114 "Sec-Fetch-User": "?1",
115 "Sec-Fetch-Dest": "document",
116 "Referer": "https://www.google.com/",
117 "sec-ch-ua": `"Not A Brand";v="99", "Google Chrome";v="91", "Chromium";v="91"`,
22});
23
24export default app.fetch;
1import { email } from "https://esm.town/v/std/email";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
3
4export async function dailyDadJoke() {
5 let { setup, punchline } = await fetchJSON("https://official-joke-api.appspot.com/random_joke");
6 return email({
7 text: punchline,
4app.get("/", (c) => c.text("Hello from Hono!"));
5app.get("/yeah", (c) => c.text("Routing!"));
6export default app.fetch;
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2import axios from "npm:axios";
3import formData from "npm:form-data";
16 reply_markup?: any[];
17}) =>
18 fetchJSON(
19 `https://api.telegram.org/bot${botToken}/sendMessage`,
20 {
34
35 try {
36 // Replace axios with Deno's fetch API, adapted for your setup
37 const response = await fetch(url, {
38 method: "POST",
39 body: data, // FormData instance directly as the body
1This is an RSS parser val, similar to @stevekrouse.fetchRSS, but uses an NPM parsing library
2so it can support multiple RSS feed types easily.
1import { fetch } from "https://esm.town/v/std/fetch";
2
3// This supports more RSS types than @stevekrouse.fetchRSS
4export async function fetchRss(url: string, lastRunDate?: string | number) {
5 let Parser = await import("npm:rss-parser");
6 let parser = new Parser.default();
7 let response = await fetch(url);
8 let data = await response.text();
9 let { items } = await parser.parseString(data);