error handeling
This commit is contained in:
parent
af963434a1
commit
0a7d43a8ef
|
@ -12,9 +12,7 @@
|
|||
|
||||
<section id="output">
|
||||
|
||||
<h4>Here are your prompts!</h4>
|
||||
|
||||
<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>
|
||||
|
||||
<?php
|
||||
$url = $_POST['url'];
|
||||
|
@ -24,11 +22,22 @@
|
|||
|
||||
exec($cmd, $output, $return);
|
||||
|
||||
foreach ($output as $item) {
|
||||
echo "<copbox>";
|
||||
echo $item;
|
||||
echo "</copbox>";
|
||||
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>
|
||||
|
|
|
@ -8,6 +8,11 @@ lang = sys.argv[2]
|
|||
# https://youtu.be/dxt7w5NUub8
|
||||
# https://www.youtube.com/watch?v=456456
|
||||
|
||||
if lang == "fr":
|
||||
inFrench = " in French"
|
||||
else:
|
||||
inFrench = ""
|
||||
|
||||
bad_url = "youtu.be/"
|
||||
good_url = "www.youtube.com/watch?v="
|
||||
|
||||
|
@ -55,7 +60,7 @@ words = txt.split()
|
|||
|
||||
sList = []
|
||||
wCount = 0
|
||||
maxWordCount = 1000
|
||||
maxWordCount = 2000
|
||||
currentString = ""
|
||||
|
||||
for w in words:
|
||||
|
@ -70,6 +75,12 @@ if currentString:
|
|||
|
||||
blocks = len(sList)
|
||||
|
||||
for i in range(blocks):
|
||||
print('This is part '+ str(i+1) +'/'+ str(blocks) + ' of the transcript of a video named: « ' + title + ' » : ' + sList[i])
|
||||
if blocks == 1 :
|
||||
print("This is the transcript of a video titled: « " + title + " » : " + sList[0])
|
||||
print("Based on this transcript, write a summary with a list of relevant points with a title and few sentences for each point" + inFrench)
|
||||
|
||||
else :
|
||||
for i in range(blocks):
|
||||
print('This is part '+ str(i+1) +'/'+ str(blocks) + ' of the transcript of a video titled: « ' + title + ' » : ' + sList[i])
|
||||
|
||||
print("Based on the " + str(blocks) + " parts of the transcript, write a summary with a list of relevant points with a title and few sentences for each point" + inFrench)
|
Loading…
Reference in New Issue