diff --git a/proj/YT2P/handler.php b/proj/YT2P/handler.php index 29a3891..c801e6f 100644 --- a/proj/YT2P/handler.php +++ b/proj/YT2P/handler.php @@ -12,9 +12,7 @@
-

Here are your prompts!

-

You can copy them one by one in ChatGPT. Why is it presented that way? Check out our Q&A page.

"; - echo $item; - echo ""; + if (strlen($output) > 0) { + echo '

Here are your prompts!

'; + echo '

You can copy them one by one in ChatGPT. Why is it presented that way? Check out our Q&A page.

'; + + foreach ($output as $item) { + echo ""; + echo $item; + echo ""; + } + } else { + echo '
'; + echo '

Hum, looks like something went wrong...

'; + echo "

The video might not have downloadable subtitles, or maybe it's not even a YouTube video?

"; + echo '
'; } + ?>
diff --git a/proj/YT2P/y2t.py b/proj/YT2P/y2t.py index 082eb66..39648b6 100644 --- a/proj/YT2P/y2t.py +++ b/proj/YT2P/y2t.py @@ -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) \ No newline at end of file