如何从Rss中提取视频url?

如何从Rss中提取视频url?,rss,rss-reader,rome,Rss,Rss Reader,Rome,我正在阅读包含视频url的RSS提要。 我正在使用罗马,但没有成功地提取它。 下面是RSS提要xml,我正在尝试提取 我将感谢任何帮助 Rss源: <rss xmlns:media="http://search.yahoo.com/mrss/" version="2.0"> <channel> <title>Wochit - Top Stories</title> <link>http://www

我正在阅读包含视频url的RSS提要。 我正在使用罗马,但没有成功地提取它。 下面是RSS提要xml,我正在尝试提取 我将感谢任何帮助

Rss源:

<rss xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
    <channel>
        <title>Wochit - Top Stories</title>
        <link>http://www.wochit.com</link>
        <description>
            Features the latest breaking news videos from Wochit
        </description>
        <copyright>Copyright 2012, wochit.com</copyright>
        <language>en-us</language>
        <lastBuildDate>Mar 17, 2016 8:22:46 AM</lastBuildDate>
        <source>
            Rolling Stone Music, EOnline, The Guardian USnews, AP Entertainment, Mashable, Reuters Entertainment, AP US, The Hollywood Reporter, Reuters, The Daily Beast, Wired.com Tech, News 24, Buzzfeed US, MSNBC, CNN Entertainment, Geek.com, Reuters World, Rolling Stone News, The Hollywood Reporter - TV, Comic_book, CBS US News, Politico Picks, Fusion. net, Screen Rant
        </source>
        <item>
            <link>http://www.wochit.com/share-video/107249827</link>
            <guid>107249827</guid>
            <origin>
                <link>
                    http://www.cbsnews.com/videos/what-do-we-know-about-obamas-supreme-court-pick/
                </link>
                <title>Obama's Supreme Court Pick</title>
                <source>CBS US News</source>
            </origin>
            <pubDate>Mar 17, 2016 8:22:46 AM</pubDate>
            <media:description>
                President Obama has nominated Judge Merrick Garland as the nominee for the Supreme Court to replace the late Justice Antonin Scalia. Garland is a known and respected figure for environmental causes. He is considered a moderate as well. Obama demanded a fair hearing for Judge Garland and said that refusing to even consider his nomination would provoke “an endless cycle. The republican party and its senate members have vowed to disapprove of anyone the current president nominates.
            </media:description>
            <media:transcript>
                President Obama has nominated Judge Merrick Garland as the nominee for the Supreme Court to replace the late Justice Antonin Scalia. Garland is a known and respected figure for environmental causes. He is considered a moderate as well. Obama demanded a fair hearing for Judge Garland and said that refusing to even consider his nomination would provoke “an endless cycle. The republican party and its senate members have vowed to disapprove of anyone the current president nominates.
            </media:transcript>
            <media:backlink>
                http://api.wochit.com/api/linkback?VIDEO_GUID=107249827&sc=f2c3306810e1c7658ebfbad2d70a2c92cc6dcdae515ff5605a4b9b38a1361bac
            </media:backlink>
            <media:source>CBS US News</media:source>
            <embedCodeSnippet>
                <![CDATA[
                <script language='javascript' type='text/javascript' src='http://api.wochit.com/api/wochitplayer.js?code=eyJ2ZXJzaW9uIjoiMS4wIiwicGFydG5lcklkIjoiZjJjMzMwNjgxMGUxYzc2NThlYmZiYWQyZDcwYTJjOTJjYzZkY2RhZTUxNWZmNTYwNWE0YjliMzhhMTM2MWJhYyIsInByb2dyYW1tZXJOYW1lIjoid29jaGl0IiwidHlwZSI6IkNMSVBfSUQiLCJkYXRhIjoiMTA3MjQ5ODI3IiwicHJlZmVycmVkVmlkZW9GYW1pbHkiOiJIRCJ9&pid=f2c3306810e1c7658ebfbad2d70a2c92cc6dcdae515ff5605a4b9b38a1361bac&progn=wochit&autostart=false&width=640&height=360' data-wochit-uid='b0pciod062'></script>
                ]]>
            </embedCodeSnippet>
            <embedCodeIframe>
                <![CDATA[
                <iframe src="http://api.wochit.com/api/player?code=eyJ2ZXJzaW9uIjoiMS4wIiwicGFydG5lcklkIjoiZjJjMzMwNjgxMGUxYzc2NThlYmZiYWQyZDcwYTJjOTJjYzZkY2RhZTUxNWZmNTYwNWE0YjliMzhhMTM2MWJhYyIsInByb2dyYW1tZXJOYW1lIjoid29jaGl0IiwidHlwZSI6IkNMSVBfSUQiLCJkYXRhIjoiMTA3MjQ5ODI3IiwicHJlZmVycmVkVmlkZW9GYW1pbHkiOiJIRCJ9&pid=f2c3306810e1c7658ebfbad2d70a2c92cc6dcdae515ff5605a4b9b38a1361bac&progn=wochit&autostart=false&width=640&height=360" frameBorder="0" style="overflow:hidden" scrolling="no" height="360" width="640"></iframe>
                ]]>
            </embedCodeIframe>
            <media:vidAssetPart>34</media:vidAssetPart>
            <media:text>
                Contact your |local office| for all commercial or promotional uses. Full editorial rights UK, US, Ireland, Canada (not Quebec). Restricted editorial rights for daily newspapers elsewhere, please call. A MAY 1, 2008, FILE PHOTO Broadcasters: NO ACCESS USA/NO ACCESS CNN Digital: FOR BROADCAST CLIENT USE ONLY/NO ACCESS INTERNET/MOBILE/WIRELESS . For Reuters customers only.
            </media:text>
            <media:category>Law & Crime</media:category>
            <media:category>News</media:category>
            <description>
                President Obama has nominated Judge Merrick Garland as the nominee for the Supreme Court to replace the late Justice Antonin Scalia. Garland is a known and respected figure for environmental causes. He is considered a moderate as well. Obama demanded a fair hearing for Judge Garland and said that refusing to even consider his nomination would provoke “an endless cycle. The republican party and its senate members have vowed to disapprove of anyone the current president nominates.
            </description>
            <media:keywords>...</media:keywords>
            <media:thumbnail url="http://wochitprod3-a.akamaihd.net/artifacts/headlines/singlePlus/107249827/107249827-1280x720_1_Mar_17_2016_13_22_15_poster.jpg"/>
            <title>Obama's Supreme Court Pick</title>
            <media:content medium="VIDEO" channels="2" bitrate="3072.0" duration="43" expression="full" fileSize="14985855" framerate="0.0" height="720" lang="en" samplingrate="44100.0" type="video/mp4" width="1280" isDefault="true" url="http://wochitprod3-a.akamaihd.net/artifacts/headlines/singlePlus/107249827/107249827-1280x720_Mar_17_2016_13_22_15.MP4?sc=f2c3306810e1c7658ebfbad2d70a2c92cc6dcdae515ff5605a4b9b38a1361bac"/>
        </item>
    </channel>
</rss>

沃奇特-顶级故事
http://www.wochit.com
以Wochit的最新突发新闻视频为特色
版权所有2012,wochit.com
美国英语
2016年3月17日上午8:22:46
滚石音乐、EOnline、卫报美国新闻、美联社娱乐、Mashable、路透社娱乐、美联社美国、好莱坞记者、路透社、每日野兽、Wired.com技术、新闻24、Buzzfeed美国、MSNBC、CNN娱乐、Geek.com、路透社世界、滚石新闻、好莱坞记者-电视、漫画书、CBS美国新闻、政治精选、融合。网
http://www.wochit.com/share-video/107249827
107249827
http://www.cbsnews.com/videos/what-do-we-know-about-obamas-supreme-court-pick/
奥巴马的最高法院人选
哥伦比亚广播公司美国新闻
2016年3月17日上午8:22:46
奥巴马总统提名梅里克·加兰法官为最高法院的提名人,接替已故的安东宁·斯卡利亚法官。加兰是一位著名的、受人尊敬的环保人物。他也被认为是温和派。奥巴马要求公正的听证会,Garland法官说,拒绝甚至考虑他的提名将引发“无休止的循环”。共和党及其参议院成员发誓不赞成任何人现任总统提名。
奥巴马总统提名Merrick Garland法官为最高法院提名接替已故法官Antonin Scalia。Garland是一位著名的、受人尊敬的环境因素。他被认为是一个温和的人。奥巴马要求给Garland法官一个公平的听证会,并说拒绝考虑他的提名会证明。这是一个无休止的循环。共和党及其参议院成员发誓不批准现任总统提名的任何人。
http://api.wochit.com/api/linkback?VIDEO_GUID=107249827&sc=f2c3306810e1c7658ebfbad2d70a2c92cc6dcdae515ff5605a4b9b38a1361bac
哥伦比亚广播公司美国新闻
]]>
]]>
34
有关所有商业或宣传用途,请联系您的|当地办事处。英国、美国、爱尔兰、加拿大(非魁北克省)的完整编辑权。其他地方日报的编辑权限受限,请致电。A 2008年5月1日,文件照片广播公司:禁止访问美国/禁止访问CNN数字:仅供广播客户端使用/禁止访问互联网/移动/无线。仅供路透社客户使用。
法律与犯罪
新闻
奥巴马总统提名Merrick Garland法官为最高法院提名接替已故法官Antonin Scalia。Garland是一位著名的、受人尊敬的环境因素。他被认为是一个温和的人。奥巴马要求给Garland法官一个公平的听证会,并说拒绝考虑他的提名会证明。这是一个无休止的循环。共和党及其参议院成员发誓不批准现任总统提名的任何人。
...
奥巴马的最高法院人选
到目前为止,该代码运行良好:

SyndFeed feed = null;
                try {
                    logger.info("Building feed for Url: " + feedUrl);
                    feed = new SyndFeedInput().build(reader);
                } catch (Exception e2) {
                    logger.error(e2);
                } finally {
                    try {
                        if (reader != null) {
                            reader.close();
                        }
                    } catch (IOException e) {
                        logger.error(e);
                    }
                }

                if (feed != null) {
                    logger.info("Feed from " + feedUrl + " is not null, total of " + feed.getEntries().size() + " entries");
                    String feedTitle = feed.getTitle();

                    for (Object entryObj : feed.getEntries()) {
                        SyndEntryImpl entry = (SyndEntryImpl) entryObj;
                        String author = entry.getAuthor();

                        String uri = entry.getUri();
                        logger.info("reading object from feed " + uri);
                        String description = "";
                        if (entry.getDescription() != null) {
                            description = entry.getDescription().getValue();
                        }
                        String title = entry.getTitle();
                        Date publishedDate = entry.getPublishedDate();
                        List<?> categoryList = entry.getCategories();

                        String transcript = null;
                        List<Element> foreignMarkup = (List<Element>) entry.getForeignMarkup();
                        if (foreignMarkup != null && foreignMarkup.size() > 0) {
                            for (Element element : foreignMarkup) {
                                //get name
                                String name = element.getName();
                                if (name != null && name.equals("transcript")) {
                                    transcript = element.getText();
                                }
                            }
                        }
                        String link = entry.getLink();
                        Date currentTime = Calendar.getInstance().getTime();

                        String categoryStr = "";

                        for (Object category : categoryList) {
                            SyndCategory sc = (SyndCategory) category;
                            categoryStr += sc.getName() + ",";
                        }

                        //HERE IS THE INSERTION TO THE DB
                    }

                    logger.info("End reading from feed " + feedUrl);
                }
SyndFeed feed=null;
试一试{
info(“为Url构建提要:”+feedUrl);
feed=newsyndfeedinput().build(读取器);
}捕获(异常e2){
记录器错误(e2);
}最后{
试一试{
if(读卡器!=null){
reader.close();
}
}捕获(IOE异常){
错误(e);
}
}
if(feed!=null){
logger.info(“来自“+feedUrl+”的提要不为空,总共有“+Feed.getEntries().size()+”个条目”);
字符串feedTitle=feed.getTitle();
对于(对象entryObj:feed.getEntries()){
SyndEntryImpl条目=(SyndEntryImpl)entryObj;
字符串author=entry.getAuthor();
字符串uri=entry.getUri();
logger.info(“从提要读取对象”+uri);
字符串说明=”;
if(entry.getDescription()!=null){
description=entry.getDescription().getValue();
}
String title=entry.getTitle();
Date publishedDate=entry.getPublishedDate();
List categoryList=entry.getCategories();
字符串转录本=null;
List foreignMarkup=(List)entry.getForeignMarkup();
if(foreignMarkup!=null&&foreignMarkup.size()>0){
for(元素:foreignMarkup){
//得名
字符串名称=element.getName();
如果(name!=null&&name.equals(“转录本”)){
transcript=element.getText();
}
}
}
String link=entry.getLink();
Date currentTime=Calendar.getInstance().getTime();
String backlink = null;
for (Element foreignMarkup : entry.getForeignMarkup()) {
    if (foreignMarkup.getNamespaceURI().equals("http://search.yahoo.com/mrss/")) {
        if (foreignMarkup.getName().equals("backlink")) {
            backlink = foreignMarkup.getValue();
        }
    }
}
for (Module module : entry.getModules()) {
    if (module instanceof MediaEntryModule) {
        MediaEntryModule media = (MediaEntryModule)module;
        for (MediaContent mediaContent : media.getMediaContents()) {
            System.out.println(mediaContent.getReference());
        }               
    }
}