【数据分析】网页数据提取
huojunan22016/03/14软件综合 IP:北京
最近需要用到XXXXXXXXXXXXXXXXXXXXXX/里的左侧菜单栏的监测曲线里的PM2.5数据,
1.jpg
之前都是逐个手工输入excel,遇到数据量大的时候就很费时费力了,而且页面会定时刷新,刷新后需要重新设定检索时间段,非常麻烦,所以希望能从网页中提取出不同时间点下的PM2.5数据。

先试了excel的数据导入,但是显示不了窗口,
2.jpg


但是可以输出SVG文件,右键可以查看源代码,用SVGdeveloper确定了坐标轴和数据点对应的代码,但是理解不了,烦请各位大侠给讲讲,下面是2016年3月13日00:00时单点SVG对应的代码
3.jpg


[blockquote]<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "XXXXXXXXXXXXXXXXX/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns:xlink="XXXXXXXXXXXXXXXXX/1999/xlink" version="1.1" xmlns="XXXXXXXXXXXXXXXXX/2000/svg" width="600" height="400">
        <desc>Created with Highcharts 3.0.9</desc>
        <defs>
                <clipPath id="highcharts-52">
                        <rect fill="none" x="0" y="0" width="511" height="309"></rect>
                </clipPath>
        </defs>
        <rect rx="0" ry="0" fill="#FFFFFF" x="0" y="0" width="600" height="400"></rect>
        <g class="highcharts-grid"></g>
        <g class="highcharts-grid">
                <path fill="none" d="M 69 57.5 L 580 57.5" stroke="#C0C0C0" stroke-width="1" opacity="1"></path>
                <path fill="none" d="M 69 135.5 L 580 135.5" stroke="#C0C0C0" stroke-width="1" opacity="1"></path>
                <path fill="none" d="M 69 213.5 L 580 213.5" stroke="#C0C0C0" stroke-width="1" opacity="1"></path>
                <path fill="none" d="M 69 290.5 L 580 290.5" stroke="#C0C0C0" stroke-width="1" opacity="1"></path>
                <path fill="none" d="M 69 367.5 L 580 367.5" stroke="#C0C0C0" stroke-width="1" opacity="1"></path>
        </g>
        <g class="highcharts-axis">
                <path fill="none" d="M 324.5 367 L 324.5 372" stroke="#C0D0E0" stroke-width="1" opacity="1"></path>
                <path fill="none" d="M 69 367.5 L 580 367.5" stroke="#C0D0E0" stroke-width="1" visibility="visible"></path>
        </g>
        <g class="highcharts-axis">
                <text x="28.25" y="212.5" style="font-family:'lucida grande', 'lucida sans unicode', verdana, arial, helvetica, sans-serif;font-size:12px;color:<a href=" p="" 4?redirect="true"" target="_blank">#4d759e;font-weight:bold;fill:#4d759e;" text-anchor="middle" transform="translate(0,0) rotate(270 28.25 212.5)" visibility="visible"> </text>
                        <tspan x="28.25">PM2.5(ug/m3)</tspan>
                </text>
        </g>
        <g class="highcharts-series-group">
                <g class="highcharts-series" visibility="visible" transform="translate(69,58) scale(1 1)" clip-path="url(#highcharts-52)">
                        <path fill="none" d="M 245.5 71.07000000000002 L 265.5 71.07000000000002" stroke-linejoin="round" visibility="visible" stroke-opacity="0.0001" stroke="rgb(192,192,192)" stroke-width="22" class=" highcharts-tracker"></path>
                </g>
                <g class="highcharts-markers highcharts-tracker" visibility="visible" transform="translate(69,58) scale(1 1)" clip-path="none">
                        <path fill="<a href=" p="" 2?redirect="true"" target="_blank">#2f7ed8" d="M 255 67.07000000000002 C 260.328 67.07000000000002 260.328 75.07000000000002 255 75.07000000000002 C 249.672 75.07000000000002 249.672 67.07000000000002 255 67.07000000000002 Z"></path>
                </g>
        </g>
        <text x="295" y="25" style="font-family:'lucida grande', 'lucida sans unicode', verdana, arial, helvetica, sans-serif;font-size:16px;color:<a href=" p="" 274?redirect="true"" target="_blank">#274b6d;fill:#274b6d;" text-anchor="middle" class="highcharts-title"> </text>
                <tspan x="295">北京PM2.5小时变化趋势</tspan>
        </text>
        <text x="295" y="40" style="font-family:'lucida grande', 'lucida sans unicode', verdana, arial, helvetica, sans-serif;font-size:12px;color:<a href=" p="" 4?redirect="true"" target="_blank">#4d759e;fill:#4d759e;" text-anchor="middle" class="highcharts-subtitle"> </text>
                <tspan x="295">最小值:154  平均值:154.0  最大值:154</tspan>
        </text>
        <g class="highcharts-axis-labels">
                <text x="324.5" y="381" style="font-family:'lucida grande', 'lucida sans unicode', verdana, arial, helvetica, sans-serif;font-size:11px;color:<a href=" p="" 666?redirect="true"" target="_blank">#666;cursor:default;fill:#666;" text-anchor="middle" opacity="1"> </text>
                        <tspan x="324.5">03-13</tspan>
                </text>
        </g>
        <g class="highcharts-axis-labels">
                <text x="61" y="370" style="font-family:'lucida grande', 'lucida sans unicode', verdana, arial, helvetica, sans-serif;font-size:11px;color:<a href=" p="" 666?redirect="true"" target="_blank">#666;cursor:default;fill:#666;" text-anchor="end" opacity="1"> </text>
                        <tspan x="61">0</tspan>
                </text>
                <text x="61" y="292.75" style="font-family:'lucida grande', 'lucida sans unicode', verdana, arial, helvetica, sans-serif;font-size:11px;color:<a href=" p="" 666?redirect="true"" target="_blank">#666;cursor:default;fill:#666;" text-anchor="end" opacity="1"> </text>
                        <tspan x="61">50</tspan>
                </text>
                <text x="61" y="215.5" style="font-family:'lucida grande', 'lucida sans unicode', verdana, arial, helvetica, sans-serif;font-size:11px;color:<a href=" p="" 666?redirect="true"" target="_blank">#666;cursor:default;fill:#666;" text-anchor="end" opacity="1"> </text>
                        <tspan x="61">100</tspan>
                </text>
                <text x="61" y="138.25" style="font-family:'lucida grande', 'lucida sans unicode', verdana, arial, helvetica, sans-serif;font-size:11px;color:<a href=" p="" 666?redirect="true"" target="_blank">#666;cursor:default;fill:#666;" text-anchor="end" opacity="1"> </text>
                        <tspan x="61">150</tspan>
                </text>
                <text x="61" y="61" style="font-family:'lucida grande', 'lucida sans unicode', verdana, arial, helvetica, sans-serif;font-size:11px;color:<a href=" p="" 666?redirect="true"" target="_blank">#666;cursor:default;fill:#666;" text-anchor="end" opacity="1"> </text>
                        <tspan x="61">200</tspan>
                </text>
        </g>
        <g class="highcharts-tooltip" style="cursor:default;padding:0;white-space:nowrap;" transform="translate(0,-999)">
                <rect rx="3" ry="3" fill="none" x="0.5" y="0.5" width="16" height="16" fill-opacity="0.85" stroke="black" stroke-opacity="0.049999999999999996" stroke-width="5" transform="translate(1, 1)"></rect>
                <rect rx="3" ry="3" fill="none" x="0.5" y="0.5" width="16" height="16" fill-opacity="0.85" stroke="black" stroke-opacity="0.09999999999999999" stroke-width="3" transform="translate(1, 1)"></rect>
                <rect rx="3" ry="3" fill="none" x="0.5" y="0.5" width="16" height="16" fill-opacity="0.85" stroke="black" stroke-opacity="0.15" stroke-width="1" transform="translate(1, 1)"></rect>
                <rect rx="3" ry="3" fill="rgb(255,255,255)" x="0.5" y="0.5" width="16" height="16" fill-opacity="0.85"></rect>
                <text x="8" y="21" style="font-family:'lucida grande', 'lucida sans unicode', verdana, arial, helvetica, sans-serif;font-size:12px;color:<a href=" p="" 333333?redirect="true"" target="_blank">#333333;fill:#333333;"></text>
        </g>
        <text x="519" y="43" xml:space="preserve" font-family="Microsoft YaHei UI" font-size="12" fill="#FFFFFF" stroke="none" stroke-opacity="0" ></text>
</svg>
[/blockquote]下面这些是坐标轴的
[blockquote]<g class="highcharts-grid" ><path fill="none" d="M 69 57.5 L 580 57.5" stroke="#C0C0C0" stroke-width="1"  opacity="1">
</path><path fill="none" d="M 69 135.5 L 580 135.5" stroke="#C0C0C0" stroke-width="1"  opacity="1">
    
</path><path fill="none" d="M 69 213.5 L 580 213.5" stroke="#C0C0C0" stroke-width="1"  opacity="1">
    
</path><path fill="none" d="M 69 290.5 L 580 290.5" stroke="#C0C0C0" stroke-width="1"  opacity="1">
    
</path><path fill="none" d="M 69 367.5 L 580 367.5" stroke="#C0C0C0" stroke-width="1"  opacity="1"></path></g>[/blockquote]这个是坐标点的代码:
[blockquote]<path fill="<a href=" p="" 2?redirect="true"" target="_blank">#2f7ed8" d="M 255 67.07000000000002 C 260.328 67.07000000000002 260.328 75.07000000000002 255 75.07000000000002 C 249.672 75.07000000000002 249.672 67.07000000000002 255 67.07000000000002 Z">[/blockquote]</path>分析到这里时间格式和PM2.5浓度搞不出来,恳请各位大侠相助,谢谢 4.jpg
来自:计算机科学 / 软件综合
15
已屏蔽 原因:{{ notice.reason }}已屏蔽
{{notice.noticeContent}}
~~空空如也
novakon
8年9个月前 IP:广东
812418
方法不对。
定时刷新利用的是浏览器端JS访问服务器API拉取数据,然后数据在本地通过JS绘图。
楼主找到此API后,用wget/curl/.NET的webclient拉取,才是正道。
引用
评论
加载评论中,请稍候...
200字以内,仅用于支线交流,主线讨论请采用回复功能。
折叠评论
amo
8年9个月前 IP:浙江
812427
可以找一个XML解析的示例程序研究看看怎么提取特定元素……
引用
评论
加载评论中,请稍候...
200字以内,仅用于支线交流,主线讨论请采用回复功能。
折叠评论
zx-16533
8年9个月前 IP:广东
812453
可以从 XXXXXXXXXXXXXXXXXXXXXX/api/getdata_XXXXXXXXXXXXXp 这里获得数据
用post方法向这个地址传送以下参数:
city:"5p2t5bee"             //"杭州"的base64编码
type:"SE9VUg=="           //"HOUR"的base64编码
startTime:"MjAxNi0wMy0xMyAyMDowMDowMA=="                   //开始时间2016-03-13 20:00:00的编码    
endTime:"MjAxNi0wMy0xNCAyMzowMDowMA=="                     //结束时间2016-03-14 23:00:00的编码
然后页面返回数据:
ZXlKMGIzUmhiQ0k2TWpjc0luSnZkM01pT2x0N0luUnBiV1VpT2lJeU1ERTJMVEF6TFRFeklESXdPakF3T2pBd0lpd2lZWEZwSWpvaU1UazJJaXdpY0cweVh6VWlPaUl4TkRjaUxDSndiVEV3SWpvaU1qRTNJaXdpWTI4aU9pSXhMalV3TVNJc0ltNXZNaUk2SWpjM0xqQXdNQ0lzSW04eklqb2lNelV1TURBd0lpd2ljMjh5SWpvaU16QXVNREF3SWl3aWNtRnVheUk2SWpNMU1TSjlMSHNpZEdsdFpTSTZJakl3TVRZdE1ETXRNVE1nTWpFNk1EQTZNREFpTENKaGNXa2lPaUl4T0RVaUxDSndiVEpmTlNJNklqRXpPU0lzSW5CdE1UQWlPaUl5TURZaUxDSmpieUk2SWpFdU1qazNJaXdpYm04eUlqb2lOall1TURBd0lpd2liek1pT2lJek5pNHdNREFpTENKemJ6SWlPaUl5Tnk0d01EQWlMQ0p5WVc1cklqb2lNel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JwYldVaU9pSXlNREUyTFRBekxURTBJREl3T2pBd09qQXdJaXdpWVhGcElqb2lNVFEzSWl3aWNHMHlYelVpT2lJeE1USWlMQ0p3YlRFd0lqb2lNVFk0SWl3aVkyOGlPaUl3TGpreE5DSXNJbTV2TWlJNklqYzBMakF3TUNJc0ltOHpJam9pT1RBdU1EQXdJaXdpYzI4eUlqb2lNVFl1TURBd0lpd2ljbUZ1YXlJNklqTXpOaUo5TEhzaWRHbHRaU0k2SWpJd01UWXRNRE10TVRRZ01qRTZNREE2TURBaUxDSmhjV2tpT2lJeE5ETWlMQ0p3YlRKZk5TSTZJakV3T1NJc0luQnRNVEFpT2lJeE5qa2lMQ0pqYnlJNklqQXVPVEV3SWl3aWJtOHlJam9pTnpBdU1EQXdJaXdpYnpNaU9pSTNPUzR3TURBaUxDSnpieklpT2lJeE5TNHdNREFpTENKeVlXNXJJam9pTXpJMUluMHNleUowYVcxbElqb2lNakF4Tmkwd015MHhOQ0F5TWpvd01Eb3dNQ0lzSW1GeGFTSTZJakV6TkNJc0luQnRNbDgxSWpvaU1UQXlJaXdpY0cweE1DSTZJakUxT0NJc0ltTnZJam9pTUM0NE5URWlMQ0p1YnpJaU9pSTJNQzR3TURBaUxDSnZNeUk2SWpjNUxqQXdNQ0lzSW5Odk1pSTZJakUyTGpBd01DSXNJbkpoYm1zaU9pSXlPVGdpZlYxOTVwMnQ1YmVl
两次base64解码后得到:
<code class="lang-html">{"total":27,"rows":[{"time":"2016-03-13 20:00:00","aqi":"196","pm2_5":"147","pm10":"217","co":"1.501","no2":"77.000","o3":"35.000","so2":"30.000","rank":"351"},{"time":"2016-03-13 21:00:00","aqi":"185","pm2_5":"139","pm10":"206","co":"1.297","no2":"66.000","o3":"36.000","so2":"27.000","rank":"349"},{"time":"2016-03-13 22:00:00","aqi":"169","pm2_5":"128","pm10":"186","co":"1.137","no2":"58.000","o3":"38.000","so2":"22.000","rank":"347"},{"time":"2016-03-13 23:00:00","aqi":"170","pm2_5":"129","pm10":"185","co":"1.078","no2":"60.000","o3":"34.000","so2":"22.000","rank":"349"},{"time":"2016-03-14 00:00:00","aqi":"155","pm2_5":"118","pm10":"172","co":"0.999","no2":"54.000","o3":"40.000","so2":"20.000","rank":"337"},{"time":"2016-03-14 01:00:00","aqi":"122","pm2_5":"92","pm10":"133","co":"0.861","no2":"42.000","o3":"51.000","so2":"17.000","rank":"301"},{"time":"2016-03-14 02:00:00","aqi":"83","pm2_5":"61","pm10":"88","co":"0.784","no2":"28.000","o3":"73.000","so2":"13.000","rank":"217"},{"time":"2016-03-14 03:00:00","aqi":"72","pm2_5":"52","pm10":"74","co":"0.799","no2":"30.000","o3":"68.000","so2":"13.000","rank":"182"},{"time":"2016-03-14 04:00:00","aqi":"59","pm2_5":"42","pm10":"62","co":"0.796","no2":"31.000","o3":"63.000","so2":"13.000","rank":"136"},{"time":"2016-03-14 05:00:00","aqi":"58","pm2_5":"41","pm10":"61","co":"0.835","no2":"34.000","o3":"55.000","so2":"14.000","rank":"124"},{"time":"2016-03-14 06:00:00","aqi":"62","pm2_5":"44","pm10":"67","co":"0.831","no2":"35.000","o3":"51.000","so2":"14.000","rank":"142"},{"time":"2016-03-14 07:00:00","aqi":"69","pm2_5":"50","pm10":"79","co":"0.861","no2":"45.000","o3":"41.000","so2":"15.000","rank":"156"},{"time":"2016-03-14 08:00:00","aqi":"79","pm2_5":"58","pm10":"93","co":"0.892","no2":"49.000","o3":"46.000","so2":"20.000","rank":"176"},{"time":"2016-03-14 09:00:00","aqi":"87","pm2_5":"64","pm10":"98","co":"0.882","no2":"39.000","o3":"72.000","so2":"22.000","rank":"190"},{"time":"2016-03-14 10:00:00","aqi":"87","pm2_5":"64","pm10":"97","co":"0.894","no2":"38.000","o3":"84.000","so2":"23.000","rank":"185"},{"time":"2016-03-14 11:00:00","aqi":"93","pm2_5":"69","pm10":"101","co":"0.863","no2":"37.000","o3":"98.000","so2":"24.000","rank":"218"},{"time":"2016-03-14 12:00:00","aqi":"98","pm2_5":"73","pm10":"111","co":"0.872","no2":"33.000","o3":"113.000","so2":"22.000","rank":"247"},{"time":"2016-03-14 13:00:00","aqi":"113","pm2_5":"85","pm10":"128","co":"0.872","no2":"32.000","o3":"155.000","so2":"22.000","rank":"295"},{"time":"2016-03-14 14:00:00","aqi":"123","pm2_5":"93","pm10":"139","co":"0.893","no2":"33.000","o3":"141.000","so2":"22.000","rank":"314"},{"time":"2016-03-14 15:00:00","aqi":"130","pm2_5":"99","pm10":"147","co":"0.866","no2":"32.000","o3":"147.000","so2":"20.000","rank":"326"},{"time":"2016-03-14 16:00:00","aqi":"137","pm2_5":"104","pm10":"155","co":"0.843","no2":"34.000","o3":"151.000","so2":"19.000","rank":"337"},{"time":"2016-03-14 17:00:00","aqi":"143","pm2_5":"109","pm10":"162","co":"0.833","no2":"38.000","o3":"147.000","so2":"19.000","rank":"340"},{"time":"2016-03-14 18:00:00","aqi":"144","pm2_5":"110","pm10":"162","co":"0.864","no2":"46.000","o3":"137.000","so2":"19.000","rank":"342"},{"time":"2016-03-14 19:00:00","aqi":"144","pm2_5":"110","pm10":"162","co":"0.884","no2":"56.000","o3":"118.000","so2":"17.000","rank":"337"},{"time":"2016-03-14 20:00:00","aqi":"147","pm2_5":"112","pm10":"168","co":"0.914","no2":"74.000","o3":"90.000","so2":"16.000","rank":"336"},{"time":"2016-03-14 21:00:00","aqi":"143","pm2_5":"109","pm10":"169","co":"0.910","no2":"70.000","o3":"79.000","so2":"15.000","rank":"325"},{"time":"2016-03-14 22:00:00","aqi":"134","pm2_5":"102","pm10":"158","co":"0.851","no2":"60.000","o3":"79.000","so2":"16.000","rank":"298"}]}杭州</code>
就是所要的数据了。
个人认为用python来拉取比较方便。。
引用
评论
加载评论中,请稍候...
200字以内,仅用于支线交流,主线讨论请采用回复功能。
折叠评论
huojunan2作者
8年9个月前 IP:北京
812454
引用 radio:
可以从 XXXXXXXXXXXXXXXXXXXXXX/api/getdata_XXXXXXXXXXXXXp 这里获得数据
用post方法向这个地址传送以下参数:
city:"5p2t5bee"             //"杭州"的ba...
感谢,真是帮大忙了,这是取得了数据接口么
本人完全的小白
引用
评论
加载评论中,请稍候...
200字以内,仅用于支线交流,主线讨论请采用回复功能。
折叠评论
zx-16533
8年9个月前 修改于 8年9个月前 IP:广东
812459
<code class="lang-python"># -*- coding:utf8 -*-
import urllib2,urllib,random,string,base64,time,datetime,re
import string
timestart = datetime.datetime.strptime('2016-01-01 20:00:00', '%Y-%m-%d %H:%M:%S')  #开始时间
timeend   = datetime.datetime.strptime('2016-02-10 20:00:00', '%Y-%m-%d %H:%M:%S')  #结束时间
timenow   = timestart
fileo=open('./data.txt','w')#输出文件
dataa = {}
     
dataa['city'] = '5p2t5bee'
dataa['type'] = 'SE9VUg=='
while(timenow<timeend): 20100101     dataa['starttime']="base64.encodestring(timenow.strftime('%Y-%m-%d" %h:%m:%s'))     timenow="timenow+datetime.timedelta(days=1)"     dataa['endtime']="base64.encodestring((timenow-datetime.timedelta(hours=1)).strftime('%Y-%m-%d"              f="urllib2.Request("             url    ="http://www.aqistudy.cn/api/getdata_citydetail.php" ,             headers="{"             'host' : 'www.aqistudy.cn',             'user-agent' 'mozilla 5.0 (x11; ubuntu; linux x86_64; rv:44.0) gecko firefox 44.0',             'accept' 'text html,application xhtml+xml,application xml;q="0.9,*/*;q=0.8',"             'accept-language' 'zh-cn,zh;q="0.8,en-US;q=0.5,en;q=0.3',"             'connection' 'keep-alive'             },         data    ="urllib.urlencode(dataa)"     )     r="urllib2.urlopen(f)"     outline="base64.decodestring(base64.decodestring(r.read())).replace('{','\n').replace('"total":24,"rows":[','').replace(']','" ').replace('}',' ').replace('\"',' ').replace('杭州',' ')     print outline     fileo.write(outline) fileo.close()< code></timeend):></code>

写了个python脚本...
输出的一小部分:
<code class="lang-text">time : 2016-01-01 20:00:00 , aqi : 135 , pm2_5 : 103 , pm10 : 150 , co : 1.155 , no2 : 93.000 , o3 : 23.000 , so2 : 22.000 , rank : 200  ,
 time : 2016-01-01 21:00:00 , aqi : 133 , pm2_5 : 101 , pm10 : 154 , co : 1.159 , no2 : 95.000 , o3 : 16.000 , so2 : 22.000 , rank : 185  ,
 time : 2016-01-01 22:00:00 , aqi : 139 , pm2_5 : 106 , pm10 : 162 , co : 1.228 , no2 : 97.000 , o3 : 10.000 , so2 : 22.000 , rank : 202  ,
 time : 2016-01-01 23:00:00 , aqi : 148 , pm2_5 : 113 , pm10 : 180 , co : 1.343 , no2 : 99.000 , o3 : 7.000 , so2 : 21.000 , rank : 215  ,
 time : 2016-01-02 00:00:00 , aqi : 175 , pm2_5 : 132 , pm10 : 208 , co : 1.380 , no2 : 100.000 , o3 : 6.000 , so2 : 19.000 , rank : 250  ,
 time : 2016-01-02 01:00:00 , aqi : 189 , pm2_5 : 142 , pm10 : 225 , co : 1.422 , no2 : 99.000 , o3 : 7.000 , so2 : 20.000 , rank : 277  ,
 time : 2016-01-02 02:00:00 , aqi : 196 , pm2_5 : 147 , pm10 : 234 , co : 1.495 , no2 : 99.000 , o3 : 7.000 , so2 : 19.000 , rank : 291  ,
 time : 2016-01-02 03:00:00 , aqi : 196 , pm2_5 : 147 , pm10 : 230 , co : 1.486 , no2 : 93.000 , o3 : 6.000 , so2 : 20.000 , rank : 298  ,
 time : 2016-01-02 04:00:00 , aqi : 189 , pm2_5 : 142 , pm10 : 218 , co : 1.452 , no2 : 89.000 , o3 : 7.000 , so2 : 19.000 , rank : 292  ,
 time : 2016-01-02 05:00:00 , aqi : 185 , pm2_5 : 139 , pm10 : 212 , co : 1.427 , no2 : 88.000 , o3 : 7.000 , so2 : 19.000 , rank : 283  ,
 time : 2016-01-02 06:00:00 , aqi : 179 , pm2_5 : 135 , pm10 : 206 , co : 1.449 , no2 : 85.000 , o3 : 8.000 , so2 : 18.000 , rank : 275  ,
 time : 2016-01-02 07:00:00 , aqi : 172 , pm2_5 : 130 , pm10 : 198 , co : 1.469 , no2 : 81.000 , o3 : 9.000 , so2 : 18.000 , rank : 265  ,
 time : 2016-01-02 08:00:00 , aqi : 172 , pm2_5 : 130 , pm10 : 192 , co : 1.517 , no2 : 79.000 , o3 : 9.000 , so2 : 17.000 , rank : 262  ,
 time : 2016-01-02 09:00:00 , aqi : 172 , pm2_5 : 130 , pm10 : 200 , co : 1.576 , no2 : 83.000 , o3 : 11.000 , so2 : 19.000 , rank : 249  ,
 time : 2016-01-02 10:00:00 , aqi : 179 , pm2_5 : 135 , pm10 : 208 , co : 1.656 , no2 : 92.000 , o3 : 16.000 , so2 : 25.000 , rank : 241  ,
 time : 2016-01-02 11:00:00 , aqi : 166 , pm2_5 : 126 , pm10 : 198 , co : 1.479 , no2 : 94.000 , o3 : 26.000 , so2 : 27.000 , rank : 220  ,
 time : 2016-01-02 12:00:00 , aqi : 148 , pm2_5 : 113 , pm10 : 176 , co : 1.257 , no2 : 88.000 , o3 : 40.000 , so2 : 26.000 , rank : 197  ,
 time : 2016-01-02 13:00:00 , aqi : 120 , pm2_5 : 91 , pm10 : 141 , co : 1.072 , no2 : 73.000 , o3 : 57.000 , so2 : 20.000 , rank : 168  ,
 time : 2016-01-02 14:00:00 , aqi : 108 , pm2_5 : 81 , pm10 : 122 , co : 0.992 , no2 : 66.000 , o3 : 62.000 , so2 : 18.000 , rank : 168  ,
 time : 2016-01-02 15:00:00 , aqi : 94 , pm2_5 : 70 , pm10 : 106 , co : 0.948 , no2 : 64.000 , o3 : 63.000 , so2 : 18.000 , rank : 149  ,
 time : 2016-01-02 16:00:00 , aqi : 89 , pm2_5 : 66 , pm10 : 102 , co : 0.902 , no2 : 63.000 , o3 : 60.000 , so2 : 18.000 , rank : 146  ,
 time : 2016-01-02 17:00:00 , aqi : 90 , pm2_5 : 67 , pm10 : 106 , co : 0.999 , no2 : 82.000 , o3 : 42.000 , so2 : 16.000 , rank : 144  ,
 time : 2016-01-02 18:00:00 , aqi : 107 , pm2_5 : 80 , pm10 : 133 , co : 1.336 , no2 : 113.000 , o3 : 18.000 , so2 : 15.000 , rank : 162  ,
 time : 2016-01-02 19:00:00 , aqi : 127 , pm2_5 : 96 , pm10 : 171 , co : 1.625 , no2 : 122.000 , o3 : 10.000 , so2 : 15.000 , rank : 169    
     
 time : 2016-01-02 20:00:00 , aqi : 140 , pm2_5 : 107 , pm10 : 194 , co : 1.775 , no2 : 121.000 , o3 : 11.000 , so2 : 17.000 , rank : 175  ,
 time : 2016-01-02 21:00:00 , aqi : 153 , pm2_5 : 117 , pm10 : 220 , co : 2.235 , no2 : 119.000 , o3 : 10.000 , so2 : 17.000 , rank : 186  ,
 time : 2016-01-02 22:00:00 , aqi : 160 , pm2_5 : 122 , pm10 : 228 , co : 2.153 , no2 : 118.000 , o3 : 10.000 , so2 : 17.000 , rank : 202  ,
 time : 2016-01-02 23:00:00 , aqi : 159 , pm2_5 : 121 , pm10 : 227 , co : 2.097 , no2 : 114.000 , o3 : 8.000 , so2 : 15.000 , rank : 202  ,</code>
引用
评论
加载评论中,请稍候...
200字以内,仅用于支线交流,主线讨论请采用回复功能。
折叠评论
novakon
8年9个月前 IP:广东
812474
是的,取得了API,或者叫“数据接口”。
楼主可以扩展阅读一下HTTP协议,和base64编码。

所有的编程语言(比如楼上python)都可以解决这两个问题,甚至可以写JS,在浏览器里运行。
引用
评论
加载评论中,请稍候...
200字以内,仅用于支线交流,主线讨论请采用回复功能。
折叠评论
大仙
8年9个月前 IP:江苏
812502
引用 novakon:
是的,取得了API,或者叫“数据接口”。
楼主可以扩展阅读一下HTTP协议,和base64编码。

所有的编程语言(比如楼上python)都可以解决这两个问题,甚至可以写JS,在浏览器里运行。
最近在自学JS和PYTHON,解决的问题和楼主的正好相反,别人的软件采集的数据用数据库转发过来,我做个数据可视化的网页,以前别人用C++写的图表超丑,JAVASCRIPT的插件好多做出来的效果看起来都高大上。
引用
评论
加载评论中,请稍候...
200字以内,仅用于支线交流,主线讨论请采用回复功能。
折叠评论
smith
8年9个月前 IP:广东
812512
百度公司有个开源的前端js图表制作库叫做echat,介绍在这里XXXXXXXXXXXXXXXXXXXXXXXX/

这个,算是百度公司为数不多的良心产品吧[s::lol]

我有玩得比较好的同学在百度公司里面,百度公司除了卖贴吧之外还是有不少有用的东西的
引用
评论
加载评论中,请稍候...
200字以内,仅用于支线交流,主线讨论请采用回复功能。
折叠评论
大仙
8年9个月前 IP:江苏
812513
引用 smith:
百度公司有个开源的前端js图表制作库叫做echat,介绍在这里XXXXXXXXXXXXXXXXXXXXXXXX/

这个,算是百度公司为数不多的良心产品吧

我有玩得比较好的同学在百度公司里面,百度公司除了卖贴吧之外还是有不少有用的东西的
我最近就在研究这个,握个爪
引用
评论
加载评论中,请稍候...
200字以内,仅用于支线交流,主线讨论请采用回复功能。
折叠评论
huojunan2作者
8年9个月前 IP:北京
812514
引用 radio:
# -*- coding:utf8 -*-
import urllib2,urllib,random,string,base64,time,datetime,re
import string
timestart = datetime....
这个python脚本我应该在那种环境下运行?python里,还是其他地方?
引用
评论
加载评论中,请稍候...
200字以内,仅用于支线交流,主线讨论请采用回复功能。
折叠评论
大仙
8年9个月前 IP:江苏
812519
引用 huojunan2:
这个python脚本我应该在那种环境下运行?python里,还是其他地方?
[s::L]肯定是PYTHON里啊
引用
评论
加载评论中,请稍候...
200字以内,仅用于支线交流,主线讨论请采用回复功能。
折叠评论
zx-16533
8年9个月前 IP:广东
812603
不好意思没看清主贴。。楼主要获取北京的数据得把第10行的'5p2t5bee'改成‘北京’的编码'5YyX5Lqs'才行蛤
29行的'杭州'也换成'北京'
引用
评论
加载评论中,请稍候...
200字以内,仅用于支线交流,主线讨论请采用回复功能。
折叠评论
huojunan2作者
8年9个月前 IP:北京
812615
引用 radio:
不好意思没看清主贴。。楼主要获取北京的数据得把第10行的'5p2t5bee'改成‘北京’的编码'5YyX5Lqs'才行蛤
29行的'杭州'也换成'北京'
谢谢
引用
评论
加载评论中,请稍候...
200字以内,仅用于支线交流,主线讨论请采用回复功能。
折叠评论
huojunan2作者
8年9个月前 IP:北京
812827
引用 radio:
可以从 XXXXXXXXXXXXXXXXXXXXXX/api/getdata_XXXXXXXXXXXXXp 这里获得数据
用post方法向这个地址传送以下参数:
city:"5p2t5bee"             //"杭州"的ba...
post方法能讲解下么?
引用
评论
加载评论中,请稍候...
200字以内,仅用于支线交流,主线讨论请采用回复功能。
折叠评论
大仙
8年9个月前 IP:江苏
812845
引用 huojunan2:
post方法能讲解下么?
请移步极客公园或者IMOOC自行看视频,大家都很忙的
引用
评论
加载评论中,请稍候...
200字以内,仅用于支线交流,主线讨论请采用回复功能。
折叠评论

想参与大家的讨论?现在就 登录 或者 注册

所属专业
上级专业
同级专业
huojunan2
机友 笔友
文章
11
回复
337
学术分
0
2014/09/24注册,1年2个月前活动

原化学狗,仪器狗现役,

主体类型:个人
所属领域:无
认证方式:手机号
IP归属地:北京
文件下载
加载中...
{{errorInfo}}
{{downloadWarning}}
你在 {{downloadTime}} 下载过当前文件。
文件名称:{{resource.defaultFile.name}}
下载次数:{{resource.hits}}
上传用户:{{uploader.username}}
所需积分:{{costScores}},{{holdScores}}下载当前附件免费{{description}}
积分不足,去充值
文件已丢失

当前账号的附件下载数量限制如下:
时段 个数
{{f.startingTime}}点 - {{f.endTime}}点 {{f.fileCount}}
视频暂不能访问,请登录试试
仅供内部学术交流或培训使用,请先保存到本地。本内容不代表科创观点,未经原作者同意,请勿转载。
音频暂不能访问,请登录试试
支持的图片格式:jpg, jpeg, png
插入公式
评论控制
加载中...
文号:{{pid}}
投诉或举报
加载中...
{{tip}}
请选择违规类型:
{{reason.type}}

空空如也

加载中...
详情
详情
推送到专栏从专栏移除
设为匿名取消匿名
查看作者
回复
只看作者
加入收藏取消收藏
收藏
取消收藏
折叠回复
置顶取消置顶
评学术分
鼓励
设为精选取消精选
管理提醒
编辑
通过审核
评论控制
退修或删除
历史版本
违规记录
投诉或举报
加入黑名单移除黑名单
查看IP
{{format('YYYY/MM/DD HH:mm:ss', toc)}}