Back
Version 33
9/17/2024
/** @jsxImportSource https://esm.sh/react */
import React, { useState } from "https://esm.sh/react";
import { createRoot } from "https://esm.sh/react-dom/client";
function App() {
const [url, setUrl] = useState("");
const [result, setResult] = useState(null);
const [loading, setLoading] = useState(false);
const handleSubmit = async (e) => {
e.preventDefault();
setLoading(true);
try {
const response = await fetch("/scrape", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ url }),
});
const data = await response.json();
setResult(data);
} catch (error) {
setResult({ error: error.message });
}
setLoading(false);
};
return (
<div>
<h1>Web Scraper</h1>
<form onSubmit={handleSubmit}>
<input
type="url"
value={url}
onChange={(e) => setUrl(e.target.value)}
placeholder="Enter URL to scrape"
required
willthereader-fanficscraper.web.val.run
Updated: September 30, 2024