1Migrated from folder: fanficSearcher/ScrapingBeeAttempt/ThreadmarkLISTFetcher2
140
141async function fetchThreadmarksFromServer(url, chapterTitles) {
142 const response = await fetch("/api/threadmarks", {
143 method: "POST",
144 headers: {
154}
155
156async function getThreadmarkUrls(baseUrl, apiKey) {
157 versionLogger(import.meta.url);
158 console.log(`[START] Threadmark URL fetch for base URL: ${baseUrl}`);
167 console.log(`[INFO] Constructing URL for category ${category}: ${threadmarkUrl}`);
168
169 const scrapingBeeUrl = `https://app.scrapingbee.com/api/v1/?api_key=${apiKey}&url=${
170 encodeURIComponent(threadmarkUrl)
171 }&render_js=true`;
172 console.log(`[INFO] Sending GET request to ScrapingBee API for category ${category}`);
173
174 const requestStartTime = Date.now();
175 const response = await fetch(scrapingBeeUrl);
176 console.log(
177 `Response received. Status: ${response.status}, Headers: ${
337 console.log(`Received ${request.method} request for path: ${new URL(request.url).pathname}`);
338
339 if (request.method === "POST" && new URL(request.url).pathname === "/api/threadmarks") {
340 const apiKey = Deno.env.get("ScrapingBeeAPIkey");
341 if (!apiKey) {
342 console.error("[ERROR] API key not found in environment variables");
343 return new Response(JSON.stringify({ error: "API key not found in environment variables" }), {
344 status: 500,
345 headers: { "Content-Type": "application/json" },
350 const { url, chapterTitles } = await request.json();
351 console.log(`[INFO] Received request to fetch threadmarks for URL: ${url}`);
352 const threadmarks = await getThreadmarkUrls(url, apiKey);
353 console.log(`[INFO] Retrieved ${threadmarks.length} threadmarks`);
354
21// View at https://wallek-currencyTransaction.val.run?target=gbp&root=eur&amount=100
22export default async function(req: Request): Promise<Response> {
23 const { rates } = await fetchJSON(`https://api.exchangerate-api.com/v4/latest/USD`);
24
25 // USD is the base currency, so we need to add it manually
1// Initialize Airtable configuration
2const airtableApiKey = Deno.env.get("AIRTABLE_API_KEY");
3const baseId = Deno.env.get("AIRTABLE_BASE_ID");
4const tableName = Deno.env.get("AIRTABLE_TABLE_NAME");
5
6async function fetchAirtableData(uid: string) {
7 if (!airtableApiKey || !baseId || !tableName) {
8 throw new Error("Missing Airtable environment variables");
9 }
10
11 const url = `https://api.airtable.com/v0/${baseId}/${tableName}?filterByFormula=UID%3D%22${encodeURIComponent(uid)}%22`;
12 const response = await fetch(url, {
13 headers: {
14 Authorization: `Bearer ${airtableApiKey}`,
15 },
16 });
12 <title>Title</title>
13 <style>{"html { font-family: sans-serif; }"}</style>
14 <style>@import url('https://fonts.googleapis.com/css2?family=Inter&display=swap');</style><div class="newsletter-form-container"><form class="newsletter-form" action="https://app.loops.so/api/newsletter-form/clbv5du7z04g2ju08qcznl56v" method="POST" style="display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%;"><input class="newsletter-form-input" name="newsletter-form-input" type="email" placeholder="you@best-email.com" required="" style="font-family: Inter, sans-serif; color: rgb(0, 0, 0); font-size: 14px; margin: 0px 0px 10px; width: 100%; max-width: 300px; min-width: 100px; background: rgb(255, 255, 255); border: 1px solid rgb(209, 213, 219); box-sizing: border-box; box-shadow: rgba(0, 0, 0, 0.05) 0px 1px 2px; border-radius: 6px; padding: 8px 12px;"><button type="submit" class="newsletter-form-button" style="background: rgb(41, 176, 68); font-size: 14px; color: rgb(255, 255, 255); font-family: Inter, sans-serif; display: flex; width: 100%; max-width: 300px; white-space: normal; height: 38px; align-items: center; justify-content: center; flex-direction: row; padding: 9px 17px; box-shadow: rgba(0, 0, 0, 0.05) 0px 1px 2px; border-radius: 6px; text-align: center; font-style: normal; font-weight: 500; line-height: 20px; border: none; cursor: pointer;">Subscribe to Replicate Intelligence</button><button type="button" class="newsletter-loading-button" style="background: rgb(41, 176, 68); font-size: 14px; color: rgb(255, 255, 255); font-family: Inter, sans-serif; display: none; width: 100%; max-width: 300px; white-space: normal; height: 38px; align-items: center; justify-content: center; flex-direction: row; padding: 9px 17px; box-shadow: rgba(0, 0, 0, 0.05) 0px 1px 2px; border-radius: 6px; text-align: center; font-style: normal; font-weight: 500; line-height: 20px; border: none; cursor: pointer;">Please wait...</button></form><div class="newsletter-success" style="display: none; align-items: center; justify-content: center; width: 100%;"><p class="newsletter-success-message" style="font-family: Inter, sans-serif; color: rgb(0, 0, 0); font-size: 14px;">You're subscribed! 🚀</p></div><div class="newsletter-error" style="display: none; align-items: center; justify-content: center; width: 100%;"><p class="newsletter-error-message" style="font-family: Inter, sans-serif; color: rgb(185, 28, 28); font-size: 14px;">Oops! Something went wrong, please try again</p></div>
15
16 <script src="https://unpkg.com/htmx.org@1.9.9"></script>
30
31 const anthropic = new Anthropic({
32 apiKey: Deno.env.get("ANTHROPIC_API_KEY"),
33 });
34
48 });
49 } catch (error) {
50 console.error("Error calling Anthropic API:", error);
51 return new Response("Error generating completion. Please try again later.", { status: 500 });
52 }
5
6export async function getCalendars(accountId: string) {
7 const calendarAPI = await pipeDreamGoogle("calendar", accountId);
8 const calendars = await calendarAPI.calendarList.list();
9 return calendars.data.items;
10}
9[](https://www.val.town/v/stevekrouse/blob_admin_app/fork)
10
11It uses [basic authentication](https://www.val.town/v/pomdtr/basicAuth) with your [Val Town API Token](https://www.val.town/settings/api) as the password (leave the username field blank).
12
13# TODO
13## Authentication
14
15Login 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.
16
17## Todos / Plans
27 <head>
28 <title>SQLite Explorer</title>
29 <link rel="preconnect" href="https://fonts.googleapis.com" />
30
31 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
32 <link
33 href="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"
34 rel="stylesheet"
35 />