You can access search results via JSON API by adding format=json
to your query:
https://codesearch.val.run/image-url.jpg%20%22Image%20title%22?q=fetch&page=8&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 8301 results for "fetch"(790ms)
1import process from "node:process";
2import { BskyAgent } from "npm:@atproto/api";
3import fetch from "npm:node-fetch";
4import * as cheerio from "npm:cheerio";
513const dateThreshold = new Date("2025-05-01");
1415async function fetchWithRetry(url, options = {}, retries = 3, delay = 1000) {
16for (let i = 0; i < retries; i++) {
17try {
19const timeoutId = setTimeout(() => controller.abort(), 10000);
2021const response = await fetch(url, {
22...options,
23signal: controller.signal,
3132if (!response.ok) {
33throw new Error(`Failed to fetch: ${response.statusText}`);
34}
35return response;
36} catch (error) {
37if (i < retries - 1) {
38console.warn(`Fetch attempt ${i + 1} failed. Retrying...`);
39await new Promise(resolve => setTimeout(resolve, delay));
40} else {
45}
4647async function fetchNews() {
48const url = "https://glastonburyfestivals.co.uk/news/";
49try {
50const response = await fetchWithRetry(url);
51const html = await response.text();
52const $ = cheerio.load(html);
66return news;
67} catch (error) {
68console.error("Error fetching news:", error);
69throw error;
70}
76console.log("Logged in successfully.");
7778const newsItems = await fetchNews();
79console.log(`Fetched ${newsItems.length} news items.`);
8081for (const news of newsItems) {
35console.log(`Sending to MCP for ${userIdentifier}:`, JSON.stringify(mcpPayload, null, 2));
3637const mcpApiResponse = await fetch("https://mcp.labspace.ai/chat", {
38method: "POST",
39headers: {
99try {
100console.log(`Attempting to send WhatsApp message to ${userPhoneNumber}`);
101const sendMessageResponse = await fetch(
102`https://graph.facebook.com/v18.0/${business_phone_number_id}/messages`,
103{
135console.log(`Attempting to mark message as read for ${userPhoneNumber} (message_id: ${message.id})`);
136console.log("using API token:", WHATSAPP_GRAPH_API_TOKEN);
137const markReadResponse = await fetch(
138`https://graph.facebook.com/v18.0/${business_phone_number_id}/messages`,
139{
220});
221222// Export app.fetch for Val Town, otherwise export app
223export default (typeof Deno !== "undefined" && Deno.env.get("valtown"))
224? app.fetch
225: app;