Pull data from a srt file on google drive to then run a prompt with it on chat gpt

Hello I’m trying to build an automation pulling data from a srt file (that is a file in a Google drive) in a folder then use the data (text) to run a prompt on chat gpt. I used the module HTTP to get a file i’m not sure if that’s what i’m supposed to do to get the data because chat gpt doesnt detect the file or doesn’t show it as an option

on my drive i have to open the file with text editor that convert the srt file into plain text do i have to do something similar on my scenario ?





could i get some help please

A srt file is basically a text file. You can rename it to .txt extension.

If you need further assistance, please provide the following:

  • Public share link to SRT file (or upload it here)
2 Likes

Hello Sam here is the link to the srt file : reves lucides.srt - Google Drive

but i need to keep the extension in .srt because other people are using the file basically my question is how can i pull data out of that file i tried to create a duplicate and rename it to .txt extension but i still don’t have any clue about how to pull that data inside that file and use it in a prompt for example in chat gpt

thanks for your help

Welcome to the Make community!

Yes, that is possible. You’ll need a minimum of two modules (excluding the download file):

1.

You should be able to use the built-in function toString

e.g.:

{{ toString(1.data) }}

Screenshot_2024-04-19_220435

Output


2.

Then, to get all the subtitle text without the id/time range info,

Screenshot_2024-02-20_151445

You can use a Text Parser “Match Pattern” module with this Pattern (regular expression):

\> .+\s+(?<text>[\w\W]+?)(?=\s+\d+\s+|$)

Proof

https://regex101.com/r/zgLvzy

Important Info

  • :warning: Global match must be set to YES!

Screenshot

Output

Screenshot_2024-04-19_220441


For more information, see Text Parser in the Make Help Center:

Match Pattern
The Match pattern module enables you to find and extract string elements matching a search pattern from a given text. The search pattern is a regular expression (aka regex or regexp), which is a sequence of characters in which each character is either a metacharacter, having a special meaning, or a regular character that has a literal meaning.


3.

Then you can aggregate all the matches to text

Output

Screenshot_2024-04-19_220409

Hope this helps!

samliewrequest private consultation

2 Likes

Module Export

You can copy and paste this module export into your scenario. This will paste the modules shown in my screenshots above.

  1. Copy the JSON code below by clicking the copy button when you mouseover the top-right of the code block
    Screenshot_2024-01-17_200117

  2. Enter your scenario editor. Press ESC to close any dialogs. Press CTRLV (paste keyboard shortcut for Windows) to paste directly in the canvas.

  3. Click on each imported module and save it for validation. You may be prompted to remap some variables and connections.

JSON

{
    "subflows": [
        {
            "flow": [
                {
                    "id": 1,
                    "module": "google-drive:getAFile",
                    "version": 4,
                    "parameters": {
                        "__IMTCONN__": 94797
                    },
                    "mapper": {
                        "select": "map",
                        "formatDocuments": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
                        "formatSpreadsheets": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
                        "formatPresentations": "application/vnd.openxmlformats-officedocument.presentationml.presentation",
                        "formatDrawings": "image/jpeg",
                        "file": "10JXiQ5TW1737r9-4C8ZfA1ARV16uNPOC"
                    },
                    "metadata": {
                        "designer": {
                            "x": -333,
                            "y": -112
                        },
                        "restore": {
                            "parameters": {
                                "__IMTCONN__": {
                                    "label": "Google Restricted",
                                    "data": {
                                        "scoped": "true",
                                        "connection": "google-restricted"
                                    }
                                }
                            },
                            "expect": {
                                "select": {
                                    "label": "Enter manually"
                                },
                                "formatDocuments": {
                                    "label": "MS Word Document"
                                },
                                "formatSpreadsheets": {
                                    "label": "MS Excel"
                                },
                                "formatPresentations": {
                                    "label": "MS PowerPoint"
                                },
                                "formatDrawings": {
                                    "label": "JPEG"
                                }
                            }
                        },
                        "parameters": [
                            {
                                "name": "__IMTCONN__",
                                "type": "account:google-restricted",
                                "label": "Connection",
                                "required": true
                            }
                        ],
                        "expect": [
                            {
                                "name": "select",
                                "type": "select",
                                "label": "Enter a File ID",
                                "required": true,
                                "validate": {
                                    "enum": [
                                        "map",
                                        "value"
                                    ]
                                }
                            },
                            {
                                "name": "formatDocuments",
                                "type": "select",
                                "label": "Convert Google Documents Files to Format",
                                "required": true,
                                "validate": {
                                    "enum": [
                                        "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
                                        "application/pdf",
                                        "application/vnd.oasis.opendocument.text",
                                        "text/html",
                                        "text/plain",
                                        "application/rtf"
                                    ]
                                }
                            },
                            {
                                "name": "formatSpreadsheets",
                                "type": "select",
                                "label": "Convert Google Spreadsheets Files to Format",
                                "required": true,
                                "validate": {
                                    "enum": [
                                        "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
                                        "application/x-vnd.oasis.opendocument.spreadsheet",
                                        "application/pdf"
                                    ]
                                }
                            },
                            {
                                "name": "formatPresentations",
                                "type": "select",
                                "label": "Convert Google Slides Files to Format",
                                "required": true,
                                "validate": {
                                    "enum": [
                                        "application/vnd.openxmlformats-officedocument.presentationml.presentation",
                                        "application/pdf"
                                    ]
                                }
                            },
                            {
                                "name": "formatDrawings",
                                "type": "select",
                                "label": "Convert Google Drawings Files to Format",
                                "required": true,
                                "validate": {
                                    "enum": [
                                        "image/jpeg",
                                        "image/png",
                                        "image/svg+xml",
                                        "application/pdf"
                                    ]
                                }
                            },
                            {
                                "name": "file",
                                "type": "text",
                                "label": "File ID",
                                "required": true
                            }
                        ]
                    }
                },
                {
                    "id": 2,
                    "module": "regexp:Parser",
                    "version": 1,
                    "parameters": {
                        "pattern": "\\> .+\\s+(?<text>[\\w\\W]+?)(?=\\s+\\d+\\s+|$)",
                        "global": true,
                        "sensitive": true,
                        "multiline": false,
                        "singleline": false,
                        "continueWhenNoRes": false,
                        "ignoreInfiniteLoopsWhenGlobal": false
                    },
                    "mapper": {
                        "text": "{{toString(1.data)}}"
                    },
                    "metadata": {
                        "designer": {
                            "x": -89,
                            "y": -108
                        },
                        "restore": {},
                        "parameters": [
                            {
                                "name": "pattern",
                                "type": "text",
                                "label": "Pattern",
                                "required": true
                            },
                            {
                                "name": "global",
                                "type": "boolean",
                                "label": "Global match",
                                "required": true
                            },
                            {
                                "name": "sensitive",
                                "type": "boolean",
                                "label": "Case sensitive",
                                "required": true
                            },
                            {
                                "name": "multiline",
                                "type": "boolean",
                                "label": "Multiline",
                                "required": true
                            },
                            {
                                "name": "singleline",
                                "type": "boolean",
                                "label": "Singleline",
                                "required": true
                            },
                            {
                                "name": "continueWhenNoRes",
                                "type": "boolean",
                                "label": "Continue the execution of the route even if the module finds no matches",
                                "required": true
                            },
                            {
                                "name": "ignoreInfiniteLoopsWhenGlobal",
                                "type": "boolean",
                                "label": "Ignore errors when there is an infinite search loop",
                                "required": true
                            }
                        ],
                        "expect": [
                            {
                                "name": "text",
                                "type": "text",
                                "label": "Text"
                            }
                        ],
                        "interface": [
                            {
                                "type": "text",
                                "name": "text",
                                "label": "text"
                            },
                            {
                                "type": "uinteger",
                                "name": "i",
                                "label": "i"
                            },
                            {
                                "type": "any",
                                "name": "__IMTMATCH__",
                                "label": "Fallback Match"
                            }
                        ]
                    }
                },
                {
                    "id": 3,
                    "module": "util:TextAggregator",
                    "version": 1,
                    "parameters": {
                        "rowSeparator": "\n",
                        "feeder": 2
                    },
                    "mapper": {
                        "value": "{{2.text}}"
                    },
                    "metadata": {
                        "designer": {
                            "x": 158,
                            "y": -107,
                            "messages": [
                                {
                                    "category": "last",
                                    "severity": "warning",
                                    "message": "A transformer should not be the last module in the route."
                                }
                            ]
                        },
                        "restore": {
                            "parameters": {
                                "rowSeparator": {
                                    "label": "New row"
                                }
                            },
                            "extra": {
                                "feeder": {
                                    "label": "Text parser - Match pattern"
                                }
                            }
                        },
                        "parameters": [
                            {
                                "name": "rowSeparator",
                                "type": "select",
                                "label": "Row separator",
                                "validate": {
                                    "enum": [
                                        "\n",
                                        "\t",
                                        "other"
                                    ]
                                }
                            }
                        ],
                        "expect": [
                            {
                                "name": "value",
                                "type": "text",
                                "label": "Text"
                            }
                        ],
                        "advanced": true
                    },
                    "flags": {
                        "stopIfEmpty": true
                    }
                }
            ]
        }
    ],
    "metadata": {
        "version": 1
    }
}

samliewrequest private consultation

3 Likes

thank you very much sam it worked now I’ll take the time to properly understand how to use these modules you have mentioned

2 Likes

No problem, glad I could help!

1. If you have a new question in the future, please start a new thread. This makes it easier for others with the same problem to search for the answers to specific questions, and you are more likely to receive help since newer questions are monitored closely.

2. The Make Community guidelines encourages users to try to mark helpful replies as solutions to help keep the Community organized.

This marks the topic as solved, so that:

others can save time when catching up with the latest activity here, and

  • allows others to quickly jump to the solution if they come across the same problem

To do this, simply click the checkbox at the bottom of the post that answers your question:
Screenshot_2023-10-04_161049

3. Don’t forget to like and bookmark this topic so you can get back to it easily in future!

samliewrequest private consultation

3 Likes