Looking to use Maestro to take clipboard as normal, however paste, or store, only a portion of the URL link into my next action:

So I'm trying to automate a process by which I can download auto-generated youtube subtitles via the subtitles.

There's a website that does this with the following format:
http://diycaptions.com/php/get-automatic-captions-as-txt.php?id=4K27HhxwPaY&language=asr

This link is generated from the following Youtube Link:
https://www.youtube.com/watch?v=4K27HhxwPaY&index=111&list=PLwJRxp3blEvZyQBTTOMFRP_TDaSdly3gU&t=0s

So the video ID: "4K27HhxwPaY" is the only portion of the unique youtube video I need. I need a way to copy the full youtube link but then discriminate between the field to retain only the unique video id. I'd of course then simply pass this on structurally to the 1st link above.

Is there a way to do that from the clipboard? Conveniently the youtube links will always be the same syntax such that a function to 'count' and retain only 11 characters after the first "=", or any similar workaround would serve my purpose. I'm just not familiar enough with the available tools to know the path of least resistance here.

All help is appreciated. Thanks

Yep, easily done using RegEx:
https:\/\/www\.youtube\.com\/watch\?v=(.+?)&

For details, see:

Here's the macro to use this RegEx.
Enable whichever of the first two Actions is best for you to set the Clipboard to the YouTube URL.


MACRO:   Build Link from YouTube Video ID [Example]


#### DOWNLOAD:
<a class="attachment" href="/uploads/default/original/3X/2/e/2e5adc7c4e2034fa9e317ce7f853fa864493381f.kmmacros">Build Link from YouTube Video ID [Example].kmmacros</a> (3.5 KB)
**Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.**

---



![image|564x880](upload://jrjKlSpAxAjwvztYAUGoMVG3cn6.jpg)

---

Does this work for you?
Questions?

Wow that's exactly it. I've always wondered what RegExpression was and it all makes sense. That's fantastic! Thanks again

1 Like