使用Google新闻RSS URL时,如何指定检索本地新闻? [英] How do you specify retrieving local news when using a Google News RSS URL?

查看:65
本文介绍了使用Google新闻RSS URL时,如何指定检索本地新闻?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试构建一个使用Google新闻RSS的RSS解析器.我只需定位以下URL就可以从新闻URL中检索新闻文章:

I am trying to build an RSS parser that users Google News RSS. I am able to retrieve news articles from the news URL just by targeting the following URL:

https://news.google.com/news/section?output=rss

但是,在google新闻页面上,可以选择它们来检索您当前位置附近的新闻.浏览器中的该URL为:

However, on the google news page their is an option to retrieve news near your current location. This URL in the browser is:

https://news.google.com/news/section?geo=detect_metro_area

仅添加output = rss查询字符串参数不足以以RSS格式返回本地新闻.相反,我得到的响应几乎是空的:

Just adding the output=rss query string parameter is not enough to return the local news in RSS format. Instead, I get a pretty much empty response:

<rss version="2.0">
<channel>
<generator>NFE/1.0</generator>
<title>News near you - Google News</title>
<link>
http://news.google.com/news?pz=1&ned=us&hl=en&geo=detect_metro_area
</link>
<language>en</language>
<webMaster>news-feedback@google.com</webMaster>
<copyright>&copy;2012 Google</copyright>
<pubDate>Tue, 20 Nov 2012 19:32:04 GMT</pubDate>
<lastBuildDate>Tue, 20 Nov 2012 19:32:04 GMT</lastBuildDate>
<image>
<title>News near you - Google News</title>
<url>
https://ssl.gstatic.com/news/img/logo/en_us/news.gif
</url>
<link>
http://news.google.com/news?pz=1&ned=us&hl=en&geo=detect_metro_area
</link>
</image>
<description>Google News</description>
</channel>
</rss>

有人知道他们是否可以从此RSS feed获得地理上与您最近的新闻吗?

Does anyone know if their is a way to get news that is near you geographically from this RSS feed?

推荐答案

据我所知,由于网站需要使用设备上机制或登录用户自动确定您的位置,因此您需要确定自己的身份帐户.但是,如果您想根据包含某个城市或地区的新闻进行查询,则可以对纽约进行类似的操作.如果将这些功能与设备上的某些地理位置功能结合在一起,那么您应该能够获得想要的新闻.

As far as I can tell you will need to determine that your self since the website is required to automatically determine your location using an on device mechanism or logged in user account. However if you would like to query based on news containing a city or area you could do something like this for New York. If you combine that for some on device geo location functions then you should be able to get news for what you would like.

https://news.google.com/news/section?output = rss& q = New%20York

这篇关于使用Google新闻RSS URL时,如何指定检索本地新闻?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆