Best answer

Adding links to WordPress content sourced from YouTube description

  • 2 March 2021
  • 8 replies
  • 95 views

Userlevel 1
Badge

Hey there,

 

I’ve set up an automation with Zapier that runs whenever I publish a new YouTube video on my channel. The automation creates a post in WordPress by uploading the YT thumbnail as a featured image, title as a title and the link to the video as well as the YT video description as the post content. 

 

The problem I’m facing is that the links from my YT caption aren’t showing up as clickable links in the WordPress post. I’d love for this to be fixed, so that users on my website could read through the description and instantly click on the links. 

 

Is there a way to achieve this? I basically just need the URLs that are in the video description to be clickable...

icon

Best answer by GetUWired 2 March 2021, 17:18

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

8 replies

Userlevel 7
Badge +12

The easiest way to do this would be with a code action that uses a regex expression to replace your URLs with anchor tags before adding it to the Wordpress post.

 

Userlevel 1
Badge

@GetUWired  thank you for your answer!

 

Do you have a RegEx that would do this? That would be great!

Userlevel 7
Badge +12

var result = inputData.description.replace(/(\b(https?|ftp|file):\/\/[\-A-Z0-9+&@#\/%?=~_|!:,.;]*[\-A-Z09+&@#\/%=~_|])/img, '<a href="$1">$1</a>');

return {'formattedOutput': result};


Here’s the javascript that I used in that code action, which includes the regex expression.

Userlevel 1
Badge

@GetUWired  Unfortunately I can’t seem to make it work. I get the following error back from Zapier when testing the zap:

 

Userlevel 1
Badge

@GetUWired any update on this? I’m probably doing something wrong, but I can’t seem to figure it out :sweat_smile:

Userlevel 7
Badge +12

@janosch.hrm 
Would you mind sharing a screenshot of how you have your code set up? 

Userlevel 1
Badge

@GetUWired Never mind, I actually got it to work now. I think I had a type in the name of the input field. Thank you so much for your help!

Userlevel 7
Badge +12

@janosch.hrm 

That’s great to hear! Glad we could help out!