使用 BBC RSS 提要,但新闻报道会被多次显示

Using the BBC RSS feed, however news stories are being displayed multiple times

我正在尝试从 BBC RSS 提要中读取 XML 数据,并且我已成功读取数据,但是新闻报道显示的次数过多。我希望每个故事都显示在自己的容器中(即 div 元素)。相反,它会在 46 个容器中的每一个容器中显示所有新闻故事(当前为 46 个故事)。

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
    <link rel="stylesheet" href="styles.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>

    <title> Hijacked News </title>

    <script>
    $(document).ready(function(){
        $.ajax({
            type:"GET",
            url: "newsStore.php",
            cache: false,
            dataType: "xml",
            success: parse_rss
        });
    });

    function parse_rss(xml){
        //get feed
        $(xml).find('item').each(function(){
            var item_title

            item_title = $(xml).find("item").find("title").text();
            //var image_url = $(xml).find("thumbnail").last().attr("url");

            $('#title_div').append(item_title);

            //adding all titles to each title_div atm
            //$("#title_div").append('<p>' + item_title + '</p>');      
        });
    }
    </script>
</head>
<body>
    <div class="page-wrap">
        <div id="main-content">
            <div class="header"></div>
            <div id="output">
                <div id="title_div"></div>
            </div>
        </div>
    </div>
</body>

非常感谢任何帮助。

编辑 这是后端脚本的代码:newsStore.php.

<?php
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Cache-Control: max-age=0");
header("Content-Type: text/xml");
?>
<?php
function get_url_contents($url){
  $crl = curl_init();
  $timeout = 5;
  curl_setopt ($crl, CURLOPT_URL,$url);
  curl_setopt ($crl, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt ($crl, CURLOPT_CONNECTTIMEOUT, $timeout);
  $ret = curl_exec($crl);
  curl_close($crl);
  return $ret;
}
$url = "http://feeds.bbci.co.uk/news/rss.xml?edition=int#";
$str = file_get_contents($url);
echo $str;
?>

传递给.each()的回调可以接受两个参数

Type: Function( Integer indexInArray, Object value ).

因此回调可以利用代表每个 <item> 节点的 Object 值 。将itemobject传递给$(), call .find()后得到title(然后是title节点的文本)

$(xml).find('item').each(function(index, item) {
    var item_title = $(item).find("title").text();

请参阅下面的实际操作。

注意: 因为 AJAX 在这里不起作用,除非我们让 php 脚本在同一个域中工作,我改变了 $.ajax() 出于演示目的 - 我不建议经常这样做。另外 - 我将提要数据缩减为一些结果

$(document).ready(function() {
  $.ajax({
    type: "GET",
    url: "newsStore.php",
    cache: false,
    dataType: "xml",
        jsonp: "callback",
    success: parse_rss
  });
});

function parse_rss(xml) {
  //get feed
  $(xml).find('item').each(function(index, item) {
    var item_title = $(item).find("title").text();
    //var image_url = $(xml).find("thumbnail").last().attr("url");

    //$('#title_div').append(item_title);

    //adding all titles to each title_div atm
    $("#title_div").append('<p>' + item_title + '</p>');      
  });
}
$.ajax = function(params) {
  var xml = '<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet title="XSL_formatting" type="text/xsl" href="/shared/bsp/xsl/rss/nolsol.xsl"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:media="http://search.yahoo.com/mrss/">    <channel>        <title><![CDATA[BBC News - Home]]></title>        <description><![CDATA[BBC News - Home]]></description>        <link>http://www.bbc.co.uk/news/</link>        <image>            <url>http://news.bbcimg.co.uk/nol/shared/img/bbc_news_120x60.gif</url>            <title>BBC News - Home</title>            <link>http://www.bbc.co.uk/news/</link>        </image>        <generator>RSS for Node</generator>        <lastBuildDate>Mon, 05 Dec 2016 20:33:05 GMT</lastBuildDate>        <copyright><![CDATA[Copyright: (C) British Broadcasting Corporation, see http://news.bbc.co.uk/2/hi/help/rss/4498287.stm for terms and conditions of reuse.]]></copyright>        <language><![CDATA[en-gb]]></language>        <ttl>15</ttl>        <item>            <title><![CDATA[Italy PM Matteo Renzi delays resignation until budget is passed]]></title>            <description><![CDATA[Italy\'s outgoing PM Matteo Renzi will resign after the 2017 budget is passed in coming days.]]></description>            <link>http://www.bbc.co.uk/news/world-europe-38209795</link>            <guid isPermaLink="true">http://www.bbc.co.uk/news/world-europe-38209795</guid>            <pubDate>Mon, 05 Dec 2016 20:03:30 GMT</pubDate>            <media:thumbnail width="2048" height="1152" url="http://c.files.bbci.co.uk/6A61/production/_92833272_mediaitem92833271.jpg"/>        </item>        <item>            <title><![CDATA[UK government puts case for Brexit powers]]></title>            <description><![CDATA[The government urges a verdict the "ordinary man and woman" would understand in the Brexit hearing.]]></description>            <link>http://www.bbc.co.uk/news/uk-politics-38200115</link>            <guid isPermaLink="true">http://www.bbc.co.uk/news/uk-politics-38200115</guid>            <pubDate>Mon, 05 Dec 2016 19:45:41 GMT</pubDate>            <media:thumbnail width="1920" height="1080" url="http://c.files.bbci.co.uk/120F/production/_92832640_supremect.jpg"/>        </item>        <item>            <title><![CDATA[Justin Ross Harris sentenced to life for son\'s hot car death]]></title>            <description><![CDATA[A US father who left his toddler to die in a hot car has been sentenced to life in prison without parole.]]></description>            <link>http://www.bbc.co.uk/news/world-us-canada-38215954</link>            <guid isPermaLink="true">http://www.bbc.co.uk/news/world-us-canada-38215954</guid>            <pubDate>Mon, 05 Dec 2016 19:25:28 GMT</pubDate>            <media:thumbnail width="624" height="351" url="http://c.files.bbci.co.uk/7B2D/production/_92433513_cap2342ture.jpg"/>        </item>        <item>            <title><![CDATA[India politician J Jayalalitha dies at 68]]></title>            <description><![CDATA[Leading Indian politician J Jayalalitha dies aged 68 after a heart attack, hospital officials say.]]></description>            <link>http://www.bbc.co.uk/news/world-asia-38215826</link>            <guid isPermaLink="true">http://www.bbc.co.uk/news/world-asia-38215826</guid>            <pubDate>Mon, 05 Dec 2016 20:23:28 GMT</pubDate>            <media:thumbnail width="976" height="549" url="http://c.files.bbci.co.uk/119A8/production/_92840127_31755a79-cc36-4e8d-a70d-88f663889fe8.jpg"/>        </item>        <item>            <title><![CDATA[Aleppo tweeting girl Bana Alabed \'is safe\']]></title>            <description><![CDATA[Aleppo\'s tweeting girl Bana Alabed is safe, the BBC learns, after her account was deactivated.]]></description>            <link>http://www.bbc.co.uk/news/world-middle-east-38209743</link>            <guid isPermaLink="true">http://www.bbc.co.uk/news/world-middle-east-38209743</guid>            <pubDate>Mon, 05 Dec 2016 18:45:07 GMT</pubDate>            <media:thumbnail width="976" height="549" url="http://c.files.bbci.co.uk/24CB/production/_91491490_bana_top.jpg"/>        </item>        <item>            <title><![CDATA[Freiburg murder: Germans urged not to scapegoat migrants]]></title>            <description><![CDATA[Germans are urged not to scapegoat migrants, as an Afghan youth is suspected of rape and murder.]]></description>            <link>http://www.bbc.co.uk/news/world-europe-38211944</link>            <guid isPermaLink="true">http://www.bbc.co.uk/news/world-europe-38211944</guid>            <pubDate>Mon, 05 Dec 2016 17:44:02 GMT</pubDate>            <media:thumbnail width="976" height="549" url="http://c.files.bbci.co.uk/13ED8/production/_92842618_freiburgtreeafp5dec.jpg"/>        </item>        <item>            <title><![CDATA[Iran fashion workers jailed for \'spreading prostitution\']]></title>            <description><![CDATA[Twelve fashion workers are reportedly jailed in Iran for "spreading prostitution" via online images.]]></description>            <link>http://www.bbc.co.uk/news/world-middle-east-38210936</link>            <guid isPermaLink="true">http://www.bbc.co.uk/news/world-middle-east-38210936</guid>            <pubDate>Mon, 05 Dec 2016 14:26:22 GMT</pubDate>            <media:thumbnail width="1024" height="576" url="http://c.files.bbci.co.uk/16943/production/_92838429_gettyimages-460637290.jpg"/>        </item>        <item>            <title><![CDATA[Al Gore meets Donald Trump and Ivanka for climate talks]]></title>            <description><![CDATA[Former Democratic vice-president Al Gore, a climate change activist, meets Mr Trump and his daughter for talks.]]></description>            <link>http://www.bbc.co.uk/news/world-us-canada-38211695</link>            <guid isPermaLink="true">http://www.bbc.co.uk/news/world-us-canada-38211695</guid>            <pubDate>Mon, 05 Dec 2016 20:03:35 GMT</pubDate>            <media:thumbnail width="976" height="549" url="http://c.files.bbci.co.uk/9424/production/_92842973_gettyimages-627821290.jpg"/>        </item>        <item>            <title><![CDATA[France election: PM Manuel Valls to run for president]]></title>            <description><![CDATA[French Socialist PM Manuel Valls announces he is standing in next year\'s presidential election.]]></description>            <link>http://www.bbc.co.uk/news/world-europe-38215328</link>            <guid isPermaLink="true">http://www.bbc.co.uk/news/world-europe-38215328</guid>            <pubDate>Mon, 05 Dec 2016 19:04:49 GMT</pubDate>            <media:thumbnail width="976" height="549" url="http://c.files.bbci.co.uk/1319A/production/_92843287_0a714b7a-04df-4c2e-96e4-9e398b9b1bb7.jpg"/>        </item>        <item>            <title><![CDATA[Oakland fire: Criminal investigation opens into deadly blaze]]></title>            <description><![CDATA[A criminal inquiry opens into a fire that killed at least 36 people at a warehouse party in California.]]></description>            <link>http://www.bbc.co.uk/news/world-us-canada-38206351</link>            <guid isPermaLink="true">http://www.bbc.co.uk/news/world-us-canada-38206351</guid>            <pubDate>Mon, 05 Dec 2016 13:57:21 GMT</pubDate>            <media:thumbnail width="976" height="549" url="http://c.files.bbci.co.uk/17D61/production/_92833679_mediaitem92833678.jpg"/>        </item>        <item>            <title><![CDATA[Viral US school video with hidden message]]></title>            <description><![CDATA[A viral video which hides its real message in plain sight has clocked up millions of views.]]></description>            <link>http://www.bbc.co.uk/news/world-us-canada-38205746</link>            <guid isPermaLink="true">http://www.bbc.co.uk/news/world-us-canada-38205746</guid>            <pubDate>Mon, 05 Dec 2016 15:46:48 GMT</pubDate>            <media:thumbnail width="976" height="549" url="http://c.files.bbci.co.uk/7A97/production/_92838313_sandyhookimage.jpg"/>        </item>        <item>            <title><![CDATA[Chapecoense plane crash: Team awarded Copa Sudamericana]]></title>            <description><![CDATA[Brazilian club Chapecoense, who lost 19 players and staff in an air crash en route to the Copa Sudamericana final, are awarded the trophy.]]></description>            <link>http://www.bbc.co.uk/sport/football/38215558</link>            <guid isPermaLink="true">http://www.bbc.co.uk/sport/football/38215558</guid>            <pubDate>Mon, 05 Dec 2016 20:32:35 GMT</pubDate>            <media:thumbnail width="2048" height="1152" url="http://c.files.bbci.co.uk/14522/production/_92843238_brazil2_getty.jpg"/>        </item>        <item>            <title><![CDATA[How might China respond to Trump tweets?]]></title>            <description><![CDATA[US President-elect Donald Trump has attacked China on social media - how might Beijing respond?]]></description>            <link>http://www.bbc.co.uk/news/world-asia-china-38213874</link>            <guid isPermaLink="true">http://www.bbc.co.uk/news/world-asia-china-38213874</guid>            <pubDate>Mon, 05 Dec 2016 17:08:28 GMT</pubDate>            <media:thumbnail width="976" height="549" url="http://c.files.bbci.co.uk/D312/production/_92843045_p04k8krs.jpg"/>        </item>        <item>            <title><![CDATA[Spain floods: Man and dog rescued in Costa del Sol]]></title>            <description><![CDATA[A man and his dog are airlifted from chest-high floods in the Costa del Sol region of Spain.]]></description>            <link>http://www.bbc.co.uk/news/world-europe-38203573</link>            <guid isPermaLink="true">http://www.bbc.co.uk/news/world-europe-38203573</guid>            <pubDate>Sun, 04 Dec 2016 23:27:35 GMT</pubDate>            <media:thumbnail width="1024" height="575" url="http://c.files.bbci.co.uk/16C6C/production/_92829239_p04k5hqj.jpg"/>        </item>        <item>            <title><![CDATA[Pakistan hotel fire kills at least 11 people]]></title>            <description><![CDATA[Guests describe their escape from a deadly hotel fire in Karachi, Pakistan.]]></description>            <link>http://www.bbc.co.uk/news/world-asia-38206256</link>            <guid isPermaLink="true">http://www.bbc.co.uk/news/world-asia-38206256</guid>            <pubDate>Mon, 05 Dec 2016 07:54:50 GMT</pubDate>            <media:thumbnail width="976" height="549" url="http://c.files.bbci.co.uk/1403/production/_92832150_p04k6r7c.jpg"/>        </item>        <item>            <title><![CDATA[Uzbekistan elects a new president]]></title>            <description><![CDATA[Uzbekistan has elected a new president. Prime Minister Shavkat Mirziyoyev won with a landslide victory.]]></description>            <link>http://www.bbc.co.uk/news/world-asia-38208054</link>            <guid isPermaLink="true">http://www.bbc.co.uk/news/world-asia-38208054</guid>            <pubDate>Mon, 05 Dec 2016 13:11:32 GMT</pubDate>            <media:thumbnail width="976" height="549" url="http://c.files.bbci.co.uk/2ADD/production/_92837901_p04k7s4z.jpg"/>        </item>        <item>            <title><![CDATA[Bollywood\'s Ranveer Singh on racy scenes]]></title>            <description><![CDATA[Actor Ranveer Singh tells the BBC why he thinks Bollywood should be less prudish.]]></description>            <link>http://www.bbc.co.uk/news/world-asia-india-38171792</link>            <guid isPermaLink="true">http://www.bbc.co.uk/news/world-asia-india-38171792</guid>            <pubDate>Mon, 05 Dec 2016 14:01:56 GMT</pubDate>            <media:thumbnail width="640" height="360" url="http://c.files.bbci.co.uk/6485/production/_92833752_mediaitem92793109.jpg"/>        </item>        <item>            <title><![CDATA[Journey of a four-year-old trafficked chimpanzee]]></title>            <description><![CDATA[Manno was taken from his mother in Africa as a baby and ended up in the Middle East, before being re-homed in Kenya.]]></description>            <link>http://www.bbc.co.uk/news/world-africa-38208445</link>            <guid isPermaLink="true">http://www.bbc.co.uk/news/world-africa-38208445</guid>            <pubDate>Mon, 05 Dec 2016 14:03:14 GMT</pubDate>            <media:thumbnail width="1024" height="576" url="http://c.files.bbci.co.uk/D7CB/production/_92834255_p04k6vd1.jpg"/>        </item>        <item>            <title><![CDATA[World news in one minute]]></title>            <description><![CDATA[Watch the latest news summary from BBC World News. International news updated 24 hours a day.]]></description>            <link>http://www.bbc.co.uk/news/10462520</link>            <guid isPermaLink="true">http://www.bbc.co.uk/news/10462520</guid>            <pubDate>Mon, 05 Dec 2016 19:38:34 GMT</pubDate>            <media:thumbnail width="1024" height="576" url="http://c.files.bbci.co.uk/15C7E/production/_90041298_p01tlf61.jpg"/>        </item>        <item>            <title><![CDATA[The changing face of Black Pete in the Netherlands]]></title>            <description><![CDATA[The Sinterklaas festival in the Netherlands is hoping to avoid controversy with a new look for "Black Pete".]]></description>            <link>http://www.bbc.co.uk/news/world-europe-38204388</link>            <guid isPermaLink="true">http://www.bbc.co.uk/news/world-europe-38204388</guid>            <pubDate>Mon, 05 Dec 2016 04:49:18 GMT</pubDate>            <media:thumbnail width="1024" height="575" url="http://c.files.bbci.co.uk/DF0F/production/_92830175_p04k5hm6.jpg"/>        </item>        <item>            <title><![CDATA[Amazon to open shop with no checkouts]]></title>            <description><![CDATA[Customers will be able to select items and walk out without waiting to pay at the Amazon Go shop.]]></description>            <link>http://www.bbc.co.uk/news/technology-38212818</link>            <guid isPermaLink="true">http://www.bbc.co.uk/news/technology-38212818</guid>            <pubDate>Mon, 05 Dec 2016 18:29:02 GMT</pubDate>            <media:thumbnail width="976" height="549" url="http://c.files.bbci.co.uk/CAD4/production/_92842915_amazongo2.jpg"/>        </item>        <item>            <title><![CDATA[Seattle \'thief\' caught by remote car door lock]]></title>            <description><![CDATA[Police in Seattle arrest a suspect after a stolen BMW was tracked and the doors locked remotely.]]></description>            <link>http://www.bbc.co.uk/news/technology-38208244</link>            <guid isPermaLink="true">http://www.bbc.co.uk/news/technology-38208244</guid>            <pubDate>Mon, 05 Dec 2016 14:40:25 GMT</pubDate>            <media:thumbnail width="976" height="549" url="http://c.files.bbci.co.uk/4BAD/production/_92837391_uspolicecar.jpg"/>        </item>        <item>            <title><![CDATA[Hywel Griffith:  Turnbull-Key \'bromance\' over?]]></title>            <description><![CDATA[John Key\'s resignation decision may prompt some envy from his friend and ally in Canberra.]]></description>            <link>http://www.bbc.co.uk/news/world-asia-38205154</link>            <guid isPermaLink="true">http://www.bbc.co.uk/news/world-asia-38205154</guid>            <pubDate>Mon, 05 Dec 2016 08:37:06 GMT</pubDate>            <media:thumbnail width="768" height="432" url="http://c.files.bbci.co.uk/16191/production/_92831509_mediaitem92831508.jpg"/>        </item>        <item>            <title><![CDATA[Phil Mercer: Ex-child soldier vies for Australian award]]></title>            <description><![CDATA[Could the former Sudanese child soldier and refugee Deng Adut be crowned Australian of the year?]]></description>            <link>http://www.bbc.co.uk/news/world-australia-38143301</link>            <guid isPermaLink="true">http://www.bbc.co.uk/news/world-australia-38143301</guid>            <pubDate>Mon, 05 Dec 2016 03:12:54 GMT</pubDate>            <media:thumbnail width="976" height="549" url="http://c.files.bbci.co.uk/14AA/production/_92709250_9ca87219-eaf7-4128-8d9a-50285c9993dd.jpg"/>        </item>        <item>            <title><![CDATA[Presidential phone calls: How do world leaders talk to each other?]]></title>            <description><![CDATA[A behind-the-scenes look at how phone calls get made between world leaders.]]></description>            <link>http://www.bbc.co.uk/news/world-us-canada-38202271</link>            <guid isPermaLink="true">http://www.bbc.co.uk/news/world-us-canada-38202271</guid>            <pubDate>Mon, 05 Dec 2016 15:31:46 GMT</pubDate>            <media:thumbnail width="976" height="549" url="http://c.files.bbci.co.uk/1134/production/_92840440_d581595d-3f12-4a78-b84d-bf77e2cd6f3d.jpg"/>        </item>        <item>            <title><![CDATA[Who will help Myanmar\'s Rohingya?]]></title>            <description><![CDATA[Myanmar\'s Rohingya have been described by the UN as "the most friendless people in the world".]]></description>            <link>http://www.bbc.co.uk/news/world-asia-38168917</link>            <guid isPermaLink="true">http://www.bbc.co.uk/news/world-asia-38168917</guid>            <pubDate>Mon, 05 Dec 2016 12:42:11 GMT</pubDate>            <media:thumbnail width="976" height="549" url="http://c.files.bbci.co.uk/643C/production/_92806652_gettyimages-626986446.jpg"/>        </item>        <item>            <title><![CDATA[What is the Article 50 case all about?]]></title>            <description><![CDATA[The BBC\'s legal affairs correspondent on the ins and outs of the government\'s Supreme Court appeal.]]></description>            <link>http://www.bbc.co.uk/news/uk-38183127</link>            <guid isPermaLink="true">http://www.bbc.co.uk/news/uk-38183127</guid>            <pubDate>Sun, 04 Dec 2016 02:25:23 GMT</pubDate>            <media:thumbnail width="976" height="549" url="http://c.files.bbci.co.uk/13470/production/_92806987_hi036652421.jpg"/>        </item>        <item>            <title><![CDATA[The beauty of Britain]]></title>            <description><![CDATA[The finalists of the 2016 Through the Lens photography awards discuss their images of the British Isles.]]></description>            <link>http://www.bbc.co.uk/news/in-pictures-38169436</link>            <guid isPermaLink="true">http://www.bbc.co.uk/news/in-pictures-38169436</guid>            <pubDate>Mon, 05 Dec 2016 01:30:10 GMT</pubDate>            <media:thumbnail width="976" height="549" url="http://c.files.bbci.co.uk/496E/production/_92789781_northernireland.jpg"/>        </item>        <item>            <title><![CDATA[Your pictures]]></title>            <description><![CDATA[Each week, we publish a gallery of readers\' pictures on a set theme. This week, we asked for your pictures on the theme "Lines".]]></description>            <link>http://www.bbc.co.uk/news/in-pictures-38169433</link>            <guid isPermaLink="true">http://www.bbc.co.uk/news/in-pictures-38169433</guid>            <pubDate>Thu, 01 Dec 2016 14:48:38 GMT</pubDate>            <media:thumbnail width="976" height="549" url="http://c.files.bbci.co.uk/C7EA/production/_92787115_843453.jpg"/>        </item>        <item>            <title><![CDATA[Africa\'s top shots: 25 November-1 December 2016]]></title>            <description><![CDATA[A selection of the best photos from across Africa this week.]]></description>            <link>http://www.bbc.co.uk/news/world-africa-38167836</link>            <guid isPermaLink="true">http://www.bbc.co.uk/news/world-africa-38167836</guid>            <pubDate>Fri, 02 Dec 2016 10:53:50 GMT</pubDate>            <media:thumbnail width="976" height="549" url="http://c.files.bbci.co.uk/7723/production/_92799403_epa_trampoline.jpg"/>        </item>        <item>            <title><![CDATA[Living near the Arctic Circle]]></title>            <description><![CDATA[Photographer Ed Gold\'s images from the remote community of Galena in Alaska, USA.]]></description>            <link>http://www.bbc.co.uk/news/in-pictures-35531727</link>            <guid isPermaLink="true">http://www.bbc.co.uk/news/in-pictures-35531727</guid>            <pubDate>Thu, 01 Dec 2016 01:06:07 GMT</pubDate>            <media:thumbnail width="802" height="451" url="http://c.files.bbci.co.uk/95EB/production/_92497383_andrewhuntington01.jpg"/>        </item>        <item>            <title><![CDATA[India v England: Eoin Morgan & Alex Hales return to ODI & T20 squads]]></title>            <description><![CDATA[Eoin Morgan and Alex Hales are named in England\'s ODI and T20 squads to face India, but Ben Duckett, James Vince and Steven Finn are dropped.]]></description>            <link>http://www.bbc.co.uk/sport/cricket/38206342</link>            <guid isPermaLink="true">http://www.bbc.co.uk/sport/cricket/38206342</guid>            <pubDate>Mon, 05 Dec 2016 17:55:02 GMT</pubDate>            <media:thumbnail width="1366" height="768" url="http://c.files.bbci.co.uk/FBA7/production/_92832446_englandduo.jpg"/>        </item>        <item>            <title><![CDATA[Manchester City and Chelsea charged over player behaviour]]></title>            <description><![CDATA[Manchester City and Chelsea are charged by the FA for failing to control their players during the Premier League game on Saturday.]]></description>            <link>http://www.bbc.co.uk/sport/football/38213922</link>            <guid isPermaLink="true">http://www.bbc.co.uk/sport/football/38213922</guid>            <pubDate>Mon, 05 Dec 2016 16:51:31 GMT</pubDate>            <media:thumbnail width="2048" height="1152" url="http://c.files.bbci.co.uk/11D40/production/_92842037_fernandhinofabregas_getty.jpg"/>        </item>        <item>            <title><![CDATA[Football child sex abuse claims: What has happened so far?]]></title>            <description><![CDATA[How the football child sex abuse scandal has grown since former player Andy Woodward first said he was a victim.]]></description>            <link>http://www.bbc.co.uk/sport/football/38211167</link>            <guid isPermaLink="true">http://www.bbc.co.uk/sport/football/38211167</guid>            <pubDate>Mon, 05 Dec 2016 17:14:02 GMT</pubDate>            <media:thumbnail width="1366" height="768" url="http://c.files.bbci.co.uk/5D92/production/_92645932_stewartwoodward.jpg"/>        </item>        <item>            <title><![CDATA[Fake embassy]]></title>            <description><![CDATA[An organised crime ring was giving out real US visas in Ghana\'s capital Accra for a decade - how did they get away with it for so long?]]></description>            <link>http://www.bbc.co.uk/news/world-africa-38209665</link>            <guid isPermaLink="true">http://www.bbc.co.uk/news/world-africa-38209665</guid>            <pubDate>Mon, 05 Dec 2016 17:59:03 GMT</pubDate>            <media:thumbnail width="625" height="352" url="http://c.files.bbci.co.uk/12E51/production/_92839377_fakeembassycreditstatedepartment.jpg"/>        </item>        <item>            <title><![CDATA[Latinos v Donald Trump]]></title>            <description><![CDATA[Millions have watched a film from Uruguay depicting Donald Trump as a robot at war with Mexicans.]]></description>            <link>http://www.bbc.co.uk/news/magazine-38186036</link>            <guid isPermaLink="true">http://www.bbc.co.uk/news/magazine-38186036</guid>            <pubDate>Mon, 05 Dec 2016 03:08:23 GMT</pubDate>            <media:thumbnail width="1280" height="720" url="http://c.files.bbci.co.uk/68E2/production/_92805862_trump2.jpg"/>        </item>        <item>            <title><![CDATA[Safe haven no more]]></title>            <description><![CDATA[Descendants of freed African slaves are fighting to save their traditional Gullah way of life and ancestral land in South Carolina.]]></description>            <link>http://www.bbc.co.uk/news/magazine-37994938</link>            <guid isPermaLink="true">http://www.bbc.co.uk/news/magazine-37994938</guid>            <pubDate>Mon, 05 Dec 2016 09:55:59 GMT</pubDate>            <media:thumbnail width="976" height="549" url="http://c.files.bbci.co.uk/BC15/production/_92494184_gullah2.jpg"/>        </item>        <item>            <title><![CDATA[Six generations]]></title>            <description><![CDATA[Delighted Canadian Vera Sommerfeld, 96, now heads a family with six generations all alive at once.]]></description>            <link>http://www.bbc.co.uk/news/world-us-canada-38201567</link>            <guid isPermaLink="true">http://www.bbc.co.uk/news/world-us-canada-38201567</guid>            <pubDate>Sun, 04 Dec 2016 21:36:04 GMT</pubDate>            <media:thumbnail width="976" height="549" url="http://c.files.bbci.co.uk/13472/production/_92826987_lethbridgefamily.jpg"/>        </item>        <item>            <title><![CDATA[\'Hunted down\']]></title>            <description><![CDATA[How one Afghan migrant woman was followed by her allegedly abusive husband to the gates of Europe.]]></description>            <link>http://www.bbc.co.uk/news/world-europe-38200087</link>            <guid isPermaLink="true">http://www.bbc.co.uk/news/world-europe-38200087</guid>            <pubDate>Mon, 05 Dec 2016 11:07:05 GMT</pubDate>            <media:thumbnail width="976" height="549" url="http://c.files.bbci.co.uk/5CC8/production/_92825732_hussain5.jpg"/>        </item>        <item>            <title><![CDATA[Gamechanger]]></title>            <description><![CDATA[By quitting while he is ahead, John Key has transformed New Zealand\'s political landscape, writes Colin James.]]></description>            <link>http://www.bbc.co.uk/news/world-asia-38205153</link>            <guid isPermaLink="true">http://www.bbc.co.uk/news/world-asia-38205153</guid>            <pubDate>Mon, 05 Dec 2016 05:31:28 GMT</pubDate>            <media:thumbnail width="976" height="549" url="http://c.files.bbci.co.uk/1688F/production/_92830329_keyreu.jpg"/>        </item>        <item>            <title><![CDATA[Fake it to make it]]></title>            <description><![CDATA[Many of the fake news websites that sprang up during the US election campaign have been traced to a small city in Macedonia, where teenagers are pumping out sensationalist stories to earn cash from advertising.]]></description>            <link>http://www.bbc.co.uk/news/magazine-38168281</link>            <guid isPermaLink="true">http://www.bbc.co.uk/news/magazine-38168281</guid>            <pubDate>Mon, 05 Dec 2016 02:43:17 GMT</pubDate>            <media:thumbnail width="976" height="549" url="http://c.files.bbci.co.uk/ECC3/production/_92811606_istock-519161938.jpg"/>        </item>        <item>            <title><![CDATA[Precious objects]]></title>            <description><![CDATA[People who have fled the war in Syria tell us what objects they carried with them when they left their homes.]]></description>            <link>http://www.bbc.co.uk/news/world-middle-east-38182738</link>            <guid isPermaLink="true">http://www.bbc.co.uk/news/world-middle-east-38182738</guid>            <pubDate>Mon, 05 Dec 2016 03:27:27 GMT</pubDate>            <media:thumbnail width="976" height="549" url="http://c.files.bbci.co.uk/74D7/production/_92811992_nizar2_bbc.jpg"/>        </item>        <item>            <title><![CDATA[Sleeping on toilet floors]]></title>            <description><![CDATA[How Chris Gardner went from sleeping rough with his young son on the floor of a public toilet to the life of a multi-millionaire investor.]]></description>            <link>http://www.bbc.co.uk/news/business-38144980</link>            <guid isPermaLink="true">http://www.bbc.co.uk/news/business-38144980</guid>            <pubDate>Mon, 05 Dec 2016 00:03:06 GMT</pubDate>            <media:thumbnail width="976" height="549" url="http://c.files.bbci.co.uk/52E7/production/_92732212_140208_chrisgardner_-106_original.jpg"/>        </item></channel></rss>';
  params.success($.parseXML(xml));
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="page-wrap">
  <div id="main-content">
    <div class="header"></div>
    <div id="output">
      <div id="title_div"></div>
    </div>
  </div>
</div>