Python 东方财富网-股市行情数据抓取

Python 东方财富网-股市行情数据抓取,第1张

概述东方财富网 股市行情数据抓取; http://quote.eastmoney.com/center/gridlist.html#hs_a_board      请求数据未入库处理,其中数据只存入数据文本,未做存入数据库处理   请求样例数据结果: jQuery112406092635132097686_1569674756779({"rc":0,"rt":6,"svr":181233083,"lt

东方财富网 股市行情数据抓取;

http://quote.eastmoney.com/center/gridlist.html#hs_a_board 

 

 

请求数据未入库处理,其中数据只存入数据文本,未做存入数据库处理

 

请求样例数据结果:

jquery112406092635132097686_1569674756779({"rc":0,"rt":6,"svr":181233083,"lt":1,"full":1,"data":{"total":3815,"diff":[{"f1":2,"f2":55.15,"f3":43.99,"f4":16.85,"f5":210,"f6":1145060.0,"f7":23.99,"f8":0.1,"f9":31.72,"f10":"-","f11":0.0,"f12":"300792","f13":0,"f14":"N壹网","f15":55.15,"f16":45.96,"f17":45.96,"f18":38.3,"f20":4412000000,"f21":1103000000,"f22":0.0,"f23":3.91,"f24":0.0,"f25":43.99,"f62":1008914.0,"f115":24.39,"f128":"-","f140":"-","f141":"-","f136":"-","f152":2},{"f1":2,"f2":81.8,"f3":17.04,"f4":11.91,"f5":53085,"f6":409394064.0,"f7":18.39,"f8":29.56,"f9":-1402.53,"f10":1.31,"f12":"688333","f13":1,"f14":"铂力特","f15":82.1,"f16":69.25,"f17":71.0,"f18":69.89,"f20":6544000000,"f21":1469082028,"f23":6.59,"f24":34.1,"f25":34.1,"f62":37917359.0,"f115":118.49,"f2":3.17,"f3":10.07,"f4":0.29,"f5":198417,"f6":62805298.0,"f7":10.42,"f8":4.79,"f9":-33.29,"f10":4.39,"f12":"002504","f14":"弘高创意","f15":3.17,"f16":2.87,"f17":2.87,"f18":2.88,"f20":3251787658,"f21":1314120238,"f23":3.58,"f24":-8.65,"f25":-13.15,"f62":22200837.0,"f115":-62.84,"f2":5.91,"f3":10.06,"f4":0.54,"f5":138445,"f6":80763569.0,"f7":9.87,"f8":1.88,"f9":-157.89,"f10":4.3,"f12":"002699","f14":"美盛文化","f15":5.91,"f16":5.38,"f17":5.38,"f18":5.37,"f20":5375574805,"f21":4342243686,"f23":1.78,"f24":-2.96,"f25":7.85,"f62":23301055.0,"f115":-18.3,"f2":13.04,"f3":10.04,"f4":1.19,"f5":268206,"f6":343357472.0,"f7":10.13,"f8":6.05,"f9":29.99,"f10":1.73,"f12":"600363","f14":"联创光电","f15":13.04,"f16":11.84,"f17":11.85,"f18":11.85,"f20":5782936820,"f21":5782936820,"f23":2.3,"f24":10.32,"f25":64.03,"f62":11762884.0,"f115":27.63,"f2":18.65,"f3":10.03,"f4":1.7,"f5":136079,"f6":250388102.0,"f7":6.78,"f8":27.05,"f9":62.3,"f10":1.45,"f12":"603933","f14":"睿能科技","f15":18.65,"f16":17.5,"f17":18.65,"f18":16.95,"f20":3752999180,"f21":938341180,"f23":3.62,"f24":37.54,"f25":41.72,"f62":36024950.0,"f115":57.88,"f2":7.46,"f4":0.68,"f5":136982,"f6":98801261.0,"f7":9.59,"f8":3.42,"f9":95.92,"f10":1.39,"f12":"002581","f14":"未名医药","f15":7.46,"f16":6.81,"f17":6.85,"f18":6.78,"f20":4921627472,"f21":2989902061,"f23":1.77,"f24":5.97,"f25":15.48,"f62":8171310.0,"f115":-64.99,"f2":8.23,"f4":0.75,"f5":820036,"f6":656416272.0,"f7":9.09,"f8":3.43,"f9":26.87,"f10":1.11,"f12":"002152","f14":"广电运通","f15":8.23,"f16":7.55,"f17":7.55,"f18":7.48,"f20":19826020217,"f21":19697356808,"f23":2.25,"f24":21.57,"f25":49.91,"f62":89361087.0,"f115":28.52,"f2":9.66,"f3":10.02,"f4":0.88,"f5":393672,"f6":374552944.0,"f7":10.59,"f8":6.51,"f9":27.84,"f10":2.56,"f12":"002326","f14":"永太科技","f15":9.66,"f16":8.73,"f17":8.78,"f18":8.78,"f20":7896692841,"f21":5846040548,"f23":2.72,"f24":13.11,"f25":41.23,"f62":66536824.0,"f115":35.7,"f2":24.26,"f4":2.21,"f5":60516,"f6":142278510.0,"f7":8.84,"f8":15.08,"f9":78.85,"f10":0.82,"f12":"300576","f14":"容大感光","f15":24.26,"f16":22.31,"f17":22.45,"f18":22.05,"f20":2911200000,"f21":973278328,"f23":6.55,"f24":26.35,"f25":75.42,"f62":11872820.0,"f115":70.41,"f2":21.52,"f4":1.96,"f5":71732,"f6":151240608.0,"f7":9.97,"f8":5.92,"f9":192.0,"f10":2.21,"f12":"300380","f14":"安硕信息","f15":21.52,"f16":19.57,"f17":19.7,"f18":19.56,"f20":2957708800,"f21":2608249329,"f23":6.97,"f24":12.61,"f25":39.65,"f62":40619039.0,"f115":95.39,"f2":27.01,"f4":2.46,"f5":84246,"f6":219853093.0,"f7":11.04,"f8":7.18,"f9":85.22,"f10":0.73,"f12":"002751","f14":"易尚展示","f15":27.01,"f16":24.3,"f17":24.3,"f18":24.55,"f20":4175762557,"f21":3169966689,"f23":4.04,"f24":24.87,"f25":25.86,"f62":64597906.0,"f115":49.84,"f2":33.5,"f4":3.05,"f5":7118,"f6":23844931.0,"f7":0.0,"f8":1.58,"f9":108.74,"f10":2.91,"f12":"002961","f14":"瑞达期货","f15":33.5,"f16":33.5,"f17":33.5,"f18":30.45,"f20":14907500000,"f21":1507500000,"f23":9.01,"f24":401.5,"f25":401.5,"f62":18371667.0,"f115":129.93,"f2":26.91,"f4":2.45,"f5":217836,"f6":574961248.0,"f7":9.08,"f8":10.22,"f9":54.18,"f10":1.3,"f12":"300458","f14":"全志科技","f15":26.91,"f16":24.69,"f17":24.69,"f18":24.46,"f20":8896735471,"f21":5735494039,"f23":4.19,"f24":25.81,"f25":36.6,"f62":58643249.0,"f115":71.3,"f2":6.81,"f4":0.62,"f5":83794,"f6":56680352.0,"f7":10.18,"f8":1.74,"f9":211.1,"f10":1.37,"f12":"300290","f14":"荣科科技","f15":6.81,"f16":6.18,"f17":6.23,"f18":6.19,"f20":3771083202,"f21":3288862008,"f23":3.55,"f24":-2.01,"f25":73.28,"f62":22432152.0,"f115":164.19,"f2":14.28,"f4":1.3,"f5":56518,"f6":77563179.0,"f7":10.63,"f8":12.71,"f9":213.08,"f10":3.82,"f12":"603683","f14":"晶华新材","f15":14.28,"f16":12.9,"f17":12.98,"f18":12.98,"f20":1808847600,"f21":635031600,"f23":2.29,"f24":3.33,"f25":3.63,"f62":14704570.0,"f115":184.63,"f2":31.86,"f3":10.01,"f4":2.9,"f5":26669,"f6":83345178.0,"f7":11.6,"f8":9.18,"f9":29.86,"f10":1.55,"f12":"300752","f14":"隆利科技","f15":31.86,"f16":28.5,"f17":28.5,"f18":28.96,"f20":3703977331,"f21":925994333,"f23":4.7,"f24":8.07,"f25":-8.95,"f62":29842570.0,"f115":25.85,"f2":16.26,"f4":1.48,"f5":24534,"f6":38740820.0,"f7":10.69,"f8":3.99,"f9":27.18,"f10":2.28,"f12":"002873","f14":"新天药业","f15":16.26,"f16":14.68,"f17":14.68,"f18":14.78,"f20":1903980960,"f21":1000634937,"f23":2.81,"f24":1.25,"f25":0.43,"f62":11495649.0,"f115":26.04,"f2":10.11,"f4":0.92,"f5":132348,"f6":133803828.0,"f8":4.18,"f9":49.17,"f10":0.37,"f12":"300081","f14":"恒信东方","f15":10.11,"f16":10.11,"f17":10.11,"f18":9.19,"f20":5349786126,"f21":3198141138,"f23":2.06,"f24":1.61,"f25":13.6,"f62":17807754.0,"f115":82.34,"f2":44.42,"f3":10.0,"f4":4.04,"f5":26505,"f6":117735476.0,"f8":5.26,"f9":61.73,"f10":9.92,"f12":"002962","f14":"五方光电","f15":44.42,"f16":44.42,"f17":44.42,"f18":40.38,"f20":8955072000,"f21":2238768000,"f23":5.79,"f24":157.21,"f25":157.21,"f62":60201138.0,"f115":60.66,"f152":2}]}});

 业务代码:

import requestsimport iodef getHTML(url):        r = requests.get(url,stream=True)        #print(r.text)        r.enCoding = ‘utf8‘        #print(r.Json)        return r.contentdef Writefile(path,msg):    #with open(‘test.txt‘,‘w‘) as f:   # f.write(‘Hello,world!‘)    file = open(path,‘a‘,enCoding=‘gbk‘,errors=‘ignore‘)    f = file.write(str(msg.decode(‘utf-8‘)))    file.close()   # print(r.text)        # return r.contentfor num in List(range(1,193)):   url="http://78.push2.eastmoney.com/API/qt/cList/get?cb=jquery112406092635132097686_1569674756779&pn="+str(num)+"&pz=20&po=1&np=1&ut=bd1d9ddb04089700cf9c27f6f7426281&fltt=2&invt=2&fID=f3&fs=m:0+t:6,m:0+t:13,m:0+t:80,m:1+t:2,m:1+t:23&fIElds=f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,f21,f23,f24,f25,f22,f11,f62,f128,f136,f115,f152&_=1569674756885"   print("第"+str(num)+"页")   msg= getHTML(url)   Writefile("H:\gp.txt",msg)
总结

以上是内存溢出为你收集整理的Python 东方财富网-股市行情数据抓取全部内容,希望文章能够帮你解决Python 东方财富网-股市行情数据抓取所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/1190907.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-03
下一篇 2022-06-03

发表评论

登录后才能评论

评论列表(0条)

保存