喜鹊:在项目中有多个图像,但只想要一个

时间:2015-12-21 15:25:27

标签: php rss magpie

我正在尝试使用magpie拉出RSS项目的第一个缩略图图像,但如果项目中有多个图像,则会将它们全部返回到一个字符串中。

RSS代码:

     <multimedia>
    <media type="photo">
        <link>http://media.jrn.com/images/K0008499127--75534.JPG</link>
        <thumbnail>http://media.jrn.com/images/300*377/K0008499127--75534.JPG</thumbnail>
        <caption>State Rep. Joe Armstrong, D-Knoxville</caption>
        <credit></credit>
        <share_url>http://www.knoxnews.com/news/local/armstrong-indictment-inspires-cigarette-tax-legislation-275a5dc9-badf-3a5d-e053-0100007ffa4a-363078641.html</share_url>
    </media>
    <media type="photo">
        <link>http://media.jrn.com/images/mccormick_1436280885241_20971671_ver1.0_640_480.jpg</link>
        <thumbnail>http://media.jrn.com/images/300*213/mccormick_1436280885241_20971671_ver1.0_640_480.jpg</thumbnail>
        <caption>House Majority Leader Gerald McCormick, R-Chattanooga, addresses the House chamber in Nashville on Wednesday, April 22, 2015.</caption>
        <credit>Associated Press/Times Free Press</credit>
        <share_url>http://www.knoxnews.com/news/local/armstrong-indictment-inspires-cigarette-tax-legislation-275a5dc9-badf-3a5d-e053-0100007ffa4a-363078641.html</share_url>
    </media>
    </multimedia>

喜鹊调试器返回两个图像:

["multimedia_media_thumbnail"]=>
  string(145) "http://media.jrn.com/images/300*377/K0008499127--75534.JPGhttp://media.jrn.com/images/300*213/mccormick_1436280885241_20971671_ver1.0_640_480.jpg"

如何获取multimedia_media_thumbnail的第一张图片网址?

0 个答案:

没有答案