Get Youtube Video ID from html code with PHP
        Posted  
        
            by asumaran
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by asumaran
        
        
        
        Published on 2009-11-20T23:19:50Z
        Indexed on 
            2010/04/14
            18:13 UTC
        
        
        Read the original article
        Hit count: 248
        
I want to get all only youtube video ID from html code
look the (or multiple) object/embed code for youtube video
// html from database
    <p>loremm ipsum dolor sit amet enot
    <a href="link" attribute=""blah blah blah">anchor link</a>
    </p>
    <object width="425" height="344">
        <param name="movie" value="http://www.youtube.com/v/Ou5eVl5eqtg&hl=es_ES&fs=1&"></param>
        <param name="allowFullScreen" value="true"></param>
        <param name="allowscriptaccess" value="always"></param>
        <embed src="http://www.youtube.com/v/Ou5eVl5eqtg&hl=es_ES&fs=1&"
    type="application/x-shockwave-flash"
    allowscriptaccess="always"
    allowfullscreen="true"
    width="425"
    height="344">
    </embed>
        </object>
    <image src="path/to/image.ext" >
    <p>lorem ipsum dolor sit amet... blah</p>
    <p>lorem ipsum dolor sit amet... blah</p>
    <object width="425" height="344">
        <param name="movie" value="http://www.youtube.com/v/Ou5eVl5eqtg&hl=es_ES&fs=1&"></param>
        <param name="allowFullScreen" value="true"></param>
        <param name="allowscriptaccess" value="always"></param>
        <embed src="http://www.youtube.com/v/Ou5eVl5eqtg&hl=es_ES&fs=1&"
    type="application/x-shockwave-flash"
    allowscriptaccess="always"
    allowfullscreen="true"
    width="425"
    height="344">
    </embed>
        </object>
<p>blah</p>
blah<br/>
blah<br/>
blah<br/>
© Stack Overflow or respective owner