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=765&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 8415 results for "fetch"(1640ms)

peelSessionArtistSessionsmain.tsx2 matches

@aeaton•Updated 1 year ago
1import { fetchHtmlDom } from "https://esm.town/v/aeaton/fetchHtmlDom";
2
3export async function peelSessionArtistSessions(url) {
4 const dom = await fetchHtmlDom(url);
5 const list = dom.querySelector(".link-list");
6 const items = list.querySelectorAll("li > a");

getIpInfomain.tsx2 matches

@redking00•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const getIpInfo = async (req: express.Request) => {
4 const ip = (req as any).options.headers["true-client-ip"];
5 return await (await fetch(`http://ip-api.com/json/${ip}`)).json();
6};

sendFoodEmailmain.tsx2 matches

@subguy•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2import { email } from "https://esm.town/v/std/email?v=9";
3import process from "node:process";
19 };
20 try {
21 const response = await fetch(url, options);
22 const result = await response.json();
23 recipeName = result.results[randomNumber].name;

nytmain.tsx2 matches

@baj•Updated 1 year ago
1import { fetchText } from "https://esm.town/v/stevekrouse/fetchText?v=5";
2
3export async function nyt(req: express.Request, res: express.Response) {
4 const data = await fetchText(
5 "https://cn.nytimes.com/",
6 {

discordWelcomeBotMsgForwardermain.tsx2 matches

@vtdocs•Updated 1 year ago
1import { discordSendDM } from "https://esm.town/v/vtdocs/discordSendDM";
2import process from "node:process";
3import { discordFetch } from "https://esm.town/v/vtdocs/discordFetch";
4import { discordDMs } from "https://esm.town/v/vtdocs/discordDMs";
5
10 const repliesToBot = [];
11 for (const channelId of discordDMs) {
12 const messages = await discordFetch(
13 process.env.discordBot,
14 // Note: not using pagination here

nasaAPODmain.tsx2 matches

@sokratis•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3// Returns NASA's Astronomy Picture of the Day (APOD)
4export const nasaAPOD = fetchJSON("cutt.ly/T7ksirK");
5// Forked from @iBrokeit.nasaAPOD

usermain.tsx2 matches

@neverstew•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3export const user = ({ token, id }: {
10 profileImageUrl: string;
11}> =>
12 fetchJSON(`https://api.val.town/v1/users/${id}`, {
13 headers: token
14 ? {

deleteValVersionmain.tsx2 matches

@neverstew•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export function deleteValVersion({ token, id, version }: {
6 version: number;
7}): Promise<Response> {
8 return fetch(`https://api.val.town/v1/vals/${id}/versions/${version}`, {
9 headers: {
10 Authorization: `Bearer ${token}`,

githubGistsmain.tsx2 matches

@kennyg•Updated 1 year ago
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3// GitHub gists
4export let githubGists = fetchJSON(
5 "https://api.github.com/users/stevekrouse/gists"
6);

getTmdbTrendingMoviesmain.tsx2 matches

@bclaudios•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export const getTmdbTrendingMovies = async (
14 },
15 };
16 const res = await (await fetch(url, options)).json();
17 return res.results;
18};

fetchPaginatedData2 file matches

@nbbaier•Updated 2 weeks ago

FetchBasic1 file match

@fredmoon•Updated 2 weeks ago