Back
Version 101
9/18/2024
/** @jsxImportSource https://esm.sh/react */
import React, { useState } from "https://esm.sh/react";
import { createRoot } from "https://esm.sh/react-dom/client";
// last stable version is v100
function App() {
const [url, setUrl] = useState("");
const [result, setResult] = useState(null);
const [loading, setLoading] = useState(false);
const handleSubmit = async (e) => {
e.preventDefault();
setLoading(true);
console.log(`Submitting URL for scraping: ${url}`);
try {
const response = await fetch("/scrape", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ url }),
});
console.log(`Received response for URL: ${url}. Status: ${response.status}`);
const data = await response.json();
setResult(data);
} catch (error) {
console.log(`Error occurred while scraping URL: ${url}. Error details: ${error.message}`);
setResult({ error: error.message });
}
setLoading(false);
};
return (
<div>
<h1>FanFic Scraper</h1>
<form onSubmit={handleSubmit}>
<input
type="url"
value={url}
willthereader-fanficscraper.web.val.run
Updated: September 30, 2024