Val Town Code SearchReturn to Val Town

API Access

You can access search results via JSON API by adding format=json to your query:

https://codesearch.val.run/image-url.jpg?q=fetch&page=735&format=json

For typeahead suggestions, use the /typeahead endpoint:

https://codesearch.val.run/typeahead?q=fetch

Returns an array of strings in format "username" or "username/projectName"

Found 8646 results for "fetch"(1486ms)

notion_paperpile_detail_fillermain.tsx5 matches

@nerdymomocat•Updated 1 year ago
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")

git_syncmain.tsx1 match

@saolsen•Updated 1 year ago
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"),

fetsmain.tsx2 matches

@pomdtr•Updated 1 year ago
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;

placemarkGlobeMonitormain.tsx2 matches

@tmcw•Updated 1 year ago
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

sendMsgToSlackmain.tsx1 match

@glommer•Updated 1 year ago
1export async function slackPost(token, channel, text) {
2 const resp = await fetch(
3 `https://slack.com/api/chat.postMessage`,
4 {

wikipediaTodayREADME.md1 match

@jamiedubs•Updated 1 year ago
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

stevekrouseRSSmain.tsx1 match

@thomasorlita•Updated 1 year ago
3
4export const stevekrouseRSS = async () => {
5 const response = await fetch("https://stevekrouse.com/");
6 const body = await response.text();
7 const $ = cheerio.load(body);

miniWidgetmain.tsx4 matches

@wilt•Updated 1 year ago
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 );

fetchReadablemain.tsx4 matches

@hvlck•Updated 1 year ago
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};

deno_deploymain.tsx8 matches

@pomdtr•Updated 1 year ago
74 }
75 case "projects": {
76 const resp = await fetchDeployAPI("/projects");
77 if (resp.status != 200) {
78 throw new Error("Failed to fetch projects");
79 }
80 const projects = await resp.json();
126 }
127 case "playground": {
128 const resp = await fetchDeployAPI(`/projects/${payload.params.project}`);
129 if (resp.status != 200) {
130 throw new Error("Failed to fetch project");
131 }
132
164 const project = payload.params.project;
165
166 const resp = await fetchDeployAPI(`/projects/${project}/deployments`);
167 if (resp.status != 200) {
168 throw new Error("Failed to fetch deployments");
169 }
170
212}
213
214function fetchDeployAPI(endpoint: string, init?: RequestInit) {
215 return fetch(`https://dash.deno.com/api${endpoint}`, {
216 ...init,
217 headers: {

fetchPaginatedData2 file matches

@nbbaier•Updated 3 weeks ago

FetchBasic1 file match

@fredmoon•Updated 3 weeks ago