ed.brz9.dev/proj/YT2P/handler.php

56 lines
1.6 KiB
PHP

<!DOCTYPE HTML>
<html>
<head>
<title>YT2P - Results</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="assets/css/style.css">
</head>
<body>
<div id="root">
<section id="output">
<?php
$url = $_POST['url'];
$lang = $_POST['lang'];
$cmd = "python3 y2t.py " . $url . " " . $lang ;
exec($cmd, $output, $return);
if (sizeof($output) > 0) {
echo '<h4>Here are your prompts!</h4>';
echo '<p>You can copy and paste them one by one in ChatGPT.</p>';
echo "<p>Note that the first box contains the full transcript, it might be too long for ChatGPT, that's why you'll find below the transcript in several parts (for longer videos) and a prompt at the end that usually gives good results.</p>";
foreach ($output as $item) {
echo "<copbox>";
echo $item;
echo "</copbox>";
}
echo '<p>Why is it presented that way? Check out our <a href="./qna.php" target="_blank">Q&A page</a> or get the transcript of another video on the <a href="./index.php" target="_blank">homepage</a>.</p>';
} else {
echo '<section class="error">';
echo ' <p>Hum, looks like something went wrong...</p>';
echo " <p>The video might not have downloadable subtitles, or maybe it's not even a YouTube video?</p>";
echo '</section>';
echo '<p>Check out our <a href="./qna.php" target="_blank">Q&A</a> for more details or try again with another link on the <a href="./index.php" target="_blank">homepage</a>.</p>';
}
?>
</section>
</div>
<script src="assets/js/vue.min.js"></script>
<script src="assets/js/main.js"></script>
</body>
</html>