我的YouTube內部框架/像這樣對象的數組:PHP從iframe/object嵌入數組中提取youtube視頻ID?
[0] => <iframe width="600" height="338" src="http://www.youtube.com/embed/szL_PVuzWp0?fs=1&feature=oembed" frameborder="0" allowfullscreen></iframe>
[1] => <object width="600" height="338"><param name="movie" value="http://www.youtube.com/v/jm1S43a-e3Y?version=3&feature=oembed"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/jm1S43a-e3Y?version=3&feature=oembed" type="application/x-shockwave-flash" width="600" height="338" allowscriptaccess="always" allowfullscreen="true"></embed></object>
[2] => <iframe width="600" height="338" src="http://www.youtube.com/embed/7fTploFSbXA?fs=1&feature=oembed" frameborder="0" allowfullscreen></iframe>
[3] => <iframe width="600" height="338" src="http://www.youtube.com/embed/vQSRNYgiuMk?fs=1&feature=oembed" frameborder="0" allowfullscreen></iframe>
注意,嵌入方法可以變化(通常,偶爾<object>
)(由於外部數據源)。
對於每個人我將如何/最可靠的方法去提取視頻URL(例如vQSRNYgiuMk或jm1S43a-e3Y)?
最後,我想用這樣一個數組,結束了:
[0] => "szL_PVuzWp0"
[1] => "jm1S43a-e3Y"
[2] => "7fTploFSbXA"
[3] => "vQSRNYgiuMk"
的可能重複(http://stackoverflow.com/questions/1773822/get-youtube-video-id-from [從PHP的HTML代碼查看YouTube影片ID] -html-code-with-php) –