2023-01-30 22:14:05 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
function echoUrl($url)
|
|
|
|
{
|
|
|
|
echo "<a href=\"$url\">$url</a>";
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|
|
|
|
|
|
|
|
See <?php echoUrl('https://gitea.lemnoslife.com/Benjamin_Loison/YouTube_captions_search_engine'); ?> for more information.<br/>
|
|
|
|
|
2023-02-07 17:25:17 +01:00
|
|
|
<form id="form">
|
|
|
|
<input type="text" autofocus id="search" pattern="[A-Za-z0-9-_ ]+" placeholder="Your alphanumeric search"></input>
|
|
|
|
<input type="submit" value="Search">
|
|
|
|
</form>
|
2023-01-30 22:19:04 +01:00
|
|
|
|
|
|
|
<script>
|
2023-02-07 17:25:17 +01:00
|
|
|
var firstRun = true;
|
|
|
|
var conn;
|
|
|
|
|
|
|
|
function search(event) {
|
|
|
|
event.preventDefault();
|
|
|
|
const query = document.getElementById('search').value;
|
|
|
|
if (firstRun) {
|
|
|
|
firstRun = false;
|
|
|
|
conn = new WebSocket('wss://crawler.yt.lemnoslife.com/websocket');
|
|
|
|
conn.onmessage = function(e) { console.log(e.data); };
|
|
|
|
conn.onopen = function(e) { conn.send(query); };
|
|
|
|
} else {
|
|
|
|
conn.send(query);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var form = document.getElementById('form');
|
|
|
|
form.addEventListener('submit', search);
|
2023-01-30 22:19:04 +01:00
|
|
|
</script>
|