You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
995 B
41 lines
995 B
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>BookScraper</title>
|
|
<style>
|
|
body { font-family: Arial; padding:20px; }
|
|
#log { background:#000; color:#0f0; padding:10px; height:400px; overflow:auto; white-space:pre-wrap; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<h1>BookScraper</h1>
|
|
|
|
<input id="url" type="text" placeholder="Book URL" style="width:400px">
|
|
<button onclick="startScrape()">Start</button>
|
|
|
|
<h2>Realtime log:</h2>
|
|
<div id="log"></div>
|
|
|
|
<script>
|
|
function startScrape() {
|
|
document.getElementById("log").innerHTML = "";
|
|
|
|
const evtSource = new EventSource("/stream");
|
|
evtSource.onmessage = function(e) {
|
|
const logDiv = document.getElementById("log");
|
|
logDiv.innerText += e.data + "\n";
|
|
logDiv.scrollTop = logDiv.scrollHeight;
|
|
};
|
|
|
|
fetch("/run", {
|
|
method: "POST",
|
|
headers: { "Content-Type": "application/json" },
|
|
body: JSON.stringify({ url: document.getElementById("url").value })
|
|
});
|
|
}
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|