SCRIPTING
If
Shortcut Input
does not contain
youtu
SCRIPTING
SCRIPTING
Exit shortcut with
Result
SCRIPTING
End If

If Result
TEXT
Match
.*(?:youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=)([^#\&\?]*).*
in
Shortcut Input

Matches
TEXT
Get
Group At Index
1
in
videoID

Text
URL
https://youtubetranscript.com/?server_vid=
Text

URL
NETWORK
Get contents of
URL
Options Under Construction

Contents of URL
SCRIPTING
Set name of
Contents of URL
to
transcript.txt

Renamed Item
DOCUMENTS
Replace
<\/text>
with
in
Renamed Item

Updated Text
DOCUMENTS
Replace
<.+?>
with
World
in
Updated Text

Updated Text
DOCUMENTS
Replace
'
with
'
in
Updated Text

Updated Text
DOCUMENTS
Replace
"
with
"
in
Updated Text

Updated Text
VARIABLES
Set variable
Transcript
to
Updated Text
COMMENT
Now to split
TEXT
Split
Transcript
by
New Lines

Split Text
SCRIPTING
Count
Items
in
Split Text

Count
SCRIPTING
If
Count
is greater than or equal to
200
SCRIPTING
Get
Items in Range
1
to
200
from
Split Text

Item from List
TEXT
Combine
Item from List
with
New Lines

Combined Text
VARIABLES
Set variable
Transcript
to
Combined Text
SCRIPTING
End If

If Result
COMMENT
Now to gpt
TEXT
Text

Text
TEXT
Summarize the following transcripts of this YouTube video in approximately 700 words:

Text
DICTIONARY

Dictionary
LIST

List
VARIABLES
Set variable
requestMessages
to
List
DICTIONARY

Dictionary
VARIABLES
Set variable
requestTemplate
to
Dictionary
DOCUMENTS
Replace
"
with
\"
in
Transcript

Updated Text
VARIABLES
Set variable
UserInput
to
Updated Text
SCRIPTING
If
UserInput
does not have any value
SCRIPTING
Exit shortcut with
Result
SCRIPTING
End If

If Result
DICTIONARY

Dictionary
VARIABLES
Add
Dictionary
to
requestMessages
SCRIPTING
Set
messages
to
requestMessages
in
Dictionary

Dictionary
NETWORK
Get contents of
https://api.openai.com/v1/chat/completions
Options Under Construction

Contents of URL
DOCUMENTS
Get text from
Contents of URL

Text
SCRIPTING
Get
Value
for
choices
in
Text

Dictionary Value
SCRIPTING
Get
First Item
from
Dictionary Value

Item from List
SCRIPTING
Get
Value
for
message
in
Dictionary Value

Dictionary Value
VARIABLES
Add
Dictionary Value
to
requestMessages
SCRIPTING
Get
Value
for
content
in
Dictionary Value

Dictionary Value
DOCUMENTS
Show
Dictionary Value
in Quick Look