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