首页 > 解决方案 > 如何阅读 FIFA/ESPN 的 RSS 提要?

问题描述

我以前在我的 android 应用程序中使用过Cric Info RSS 。我知道如何使用 XmlPullParser 从标签(链接、描述、标题)中读取 RSS 提要。

但是,现在我想在我的应用程序中集成FIFA RSSESPN RSS以获取足球新闻,我看不到可以用来过滤所需数据的标签。

如何从这些提供原始 XML 的资源中获取数据?任何帮助,将不胜感激。谢谢!

标签: androidxmlrss

解决方案


我收到了来自国际足联 RSS 网址的标签的回复。也许浏览器正在为您解析它而您看不到它们?在您的终端/控制台上运行此 curl 请求并检查响应

curl -v \
-H "Accept-Language: en-US;q=1.0, es-419;q=0.9, en;q=0.8" \
-H "User-Agent: Russia2018/2.1 (com.looping.gameon; build:7; iOS 11.3.0) Alamofire/4.7.0" \
-H "Accept-Encoding: gzip;q=1.0, compress;q=0.5" \
"http://es.fifa.com/worldcup/news/rss.xml"

我得到了类似的东西:

<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title><![CDATA[FIFA.com - Copa Mundial de la FIFA Rusia 2018 - Noticias]]></title><link>http://es.fifa.com/index.html</link><language>es</language><copyright>Copyright© 1994 - 2018 FIFA. Reservados todos los derechos</copyright><description>Visite FIFA.com para acceder a todas las noticias, entrevistas y el gran debate del fútbol mundial. </description><pubDate>Mon, 23 Apr 2018 16:28:00 GMT</pubDate><lastBuildDate>Fri, 27 Apr 2018 20:13:13 GMT</lastBuildDate><category>FIFA.com</category><image><title><![CDATA[FIFA.com - Copa Mundial de la FIFA Rusia 2018 - Noticias]]></title><url>//img.fifa.com/imgml/rssheader.gif</url><link>http://es.fifa.com/index.html</link><width>139</width><height>28</height><description>rssFifa</description></image><atom:link href="http://es.fifa.com/worldcup/news/rss.xml" rel="self" type="application/rss+xml" /><item><guid isPermaLink="false">1524859338044</guid><title><![CDATA[La Gira del Trofeo llega a Japón]]></title><link>http://es.fifa.com/worldcup/news/y=2018/m=4/news=la-gira-del-trofeo-llega-a-japon-2945044.html</link><description>&lt;p&gt;El avión que ha llevado el trofeo por todo el planeta despegó para realizar su penúltimo vuelo el 27 de abril, desde la RP China, para recalar en Tokio. Japón es el último país que visitará en la fase global.&lt;/p&gt;

格林威治标准时间 2018 年 4 月 27 日星期五 11:27:00....


推荐阅读