Google天气和股票API
来源:互联网 发布:linux ls是什么缩写 编辑:程序博客网 时间:2024/04/27 14:56
实时股票
Google 的数据
1. 实时数据 http://www.google.com/ig/api?h1=zh-CN&stock=600001
2.K线图 http://www.google.cn/finance/getchart?q=600336&x=SHA&p=5d&i=240 http://www.google.com/finance/chart?q=SHA:600001&tlf=12
3. 补全信息 "http://www.google.cn/finance/match?matchtype=matchall&q=600".
Yahoo 的数据
1. 实时数据 http://download.finance.yahoo.com/d/quotes.csv?s=600336.SS&f=sl1d1t1c1ohgv&e=.csv
2. K线图 http://ichart.finance.yahoo.com/t?s=600036.ss
3. K线图数据 http://chartapi.finance.yahoo.com/instrument/1.0/000001.ss/chartdata;type=quote;range=3m
天气预报
Google Weather API 只支持美国地区使用邮政编码进行查询,例如: http://www.google.com/ig/api?hl=zh-cn&weather=94043 (94043 为 山景城, 美国加州 的邮政编码) 而除了美国以外的地区需要使用经纬度坐标作为参数才能执行 Google Weather API, 例如: http://www.google.com/ig/api?hl=zh-cn&weather=,,,30670000,104019996 (30670000,104019996 为 成都, 中国大陆 的经纬度坐标)
当然,也可能通行城市名称的汉语拼音来查询,例如:以下是北京的天气
http://www.google.com/ig/api?weather=Beijing
要其它地区的经纬度坐标,可以通过 Google API 提供的国家代码列表及相应的城市经纬度坐标列表可以查询到,以下是 Google API 提供的查询参数: http://www.google.com/ig/countries?output=xml&hl=zh-cn (查询 Google 所支持的所有国家的代码,并以 zh-cn 简体中文显示) http://www.google.com/ig/cities?output=xml&hl=zh-cn&country=cn
Google Weather API 只支持美国地区使用邮政编码进行查询,例如: http://www.google.com/ig/api?hl=zh-cn&weather=94043 (94043 为 山景城, 美国加州 的邮政编码) 而除了美国以外的地区需要使用经纬度坐标作为参数才能执行 Google Weather API, 例如: http://www.google.com/ig/api?hl=zh-cn&weather=,,,30670000,104019996 (30670000,104019996 为 成都, 中国大陆 的经纬度坐标)
当然,也可能通行城市名称的汉语拼音来查询,例如:以下是北京的天气
http://www.google.com/ig/api?weather=Beijing
要其它地区的经纬度坐标,可以通过 Google API 提供的国家代码列表及相应的城市经纬度坐标列表可以查询到,以下是 Google API 提供的查询参数: http://www.google.com/ig/countries?output=xml&hl=zh-cn (查询 Google 所支持的所有国家的代码,并以 zh-cn 简体中文显示) http://www.google.com/ig/cities?output=xml&hl=zh-cn&country=cn
C#范例:
using System; using System.Collections.Generic; using System.Text; using System.Xml; using System.Net;
///Code by Roman Alifanov - API by Google ///Posted on http://animaonline.blogspot.com namespace GoogleWeatherAPI_Parser { class Program { static void Main(string[] args)
{ int i = 0;
XmlNodeList GWP_NodeList = GoogleWeatherAPI_Parser(@"http://www.google.co.uk/ig/api?weather=Drammen").SelectNodes("xml_api_reply/weather/current_conditions"); Console.WriteLine("Current weather in Drammen: " + GWP_NodeList.Item(i).SelectSingleNode("temp_c").Attributes["data"].InnerText); Console.ReadLine(); }
private static XmlDocument GoogleWeatherAPI_Parser(string baseUrl)
{ HttpWebRequest GWP_Request;
HttpWebResponse GWP_Response = null;
XmlDocument GWP_XMLdoc = null;
try
{ GWP_Request = (HttpWebRequest)WebRequest.Create(string.Format(baseUrl)); GWP_Request.UserAgent = @"Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4"; GWP_Response = (HttpWebResponse)GWP_Request.GetResponse();
GWP_XMLdoc = new XmlDocument();
GWP_XMLdoc.Load(GWP_Response.GetResponseStream()); }
catch (Exception ex)
{ Console.WriteLine(ex.Message); }
GWP_Response.Close();
return GWP_XMLdoc; }
} }
附:其它天气API
Yahoo:http://developer.yahoo.com/weather/
北京天气(可以通过搜索查找)
http://xml.weather.yahoo.com/forecastrss?p=CHXX0008&u=f
国内API:
北京天气
http://weather.all2rss.com/weatherrss.asp?City=北京
- Google天气和股票API
- google 天气免费api
- google api 得到 天气
- google weather api 谷歌天气api
- 利用google天气api获取最近的天气
- Google天气API在RCP中的应用
- Ruby实现Google Api天气查询
- Google weather API 天气使用方式
- 一个基于Excel VBA和Google API的股票报价表格
- android天气预报----google开源天气API,SAX解析
- jQuery+google weather API轻松实现天气地图(二)
- android天气预报----google开源天气API,SAX解析
- android天气预报widget----google开源天气API,SAX解析
- 天气Api
- 天气API
- 天气 API
- 天气api
- 天气API
- WebSocket服务器端解决方案
- ECMAScript 中for..in 语句和for each..in 语句 (javascript, actionscript都适用)
- 图像处理与模式识别之网络资源
- IPad 项目会议一总结(草记)
- 学习windows下的Emacs
- Google天气和股票API
- makefile学习五
- Java设计模式(一)
- 一种用户小体验 - 从那里来就回到那里去
- aa
- 浅谈项目管理角色在应用软件开发中的重要性
- vi 操作指南
- 用汇编的眼光看C++(之缺省模板、特化模板)
- 软件系统的4大技术本质