怎么使用正则表达式从新浪天气网抓取5天的天气数据
展开全部
0
用firebug跟了一下新浪天气网,可以到这个地址下抓下天气,自己解析下返回的js代码好了。
地址:http://php.weather.sina.com.cn/iframe/index/w_cl.php?day=4&city=%C4%CF%BE%A9&dfc=1
返回内容:
(function(){var w=[];w['南京']=[{s1:'晴',s2:'晴',f1:'qing',f2:'qing',t1:'18',t2:'6',p1:'4-5',p2:'3-4',d1:'东北风',d2:'东南风'},{s1:'晴',s2:'晴',f1:'qing',f2:'qing',t1:'20',t2:'7',p1:'3-4',p2:'3-4',d1:'东南风',d2:'东南风'},{s1:'晴',s2:'晴',f1:'qing',f2:'qing',t1:'21',t2:'10',p1:'4-5',p2:'3-4',d1:'东南风',d2:'东南风'},{s1:'多云',s2:'阴',f1:'duoyun',f2:'yin',t1:'23',t2:'9',p1:'3-4',p2:'4-5',d1:'东北风',d2:'东北风'},{s1:'小雨',s2:'',f1:'xiaoyu',f2:'',t1:'14',t2:'',p1:'4-5',p2:'≤3',d1:'东北风',d2:''}];var add={now:'2011-03-29 16:45:30',time:'1301388330',update:'北京时间03月29日08:00更新',error:'0',total:'1'};window.SWther={w:w,add:add};})();//0
用firebug跟了一下新浪天气网,可以到这个地址下抓下天气,自己解析下返回的js代码好了。
地址:http://php.weather.sina.com.cn/iframe/index/w_cl.php?day=4&city=%C4%CF%BE%A9&dfc=1
返回内容:
(function(){var w=[];w['南京']=[{s1:'晴',s2:'晴',f1:'qing',f2:'qing',t1:'18',t2:'6',p1:'4-5',p2:'3-4',d1:'东北风',d2:'东南风'},{s1:'晴',s2:'晴',f1:'qing',f2:'qing',t1:'20',t2:'7',p1:'3-4',p2:'3-4',d1:'东南风',d2:'东南风'},{s1:'晴',s2:'晴',f1:'qing',f2:'qing',t1:'21',t2:'10',p1:'4-5',p2:'3-4',d1:'东南风',d2:'东南风'},{s1:'多云',s2:'阴',f1:'duoyun',f2:'yin',t1:'23',t2:'9',p1:'3-4',p2:'4-5',d1:'东北风',d2:'东北风'},{s1:'小雨',s2:'',f1:'xiaoyu',f2:'',t1:'14',t2:'',p1:'4-5',p2:'≤3',d1:'东北风',d2:''}];var add={now:'2011-03-29 16:45:30',time:'1301388330',update:'北京时间03月29日08:00更新',error:'0',total:'1'};window.SWther={w:w,add:add};})();//0
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询