<!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 (strlen($output) > 0) {
    echo '<h4>Here are your prompts!</h4>';
    echo '<p>You can copy them one by one in ChatGPT. Why is it presented that way? Check out our <a href="./qna.php" target="_blank">Q&A page</a>.</p>';
    
    foreach ($output as $item) {
      echo "<copbox>";
      echo $item;
      echo "</copbox>";
    }
  } 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>';
  }

?>

</section>


</div>
<script src="assets/js/vue.min.js"></script>
<script src="assets/js/main.js"></script>

</body>
</html>