bookReservationOnResymain.tsx7 matches
30}) => {
31const { z } = await import("npm:zod");
32const RESY_API_URL = "https://api.resy.com";
33const RESY_DEFAULT_HEADERS = {
34accept: "application/json, text/plain, */*",
35"accept-encoding": "gzip, deflate, br",
36"accept-language": "en-US,en;q=0.9",
37authorization: "ResyAPI api_key=\"VbWk7s3L4KiK5fzlO7JD3Q5EYolJI7n5\"",
38"x-origin": "https://resy.com",
39origin: "https://resy.com/",
145)
146}&password=${encodeURIComponent(params.password)}`;
147const response = await fetch(`${RESY_API_URL}/3/auth/password`, {
148method: "POST",
149body: body,
166seats: number;
167}) => {
168const url = `${RESY_API_URL}/3/details`;
169const response = await fetch(url.toString(), {
170method: "POST",
185seats: number;
186}) => {
187const url = `${RESY_API_URL}/4/find`;
188const searchParams = new URLSearchParams();
189searchParams.set("lat", "0");
208city: string;
209}) => {
210const url = `${RESY_API_URL}/3/venue`;
211const searchParams = new URLSearchParams();
212searchParams.set("url_slug", params.slug);
224authToken: string;
225}) => {
226const response = await fetch(`${RESY_API_URL}/3/book`, {
227method: "POST",
228headers: {
v2FanFicScrapermain.tsx30 matches
11e.preventDefault();
12setLoading(true);
13console.log(`Submitting URL for scraping: ${url}`);
1415const maxRetries = 3;
28if (!response.ok) {
29if (response.status === 400) {
30throw new APIError("Bad request. Check your parameters.", response.status);
31} else if (response.status === 401) {
32throw new APIError("No more credit available. Please upgrade your plan.", response.status);
33} else if (response.status === 404) {
34throw new APIError("Requested URL not found.", response.status);
35} else if (response.status === 429) {
36throw new APIError("Too many concurrent requests. Please upgrade your plan.", response.status);
37} else {
38throw new APIError(`HTTP error! status: ${response.status}`, response.status);
39}
40}
44break; // Exit the loop if successful
45} catch (error) {
46console.log(`Error occurred while scraping URL: ${url}. Error details: ${error.message}`);
4748if (error.name === "TypeError" && error.message === "Failed to fetch") {
76/>
77<button type="submit" disabled={loading}>
78{loading ? "Scraping..." : "Scrape"}
79</button>
80</form>
130async function scrapePage(url) {
131console.log(`Starting to scrape page: ${url}`);
132const apiKey = await getApiKey();
133134url = normalizeUrl(url);
135console.log(`Normalized URL for scraping: ${url}`);
136137const extractRules = {
161};
162163const result = await scrapePageWithRules(url, apiKey, extractRules);
164return processResults(result);
165}
186}
187188class APIError extends Error {
189constructor(message, status) {
190super(message);
191this.name = "APIError";
192this.status = status;
193}
201}
202203async function scrapePageWithRules(url, apiKey, extractRules) {
204console.log(`Sending request to ScrapingBee API for URL: ${url}`);
205try {
206const response = await fetch(
207`https://app.scrapingbee.com/api/v1/?api_key=${apiKey}&url=${
208encodeURIComponent(url)
209}&render_js=true&json_response=true&extract_rules=${encodeURIComponent(JSON.stringify(extractRules))}`,
211212if (!response.ok) {
213throw new APIError(`HTTP error! status: ${response.status}`, response.status);
214}
215216console.log("Response received from ScrapingBee API");
217console.log(`Cost: ${response.headers.get("Spb-cost")}`);
218console.log(`Initial status code: ${response.headers.get("Spb-initial-status-code")}`);
226}
227228console.log("ScrapingBee API response parsed successfully");
229return result;
230} catch (error) {
231if (error instanceof TypeError) {
232console.error("Network error:", error.message);
233throw new NetworkError("Failed to connect to the API");
234} else if (error instanceof APIError) {
235console.error("API error:", error.message, "Status:", error.status);
236throw error;
237} else if (error instanceof ParsingError) {
286}
287288async function getApiKey() {
289const apiKey = Deno.env.get("ScrapingBeeAPIkey");
290if (!apiKey) {
291console.log("ScrapingBee API key not found in environment variables");
292throw new Error("ScrapingBee API key not found in environment variables");
293}
294return apiKey;
295}
296302const result = await scrapePage(url);
303console.log(`Successfully scraped URL: ${url}`);
304console.log(`Scraping completed for URL: ${url}
305Result summary:
306Title: ${result.title}
312console.log(`Error occurred while processing request. Error details: ${error.message}`);
313console.log(`Error stack trace: ${error.stack}`);
314console.error(`Error occurred during scraping operation:
315Error message: ${error.message}
316Stack trace:
56const replicate = new Replicate({
7auth: Deno.env.get("REPLICATE_API_TOKEN"),
8});
9
whoIsHiringmain.tsx4 matches
63const fetchStories = async () => {
64try {
65const response = await fetch("/api/stories");
66if (!response.ok) throw new Error("Failed to fetch dates");
67const data = await response.json();
77try {
78dispatch({ type: "loading", value: true });
79const response = await fetch(`/api/comments?query=${encodeURIComponent(query)}&story=${story}&page=${page}`);
80if (!response.ok) throw new Error("Failed to fetch comments");
81const data = await response.json();
360export default async function(req: Request): Promise<Response> {
361const url = new URL(req.url);
362if (url.pathname === "/api/stories") {
363const storySearch = await hnSearch({
364search_by_date: true,
381}
382383if (url.pathname === "/api/comments") {
384const params = url.searchParams;
385const query = params.get("query") || "";
imagesToPDFmain.tsx1 match
6* 2. Use JavaScript to handle file selection and PDF generation
7* 3. Utilize the jsPDF library for PDF creation
8* 4. Use the FileReader API to read image files
9*
10* The application will not modify or convert the images, and each PDF page
bedtimeStoryMakermain.tsx1 match
1/** @jsxImportSource npm:hono@3/jsx */
2import { Unkey } from "npm:@unkey/api@0.26.1";
3import { Ratelimit } from "npm:@unkey/ratelimit@0.4.4";
4import type { Duration } from "npm:@unkey/ratelimit@0.4.4";
generativeFillmain.tsx1 match
34const replicate = new Replicate({
5auth: Deno.env.get("REPLICATE_API_KEY"),
6});
7//
sqliteExplorerAppREADME.md1 match
13## Authentication
1415Login to your SQLite Explorer with [password authentication](https://www.val.town/v/pomdtr/password_auth) with your [Val Town API Token](https://www.val.town/settings/api) as the password.
1617## Todos / Plans
sqliteExplorerAppmain.tsx2 matches
27<head>
28<title>SQLite Explorer</title>
29<link rel="preconnect" href="https://fonts.googleapis.com" />
3031<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
32<link
33href="https://fonts.googleapis.com/css2?family=Fira+Code:wght@300..700&family=Source+Sans+3:ital,wght@0,200..900;1,200..900&display=swap"
34rel="stylesheet"
35/>
terribleTanCatmain.tsx2 matches
30type Test<T extends string = TwoLettersString> = T;
3132type CapitalizeTwoLetterString<T extends string, U extends string = TwoLettersString> = T extends U ? Capitalize<T>
33: never;
3435type fullName = `${CapitalizeTwoLetterString<"a">} ${CapitalizeTwoLetterString<"df", TwoLettersString>}`;
3637const fn: never = "1" as undefined as never;