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%20%22Optional%20title%22?q=fetch&page=1036&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 13859 results for "fetch"(11550ms)

neatBlackSwiftmain.tsx1 match

@stevekrouse•Updated 5 months ago
183
184 try {
185 const response = await fetch("/", {
186 method: "POST",
187 body: JSON.stringify({

lastloginmain.tsx2 matches

@pomdtr•Updated 5 months ago
103 tokenUrl.searchParams.set("state", store.state);
104
105 const tokenResp = await fetch(tokenUrl.toString());
106 if (!tokenResp.ok) {
107 throw new Error(await tokenResp.text());
112 };
113
114 const resp = await fetch("https://lastlogin.net/userinfo", {
115 headers: {
116 Authorization: `Bearer ${access_token}`,

vscodemain.tsx1 match

@pomdtr•Updated 5 months ago
9});
10
11export default lastlogin(vscode.fetch, { verifyEmail });

verifyEmailmain.tsx4 matches

@pomdtr•Updated 5 months ago
1async function fetchUser(token: string): Promise<{ email: string }> {
2 const resp = await fetch("https://api.val.town/v1/me", {
3 headers: {
4 Authorization: `Bearer ${token}`,
7
8 if (resp.status !== 200) {
9 throw new Error("Could not fetch user");
10 }
11
15export async function verifyEmail(email: string) {
16 try {
17 const user = await fetchUser(Deno.env.get("valtown"));
18 return email == user.email;
19 } catch (_) {

summarizeHnmain.tsx19 matches

@prashamtrivedi•Updated 5 months ago
90 }, []);
91
92 const fetchAndSummarize = async () => {
93 if (!postId) {
94 setError("Please enter a valid Hacker News post ID");
101 setPostDetails(null);
102 setProgress(10);
103 console.log("Starting fetchAndSummarize");
104
105 try {
106 // Fetch post details
107 setProgress(30);
108 console.log("Fetching HN post details");
109 const postResponse = await fetch(`/post-details?id=${postId}`);
110 if (!postResponse.ok) {
111 throw new Error(`Failed to fetch post details: ${postResponse.statusText}`);
112 }
113 const postData = await postResponse.json();
114 setPostDetails(postData);
115 console.log("Post details fetched", postData);
116
117 // Fetch comments and generate summary
118 setProgress(60);
119 console.log("Sending summary request");
120 const summaryResponse = await fetch("/summarize", {
121 method: "POST",
122 headers: {
143 console.log("Summarization complete");
144 } catch (err) {
145 console.error("Fetch Error:", err);
146 setError(`Error: ${err.message}`);
147 setLoading(false);
152 const handleKeyDown = (event) => {
153 if (event.key === "Enter" && !loading) {
154 fetchAndSummarize();
155 }
156 };
179 />
180 <button
181 onClick={fetchAndSummarize}
182 disabled={loading}
183 className="bg-orange-500 text-white p-3 rounded-r-lg hover:bg-orange-600 disabled:opacity-50 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-orange-500"
304 }
305
306 // Handle post details fetch
307 if (request.method === "GET" && new URL(request.url).pathname === "/post-details") {
308 const url = new URL(request.url);
316
317 try {
318 const response = await fetch(`https://hacker-news.firebaseio.com/v0/item/${postId}.json`);
319 if (!response.ok) {
320 throw new Error(`Failed to fetch post details: ${response.statusText}`);
321 }
322 const postData = await response.json();
325 });
326 } catch (error) {
327 console.error("Error fetching post details:", error);
328 return new Response(JSON.stringify({ error: "Failed to fetch post details" }), {
329 status: 500,
330 headers: { "Content-Type": "application/json" },
357 const { postId, postDetails } = requestBody;
358
359 // Fetch comments
360 const commentsResponse = await fetch(`https://hn.algolia.com/api/v1/items/${postId}`);
361 const commentsData = await commentsResponse.json();
362

cerebras_codermain.tsx1 match

@the_samoudi•Updated 5 months ago
185
186 try {
187 const response = await fetch("/", {
188 method: "POST",
189 body: JSON.stringify({

hardworkingLimeCheetahmain.tsx1 match

@stevekrouse•Updated 5 months ago
186
187 try {
188 const response = await fetch("/", {
189 method: "POST",
190 body: JSON.stringify({

calmRoseCaterpillarmain.tsx2 matches

@hameed•Updated 5 months ago
65
66 try {
67 const response = await fetch("https://hameed-adeptgoldswordfish.web.val.run", {
68 method: "POST",
69 headers: {
96
97 try {
98 const response = await fetch("https://hameed-adeptgoldswordfish.web.val.run", {
99 method: "PUT",
100 headers: {

tvshowsmain.tsx2 matches

@Glench•Updated 5 months ago
1import { dataToRSS } from "https://esm.town/v/Glench/dataToRSS";
2import { fetch } from "https://esm.town/v/std/fetch";
3import process from "node:process";
4
24 const show_id = TV_SHOWS_WATCHED[i];
25 const url = `https://api.themoviedb.org/3/tv/${show_id}?api_key=${process.env.tmdb_api_key}`;
26 const resp = await fetch(url);
27 const show = await resp.json();
28 data.push(show);

blob_adminmain.tsx23 matches

@stevekrouse1•Updated 5 months ago
234 const [isDragging, setIsDragging] = useState(false);
235
236 const fetchBlobs = useCallback(async () => {
237 setLoading(true);
238 try {
239 const response = await fetch(`/api/blobs?prefix=${encodeKey(searchPrefix)}&limit=${limit}`);
240 const data = await response.json();
241 setBlobs(data);
242 } catch (error) {
243 console.error("Error fetching blobs:", error);
244 } finally {
245 setLoading(false);
248
249 useEffect(() => {
250 fetchBlobs();
251 }, [fetchBlobs]);
252
253 const handleSearch = (e) => {
264 setBlobContentLoading(true);
265 try {
266 const response = await fetch(`/api/blob?key=${encodeKey(clickedBlob.key)}`);
267 const content = await response.text();
268 setSelectedBlob({ ...clickedBlob, key: decodeKey(clickedBlob.key) });
269 setEditContent(content);
270 } catch (error) {
271 console.error("Error fetching blob content:", error);
272 } finally {
273 setBlobContentLoading(false);
278 const handleSave = async () => {
279 try {
280 await fetch(`/api/blob?key=${encodeKey(selectedBlob.key)}`, {
281 method: "PUT",
282 body: editContent,
290 const handleDelete = async (key) => {
291 try {
292 await fetch(`/api/blob?key=${encodeKey(key)}`, { method: "DELETE" });
293 setBlobs(blobs.filter(b => b.key !== key));
294 if (selectedBlob && selectedBlob.key === key) {
307 const key = `${searchPrefix}${file.name}`;
308 formData.append("key", encodeKey(key));
309 await fetch("/api/blob", { method: "POST", body: formData });
310 const newBlob = { key, size: file.size, lastModified: new Date().toISOString() };
311 setBlobs([newBlob, ...blobs]);
315 }
316 }
317 fetchBlobs();
318 };
319
329 try {
330 const fullKey = `${searchPrefix}${key}`;
331 await fetch(`/api/blob?key=${encodeKey(fullKey)}`, {
332 method: "PUT",
333 body: "",
344 const handleDownload = async (key) => {
345 try {
346 const response = await fetch(`/api/blob?key=${encodeKey(key)}`);
347 const blob = await response.blob();
348 const url = window.URL.createObjectURL(blob);
363 if (newKey && newKey !== oldKey) {
364 try {
365 const response = await fetch(`/api/blob?key=${encodeKey(oldKey)}`);
366 const content = await response.blob();
367 await fetch(`/api/blob?key=${encodeKey(newKey)}`, {
368 method: "PUT",
369 body: content,
370 });
371 await fetch(`/api/blob?key=${encodeKey(oldKey)}`, { method: "DELETE" });
372 setBlobs(blobs.map(b => b.key === oldKey ? { ...b, key: newKey } : b));
373 if (selectedBlob && selectedBlob.key === oldKey) {
383 const newKey = `__public/${key}`;
384 try {
385 const response = await fetch(`/api/blob?key=${encodeKey(key)}`);
386 const content = await response.blob();
387 await fetch(`/api/blob?key=${encodeKey(newKey)}`, {
388 method: "PUT",
389 body: content,
390 });
391 await fetch(`/api/blob?key=${encodeKey(key)}`, { method: "DELETE" });
392 setBlobs(blobs.map(b => b.key === key ? { ...b, key: newKey } : b));
393 if (selectedBlob && selectedBlob.key === key) {
402 const newKey = key.slice(9); // Remove "__public/" prefix
403 try {
404 const response = await fetch(`/api/blob?key=${encodeKey(key)}`);
405 const content = await response.blob();
406 await fetch(`/api/blob?key=${encodeKey(newKey)}`, {
407 method: "PUT",
408 body: content,
409 });
410 await fetch(`/api/blob?key=${encodeKey(key)}`, { method: "DELETE" });
411 setBlobs(blobs.map(b => b.key === key ? { ...b, key: newKey } : b));
412 if (selectedBlob && selectedBlob.key === key) {
826});
827
828export default lastlogin((request: Request) => app.fetch(request));

FetchBasic2 file matches

@ther•Updated 3 days ago

GithubPRFetcher

@andybak•Updated 6 days ago