开发者

Scraping YouTube XML to embed via SimpleXML—where am I going wrong?

开发者 https://www.devze.com 2022-12-19 10:46 出处:网络
I\'m trying to use this query to find the precise videos I want via XML, then I\'m looking to parse the values with SimpleXML and insert them in the DOM via this method.

I'm trying to use this query to find the precise videos I want via XML, then I'm looking to parse the values with SimpleXML and insert them in the DOM via this method.

I was experiencing a strange problem earlier when pulling the value from:

<media:player ur开发者_StackOverflowl='http://www.youtube.com/watch?v=ikACkCpJ-js&amp;feature=youtube_gdata'/>

When using this value for the embed src and param value, I simply get a white screen embedded. For some reason, the source code included the full parameters, but the DOM actually leaves out the closing "embed" and "param" tags. Console throws an error. Madness ensues. No good.

The only URL value I can find that works for the embed is in here:

<media:content url='http://www.youtube.com/v/ikACkCpJ-js?f=videos&amp;app=youtube_gdata' type='application/x-shockwave-flash' medium='video' isDefault='true' expression='full' duration='159' yt:format='5'/>

Unfortunately, when I run a print_r on the value stored in simplexml_load_file('feed file'), I get the following: http://drp.ly/lmf2J Ugh. The values stop just before the actual value I'm needing to get to.

I'm obviously screwing something up here in the way I'm approaching this problem or in my execution. Can you help me out?


Well, looks like I was able to act as if that element really did exist in order to get the result.

Stuck again. Off to ask another question.

0

精彩评论

暂无评论...
验证码 换一张
取 消