Jump to content

Recommended Posts

Sorry for nubbing up the forums, but I'm quite anxious to ge this working and there aren't really any n00b-friendly guides out there.

 

As you can see right here, I fetch video's from tgn.tv's youtube feed. Now, I need that youtube link at the bottom, to convert to an embed so the actual video is shown on my page. For this to happen, I searched & found this basic Regex:

 

mehhh.jpg

 

-------------------------

 

find :#(?:<\>]+href=\")?(?:http://)?((?:[a-zA-Z]{1,4}\.)?youtube.com/(?:watch)?\?v=(.{11}?))[^"]*(?:\"[^\<\>]*>)?([^\<\>]*)(?:)?#

replace : '<object width="425" height="350"><param name="movie" value="http://www.youtube.com/watch?v='.$matches[2].'"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/watch?v='.$matches[2].'" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>'

 

find :#\[youtube\]([^\[\]]+)\[/youtube\]#

replace : '<object width="425" height="350"><param name="movie" value="http://www.youtube.com/watch?v='.$matches[1].'"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/watch?v='.$matches[1].'" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>'

 

-------------------------

 

However, I believe I also need to strip "&feature=youtube_gdata" and the text "Article Source" that precedes the link.

I also haven't got a clue how to actually make this work for me. I tried to go in cold-turkey and just paste the snippet in header.php in wordpress, but naturally, this gave an error.

 

Sorry if the explenation is right there, out in the open. I have searched, but I have not found it.

 

If there is someone here who could pherhaps solve the aformentioned problem (and pherhaps bold the changes made?), and tell me how to get the code working, it would be most appreciated. I know I'm not supposed to just ask people to do stuff for me, but I learn best by example, as right now this whole regex thing is Chinese to me :shrug:

 

Thanks in advance, I hope to get this working!

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.