Python网络爬取科目一题库(1685道)2021.1.3
Python爬虫获取科目一题库1、选取目标网站2、部署实验环境3、网站数据分析4、实验爬虫测试1、选取目标网站https://m.jsyks.com/km1_sxlxhttps://www.jsyks.com/kmy2、部署实验环境在Anaconda下新建了myenv环境Python3.6、pip方式安装的包编辑器用的是PyCharm3、网站数据分析1、判断题Request: https://tk
Python爬虫获取科目一题库2021.1.3
1、选取目标网站
驾驶员考试网址1
驾驶员考试网址2
总的来说,科目一顺序练习题总共有1685道题,然而在页面中我们只能点击向右的箭头一道一道来做,但更希望将所有的题整理到一起,放到word文档中。
通过分析发现上述两个网站本身都是驾驶员考试网下的分支,所以题库是完全一样的,下面就以驾驶员考试网址1来进行爬取。
2、部署实验环境
1、如果安装了Conda的话,可以利用Anaconda新建名称为myenv的虚拟环境,环境中我用的是Python3.6,之后pip方式可以安装依赖包,Python编辑器用的是PyCharm;
2、当然,如果没用Conda的话,安装Python3.6也是完全可以的。
3、pip安装的依赖包包括:requests 2.25.0
、urllib3 1.26.2
、docx 0.2.4
、python-docx 0.8.10
、lxml 4.6.2
3、网站数据分析
在进行Python爬虫之前,我们需要首先确定网页请求链接地址request、请求结果response等信息,这时需要借助Google浏览器开发助手DevTools,在谷歌浏览器页面按F12或者右键->检查,
通过上图分析后,发现点击下一题会触发OnClick()事件,进入mySwipe.next()函数,下面来寻找这个函数。网页由三大部分构成:html、css、javascript,其中html主要控制页面布局、css控制页面各按钮、下拉框等组件的样式style、而javascript则控制页面各元素点击事件后触发的执行函数,因此我们需要在页面的script中就近寻找,发现了swipe.js和2020_lianxi.js
接下来,我们打开DevTools的sources标签栏,下面会包含网页所需的文件,这里的rs.mnks.cn文件夹下找到了swipe.js和2020_lianxi.js
在这两个js文件中,我们需要查找mySwipe.next(),点击Ctrl+F,输入mySwipe.next()进行查找,然后在swipe.js中找到对应的next()函数
通过对这两个js文件代码深入分析,可发现,
通过Get方式来请求url,url地址"https://tkdata.mnks.cn/ExamData/"+EmID+".jsonCALL=?"+ExamVersion+".json",可见我们需要EmID和ExamVersion的信息,而 EmID = ExamID[order],所以Ctrl+F输入ExamID进行查找,如下图所示。
上图中,可以看到ExamID是长度为ExamCount的数组,ExamID中每个元素的赋值是通过ExamCodes数组来实现的,因此分析发现:ExamCount为科目一题的数量,应该是1685;ExamCodes数组中包含各个题目对应的编码;ExamVersion对应题库的版本号,而我们要找的就是ExamCodes和ExamVersion。
3.1 题目分析
现在我们可以通过Network来测试点击下一题会触发的url,查看得到的response,
3.1.1 判断题
Request: https://tkdata.mnks.cn/ExamData/3fd79.json?CALL=?20201231143735.json
Response: {“tkId”:2013,“sortId”:1501,“cx”:“xc,hc,kc”,“pca”:0,“code”:“3fd79”,“tx”:1,“tm”:"\u9a7e\u9a76\u673a\u52a8\u8f66\u5728\u9053\u8def\u4e0a\u8fdd\u53cd\u9053\u8def\u901a\u884c\u89c4\u5b9a\u5e94\u5f53\u63a5\u53d7\u76f8\u5e94\u7684\u5904\u7f5a\u3002",“tp”:"",“tv”:"",“da”:"\u5bf9",“fz”:"",“tags”:"\u8fdd\u53cd\u9053\u8def\u901a\u884c\u89c4\u5b9a",“know”:“1084”,“star”:1,“chain”:0,“useTime”:9,“errRate”:0.014861}
对应如下:
{“tkId”:2013,“sortId”:1501,“cx”:“xc,hc,kc”,“pca”:0,“code”:“3fd79”,“tx”:1,“tm”:“驾驶机动车在道路上违反道路通行规定应当接受相应的处罚。”,“tp”:"",“tv”:"",“da”:“对”,“fz”:"",“tags”:“违反道路通行规定”,“know”:“1084”,“star”:1,“chain”:0,“useTime”:9,“errRate”:0.014861}
解析发现:tm为题目、da为答案
3.1.2 选择题
3.2 试题图片获取
在上图中,response结果中,将tv字段去除/SU/后再拼接到https://sucimg.itc.cn/sblog/后面,就形成了题目对应图片的下载链接https://sucimg.itc.cn/sblog/od50vqgFW8x
3.3 试题码获取
经分析,发现ExamVersion为20201231143735,然后只需要寻找ExamCodes即可。之后经过多次查找,在驾驶员考试网址1或驾驶员考试网址2页面中重新打开DevTools(按F12或右键审查),点击sources后,在左侧tk.mnks.cn文件夹下lianxiti文件中找到了ExamStatus、ExamMsg、ExamVersion、ExamCount和ExamCodes等信息。
var ExamStatus = "200";
var ExamMsg = "";
var ExamVersion = "20201231143735";
var ExamCount = 1685;
var ExamCodes = "02dec,0d977,02567,84832,3fd79,63ec6,bd93b,f1d94,8525d,dc736,fd969,601d1,8d481,6a5af,9e4bf,85990,96e73,c30ad,09f75,84f6f,3c384,2b592,39e8f,c575e,655f7,8778a,cba5a,df836,52913,3cdaa,bbae1,41c2f,3ba35,96b8e,527ca,4e150,1d5ca,3b40b,f6bfb,da8d6,e7d03,2a612,372cd,345bd,6e636,3bad3,6e1d1,9085f,581c3,5ca2e,bc28e,df99e,1798b,e1f87,11543,0b5ae,62fb9,f4a97,87e91,27071,ab37e,62dd9,9b782,923b2,a9c37,67c8f,550a2,02d0b,ab1b1,8bdd8,a4cc6,45ff2,f8d8e,e6b24,b263f,c79d1,b0a5e,8bf19,0a5d4,0146a,0f847,c8d7c,4ccf0,996f6,3f5c8,97f42,0092c,e39ab,80c79,4fba9,88f79,53a9c,b153d,43282,a2737,9e192,2ae9b,5e8f3,1af1d,908a5,0f560,d654f,07a67,e3cab,8c018,b65f5,d50e9,0eec6,a1b06,b8955,9fe2a,f41d8,c046f,8ea3f,8fcee,18b72,0d8da,0b105,7eb97,a190c,9f7d4,69c76,05016,4aa6c,d2dd5,42f37,88b97,86f88,5a227,57e0b,8ddfd,b59f9,ed2fb,31c18,8cb88,6d143,b0eb7,179be,b89c8,8ff26,2225d,a27ac,10d89,e02f1,f703f,128a1,c65cd,d70e2,06ec7,2827b,77849,9cab6,4855e,c6eec,dbb32,8bfea,bf8f2,581fd,6358c,0b05d,59908,df1fc,17d76,01ea3,991b0,8edc9,0f476,30d2e,cce31,1639c,059be,65ddf,4fac5,bffbd,e80c3,dbded,0beac,12eb5,440f9,39fe8,7e701,70b02,8afff,40d77,3b0fc,3c2be,8432f,eaaf6,c8188,ccc2b,41041,7d0ce,6d45d,05cc3,99729,1494e,0613c,e65b5,50de0,68905,749e8,c2c0f,8759a,b708c,fd962,34c8e,97370,f2824,554bd,c98cc,2bb47,454f5,18bc1,d790c,f5951,a1cd2,f9150,3f35b,9e042,05dde,edadb,27363,51bb7,67cd9,7d72c,3185e,bcbfb,6975e,93929,e0e77,f1fb9,df1a0,2c89d,da55f,c6e3e,22679,c205e,3d06f,3857d,5910e,ccda4,b0955,33d26,216ec,b36da,6bb2e,7daae,485e3,a6b53,a6565,acda3,394ec,1fd42,dbdb6,e9599,83a9a,d5a61,2c748,e0378,98478,e1824,921e2,30de9,0aa26,2c1e1,4f8d1,cfb12,f5287,3baa6,53544,40bed,e8aed,41e71,49277,ac554,6e510,e35c4,89ffa,f4c08,d6d44,353d7,dcbf0,8a7a7,88926,8fb61,e1efe,c1a4f,0fd13,ecb4d,b4051,2d545,cc0e9,45031,b2c67,10f52,0d295,c4976,17805,7dc86,a49d7,8dae5,146ea,fb755,c5053,a6be1,02d55,ead7a,b61cc,0b878,bc56c,d9ed7,f9601,92979,effab,bda94,d95e9,abfdf,17dd0,7b520,147b7,3ee5e,3f4ea,af85b,e2782,ccf76,ddfe3,a8500,ffc61,ccfd7,f1672,73f29,a339c,ce80e,fc93c,e93f2,233d9,61b7e,bc058,b5ab0,a5133,bc157,7a9a5,4ae6b,98c5d,28121,9d00f,67bd6,8720f,8dd28,8de9e,41388,2d2d9,44e5e,04032,dfb7b,6e2a2,80c67,893a5,6a227,3ff6b,aee0c,09bed,4f855,fefd6,73720,218cd,670a1,7d46f,39e04,da25f,da9e9,4f971,b7c9c,c6586,14c46,072f4,1421f,8bd96,e8f63,3f9cf,f1903,6e0d5,b0833,ed1cc,07a25,8bd03,8b78f,154d9,cacc0,c8ecd,b31b8,e4c6c,35c7b,eca2b,4d9d8,d70cb,34623,9617a,214c7,6fae0,ffa17,10a6b,79e7e,bbd55,5df53,94c41,a9d8e,98e15,66b2b,6a3e5,a2193,898ae,74e69,bc9c1,4a5b3,32f33,fecee,c2132,e5a56,1023c,8dbe2,f60c3,4ccc2,26435,c45de,f13cb,a950e,b59fa,36c43,ddd7e,6a944,d6dac,e5f45,02e80,8d3e3,b2697,60567,be57c,97cc9,629e1,32725,66649,93fad,8445a,52f86,f8c13,ab719,2fa27,fb1de,66b87,38b2d,7d9ae,10b65,f9331,606af,177f7,57f7c,c1cfb,839d5,4580a,7c0a4,4e7d9,42481,ed08c,81c71,e3c8f,bbcec,847fa,663fa,9cd64,7df8f,ebd6b,1ca8e,df491,2ee36,11346,164e0,b5fe8,a78a5,ee6ef,1095e,1bac1,35ee6,1e247,7c0be,a02d4,fd52c,36241,bdb21,30f8a,b5642,07081,f33f8,4d1d3,1e918,21535,9bf4e,8f0e0,476d1,31b40,6a3e7,f3685,c5599,8ba9a,c8db9,c20e5,dc36f,dd612,d3984,d62dc,daa6d,cd273,f56d8,b287a,af3a1,aafdd,afda3,f743c,d5a39,b15b4,d8b26,dbc91,fad47,e027f,bb686,cd3c7,ba65d,a1d98,f73cf,b9382,f22cd,dde16,f478c,f068b,cea30,fbc94,e5b7e,ec60a,b85e0,e8738,d0c10,d71ba,ad076,b08b1,c7ef0,e61c7,cbe0b,db127,be45b,cf0a9,d66c9,d90f9,deb39,f6c90,c46c0,d1c98,ec98b,dc306,ff8da,dd87e,a4472,bc436,d1428,cfa72,abf8b,a3a0f,f13d8,bfd01,f4571,da7d1,c99ad,d100b,bdab5,f52e2,b65fb,fda87,b016b,aea3c,b0c71,a4948,c6f0a,bd5be,afda7,b90ee,bad16,a11e0,fe7bc,d4ad0,f16bf,a077e,d1cc0,afb6b,a6e7f,e6e7c,c319c,a5691,eef6b,ce168,cf9f7,c4f90,f90f2,ac4cb,b0b8b,fe599,e6334,b34c0,b7bbb,e57eb,d5a15,ccc4b,cea42,ae845,ae205,b42c7,be7f5,fe7a8,dbdc2,b58f9,e0908,f0f03,bbda3,dd4da,b5700,e155c,a8dda,d7280,ca49b,bb0de,c6028,ab304,d33e4,f695d,f4cb6,dd447,bcfbd,aaf4d,d9978,ab965,f0a74,cf7dc,d2912,f2e6b,c4401,ef645,b4c8c,fd1f7,b71e2,fdd46,a8b27,b26ae,fb62e,b044d,b59a2,efc2c,f1ed3,e3e8b,ce166,a09f2,d257e,c3bd5,e8217,fece1,b3cca,b79a3,e06b9,f26ad,c7850,fbcee,f58e7,a2d58,d9c44,b0e26,a30ec,e6b25,e7898,fe4d7,eee5d,baf9d,fb650,bd31b,7ed55,51b33,4e901,2e726,faa36,95cbd,019e1,d8fc0,c8941,b4c9b,29934,1fe69,5bfaa,652c5,22fc3,f3559,daa75,5dab2,ae8b7,afc58,0a1e1,89f2f,b20ef,a75b5,58e01,7355e,b4ad5,bfd2d,f4041,74931,a4ab3,25e59,459b7,b4587,51168,9ebe0,a9d04,7fcbd,fc419,8ec58,e8ea0,2b963,75b55,5cbe8,33b74,c2245,5a465,bbe12,8ab8a,aaaad,a1d89,6d1df,58802,91ce6,42c91,4bdfc,d8fda,dab6d,a9f84,2428a,75d2f,e4804,af442,4c111,f3862,47008,79c95,fa2c1,b6987,ea07d,7aab8,ac3ab,a12d5,119b7,e2349,c8baa,91136,a78fb,e7cfa,9afe2,eb784,8db3c,5c525,cd5b8,5e42e,459a5,dcf68,0079e,865c9,37779,a6f72,ee4fa,e68e8,6848d,bd019,00428,e948a,59d1f,30284,80e48,cd63d,a8ac2,e5941,9be19,cd0e8,a0c58,91865,d57ff,baafc,dc354,50fd7,8dfac,18d69,7ff63,86a40,4a31c,6b35a,629ee,651f0,57379,80ef2,ce8f5,685a2,7e9f3,bef0e,241ef,ba267,a6227,b6368,ec007,095d8,ef885,cb564,31278,473f7,b1907,d6d84,6f189,5e84f,f2097,6e000,7e143,ea07a,60767,12bed,6ad66,35735,d0a64,30b06,00624,6d67a,f4472,07682,87d56,12250,5b34f,5d8fb,26468,81a32,e30a0,10813,052b5,60c8b,d2f6b,bc702,c0c67,f5304,9e1d1,4645d,52129,81ee4,b9c0f,78201,4b350,0c80a,49d2b,4aea3,41ba2,224fa,59f4a,0cc93,e88f7,ff8a3,11692,4c6b9,c89ea,675b6,0dc12,d6319,8c8ef,cdd6a,0c873,05796,5ea1b,830a8,f5a1d,3b20c,6d652,0b15e,55d48,6002b,35d61,cc269,8341a,7fdc8,36908,e6365,d17ab,54c8e,510d4,ca309,f35a7,994e8,c9409,e0247,c7af2,f569d,2bcc7,2b151,f2df4,42e64,0597c,d71f1,3e015,8f8c9,1d64f,95fc2,1e53c,3c180,39ef9,eac5d,78aff,a3f97,4ef4f,029f7,768c0,4684b,05ecf,b1b9e,485cd,75818,23bf9,aafb6,d4089,877a7,2a33c,74031,a30d3,d344d,83656,61ec8,34536,3c29a,86f18,27e7c,033e5,cd5b1,3f6d6,30115,1de22,50791,76d87,48172,e7424,0da57,70d0f,e6da6,6f23b,a3036,94ee1,931bd,4b642,37fe2,4a23e,52045,9f6b9,adf73,09bc9,95829,ba83d,eb1f7,68fb4,d5376,542d4,5458c,0ece5,1f3da,4912c,4c7a0,ff099,30490,08049,fdb07,34919,e1d38,e0a02,313d5,1b1a6,817ce,db169,f0275,36814,d120a,f107c,b545e,7233c,5a7b6,5f66f,1f1db,cb878,37796,94a14,e00ea,e2fc6,0c708,0c87f,fb550,724c3,6c477,a8621,0f280,47f92,f3181,6f82e,bc6be,723d4,830b4,ed289,30775,f3e7b,17955,d16b8,2086e,03de2,ff7ae,65e7f,3087e,9c2eb,56848,1274f,5314d,92eea,c230c,cb7a5,5b971,7bf6f,ebaea,10e81,03ce2,aa190,415be,fa068,07b04,32b13,35ab4,09d17,3bc19,03074,a1e3d,11dbb,03284,757ad,be050,b4715,fb5f0,f4532,cc289,e9c49,dd13e,f4212,ec509,e517e,cf6a2,f7b1b,fcd6c,e3998,b2025,ee11d,cc7a6,f43a3,c5223,e4190,a8c73,c53aa,c236f,ce6f4,c7414,b3f60,f5269,ba64d,eead5,e2995,bc421,e1bfb,aeea2,eb2ef,aa10f,ca1f8,e4811,bb615,b5e70,e4bd8,f86f4,be7f3,c3713,ba7e3,aa383,fa017,a8347,c657a,d1f49,c7beb,b3bda,c66cc,cfca2,2eaa5,fc42c,2b861,8a1fa,f3b7a,39117,833f6,46343,145c8,498f6,cd1b4,82729,e3bf1,c3b8b,4da8a,3bc18,62e7a,f9162,335c9,80520,1b468,d58be,a1889,79033,ae097,a777e,e353b,a778a,77b66,20dee,25caf,a7d77,86d7c,f1345,008da,08a95,cd313,59790,8922f,e725f,c1a09,9bf91,17a45,3d310,bd5a0,4bdab,f730d,23f56,7f074,4159f,dce58,bf822,c15e8,bccb0,6b182,79aa5,43faf,d8f06,07f3e,97665,6183e,cda6d,35789,b8a26,238c0,80cb4,7e387,08a3a,92233,ef513,c9a4c,d6e57,fcff5,5d209,0d19e,0cb3e,8e953,388fd,046cc,d1a91,d790b,04e39,b457a,81f6f,08d36,95624,d4180,b296d,141c7,9f301,3043a,6d753,d9d60,b5bd3,cd97e,e1ee2,6d664,4fbc8,5bddc,36e03,54ab2,e9da2,4f94f,03617,3d91c,f325f,cd94f,0f24d,29a0f,04fb8,6c7ee,68a5a,7392d,192c0,0c8ce,299b0,94429,bad10,7d2dd,ce94d,cd989,7e748,1ed7e,a746e,1eb97,a73a5,7fa2a,0d1e2,14f83,23520,14166,98e6e,e4e87,f8f05,6c961,fd49d,d92c3,3dd8f,4749b,fc569,b6e67,59e23,eaaba,4904b,e68db,d0f47,1d5b0,86d89,89301,a2eff,11bdc,4a8ad,bff1b,58a51,d9471,ae47a,43946,03512,f0afd,eb828,3ddfb,29fcd,5b32f,d0012,3ec5b,74417,f41a2,f2b36,e5ff7,c9b71,d2071,71c33,ad9e0,6a566,bb20e,7b626,ba719,28956,ad5a8,f2cf0,ebd1c,5ef26,aaddb,48e87,f6034,f25cd,116bd,087de,5611a,0b58c,0bb47,52868,9588c,dd61c,48ae6,50446,4d11d,fda5b,83949,c5d70,c28c2,729d0,39554,f006c,da5e4,be031,9af24,61d97,888e1,7d94f,29e6c,54eed,4fbc1,16c8e,557a6,4c137,c2c3a,aafb9,3398c,9b75f,bbc65,07787,52ebf,c6acf,853d4,a4471,c3309,ab06d,e50c6,781b5,d5473,2afa2,7c495,2b4d3,aa4fa,92638,3b61d,8f2ee,e5949,6b226,22e9c,5cba2,1536e,96863,3e0ad,bf897,53748,0649d,231fd,69db8,3125b,2d73b,59f0a,75253,0d2db,d39f1,319d5,15247,56df7,ffdb2,45229,f1e81,14d02,536f6,5a0ac,8b0a0,f4446,a2675,3cae1,d93ec,a302d,51ff9,81923,7e6e9,68fb5,267e7,a1afb,439f3,bae07,e277d,fe16c,89195,fa045,69410,38189,0752f,1f992,c7f6c,ef8b3,9826a,81c2d,6211d,660de,4860b,bacdf,8a6f1,872ad,46aeb,3cb76,62513,a4f81,530d9,cd369,c5cc8,a9bed,d06cb,ed719,c5ea9,b5225,cd52a,c1f19,af84c,c0d35,c95aa,a2c91,d0a22,abe98,cfb83,c3c0f,be257,da568,fb464,a734e,e89cf,ef5e5,e24d5,c3ed9,e1b9b,b2490,b7392,dc8e3,c024a,a1646,a84a9,bd639,ac40b,e0558,b7f2e,e79bb,e254b,f582c,a88fc,b6755,bfcf5,a34b8,bc160,a3909,c8529,b0c04,cfa5a,f5123,c49fc,f0409,be497,f8049,a288c,f89a8,bf9d7,b3747,d5073,da205,bdf05,ba86e,f88d6,e0a41,ec1b8,cc744,e27b1,fa2f0,d9213,fda06,f069d,b3fd1,e0d73,ae90b,fbc33,b7cea,f42f7,b308b,b9b19,c6916,e9a02,fd731,c2f43,a5d31,a381a,a429f,a64bf,e3f42,d9e4b,e4951,e8c07,c33b0,a0c56,adb87,bc392,ab982,bdc2a,c648c,acdf8,ea31c,a4f93,f78b9,c9f1e,e426f,efea2,dfc24,f064e,d7706,6a1bd,39449,54e4d,2e738,af179,ca0da,ee1da,d26b1,9df0e,b96b0,68834,30254,bf7dd,86dea,3a9e8,94598,94df9,f2e3f,28fa9,aa06a,6e363,c43b6,f93d4,a29ad,f7109,85197,d6f3f,1e624,355c4,be5fb,029f4,d5d6a,32fb5,46759,8bf77,3b5ad,d7bdc,cc6fa,900d2,16a25,3f564,c2128,02f95,fe151,99874,d4d11,3f2eb,9ae7e,a9480,40d08,2fa4c,859b1,74b70,daf04,cf855,aa924,f0083,d9005,fd398,71a6c,a3dee,73b03,cb0b6,b69bc,8d219,17b2f,e89ce,d10be,39a0c,dd9b8,c20d4,78a36,551a9,05d9c,46c54,4539c,109f3,a6bb1,c5c01,1d5ed,bb359,42b9c,c565f,a28db,1bb95,1b7d2,145d9,01e32,b4f0d,af009,34d96,25c0b,8e392,d1493,d669f,58ca4,89c4b,22006,7838f,17d55,6e4fd,e4924,6e438,1978a,92778,1e447,a79c0,b79d0,c79e0,c2ff4,a40d3,9c604,83512,17d01,8c817,86de7,fef40,79c12,3fa04,08491,3007d,1065a,4ab8e,8022a,85b11,362fd,485d5,9f173,b2c15,2bf69,567a4,91bfb,88326,fb25d,3c089,8fa4d,19daa,7573d,4c8fa,b7e75,f267b,e69a8,fdde3,f91d4,dc111,f8d43,aee9c,ce2ad,c9848,acdb7,f07f2,eda53,aa4f4,a5537,c50e6,ec83b,b631e,c7bc0,efc78,a3ee1,a684d,d8174,eaabe,fed38,d23f1,a4f5b,f46ad,c6219,aeec3,b6aee,a8ae3,e5f9e,a7c94,c5de4,b834b,ea81c,ff863,ce818,de69a,ec0c0,fcd0b";
4、实验爬虫测试
4.1 爬取前100道题并打印到控制台的Python代码
import requests
ExamCount = 1685;
ExamCodes = "02dec,0d977,02567,84832,3fd79,63ec6,bd93b,f1d94,8525d,dc736,fd969,601d1,8d481,6a5af,9e4bf,85990,96e73,c30ad,09f75,84f6f,3c384,2b592,39e8f,c575e,655f7,8778a,cba5a,df836,52913,3cdaa,bbae1,41c2f,3ba35,96b8e,527ca,4e150,1d5ca,3b40b,f6bfb,da8d6,e7d03,2a612,372cd,345bd,6e636,3bad3,6e1d1,9085f,581c3,5ca2e,bc28e,df99e,1798b,e1f87,11543,0b5ae,62fb9,f4a97,87e91,27071,ab37e,62dd9,9b782,923b2,a9c37,67c8f,550a2,02d0b,ab1b1,8bdd8,a4cc6,45ff2,f8d8e,e6b24,b263f,c79d1,b0a5e,8bf19,0a5d4,0146a,0f847,c8d7c,4ccf0,996f6,3f5c8,97f42,0092c,e39ab,80c79,4fba9,88f79,53a9c,b153d,43282,a2737,9e192,2ae9b,5e8f3,1af1d,908a5,0f560,d654f,07a67,e3cab,8c018,b65f5,d50e9,0eec6,a1b06,b8955,9fe2a,f41d8,c046f,8ea3f,8fcee,18b72,0d8da,0b105,7eb97,a190c,9f7d4,69c76,05016,4aa6c,d2dd5,42f37,88b97,86f88,5a227,57e0b,8ddfd,b59f9,ed2fb,31c18,8cb88,6d143,b0eb7,179be,b89c8,8ff26,2225d,a27ac,10d89,e02f1,f703f,128a1,c65cd,d70e2,06ec7,2827b,77849,9cab6,4855e,c6eec,dbb32,8bfea,bf8f2,581fd,6358c,0b05d,59908,df1fc,17d76,01ea3,991b0,8edc9,0f476,30d2e,cce31,1639c,059be,65ddf,4fac5,bffbd,e80c3,dbded,0beac,12eb5,440f9,39fe8,7e701,70b02,8afff,40d77,3b0fc,3c2be,8432f,eaaf6,c8188,ccc2b,41041,7d0ce,6d45d,05cc3,99729,1494e,0613c,e65b5,50de0,68905,749e8,c2c0f,8759a,b708c,fd962,34c8e,97370,f2824,554bd,c98cc,2bb47,454f5,18bc1,d790c,f5951,a1cd2,f9150,3f35b,9e042,05dde,edadb,27363,51bb7,67cd9,7d72c,3185e,bcbfb,6975e,93929,e0e77,f1fb9,df1a0,2c89d,da55f,c6e3e,22679,c205e,3d06f,3857d,5910e,ccda4,b0955,33d26,216ec,b36da,6bb2e,7daae,485e3,a6b53,a6565,acda3,394ec,1fd42,dbdb6,e9599,83a9a,d5a61,2c748,e0378,98478,e1824,921e2,30de9,0aa26,2c1e1,4f8d1,cfb12,f5287,3baa6,53544,40bed,e8aed,41e71,49277,ac554,6e510,e35c4,89ffa,f4c08,d6d44,353d7,dcbf0,8a7a7,88926,8fb61,e1efe,c1a4f,0fd13,ecb4d,b4051,2d545,cc0e9,45031,b2c67,10f52,0d295,c4976,17805,7dc86,a49d7,8dae5,146ea,fb755,c5053,a6be1,02d55,ead7a,b61cc,0b878,bc56c,d9ed7,f9601,92979,effab,bda94,d95e9,abfdf,17dd0,7b520,147b7,3ee5e,3f4ea,af85b,e2782,ccf76,ddfe3,a8500,ffc61,ccfd7,f1672,73f29,a339c,ce80e,fc93c,e93f2,233d9,61b7e,bc058,b5ab0,a5133,bc157,7a9a5,4ae6b,98c5d,28121,9d00f,67bd6,8720f,8dd28,8de9e,41388,2d2d9,44e5e,04032,dfb7b,6e2a2,80c67,893a5,6a227,3ff6b,aee0c,09bed,4f855,fefd6,73720,218cd,670a1,7d46f,39e04,da25f,da9e9,4f971,b7c9c,c6586,14c46,072f4,1421f,8bd96,e8f63,3f9cf,f1903,6e0d5,b0833,ed1cc,07a25,8bd03,8b78f,154d9,cacc0,c8ecd,b31b8,e4c6c,35c7b,eca2b,4d9d8,d70cb,34623,9617a,214c7,6fae0,ffa17,10a6b,79e7e,bbd55,5df53,94c41,a9d8e,98e15,66b2b,6a3e5,a2193,898ae,74e69,bc9c1,4a5b3,32f33,fecee,c2132,e5a56,1023c,8dbe2,f60c3,4ccc2,26435,c45de,f13cb,a950e,b59fa,36c43,ddd7e,6a944,d6dac,e5f45,02e80,8d3e3,b2697,60567,be57c,97cc9,629e1,32725,66649,93fad,8445a,52f86,f8c13,ab719,2fa27,fb1de,66b87,38b2d,7d9ae,10b65,f9331,606af,177f7,57f7c,c1cfb,839d5,4580a,7c0a4,4e7d9,42481,ed08c,81c71,e3c8f,bbcec,847fa,663fa,9cd64,7df8f,ebd6b,1ca8e,df491,2ee36,11346,164e0,b5fe8,a78a5,ee6ef,1095e,1bac1,35ee6,1e247,7c0be,a02d4,fd52c,36241,bdb21,30f8a,b5642,07081,f33f8,4d1d3,1e918,21535,9bf4e,8f0e0,476d1,31b40,6a3e7,f3685,c5599,8ba9a,c8db9,c20e5,dc36f,dd612,d3984,d62dc,daa6d,cd273,f56d8,b287a,af3a1,aafdd,afda3,f743c,d5a39,b15b4,d8b26,dbc91,fad47,e027f,bb686,cd3c7,ba65d,a1d98,f73cf,b9382,f22cd,dde16,f478c,f068b,cea30,fbc94,e5b7e,ec60a,b85e0,e8738,d0c10,d71ba,ad076,b08b1,c7ef0,e61c7,cbe0b,db127,be45b,cf0a9,d66c9,d90f9,deb39,f6c90,c46c0,d1c98,ec98b,dc306,ff8da,dd87e,a4472,bc436,d1428,cfa72,abf8b,a3a0f,f13d8,bfd01,f4571,da7d1,c99ad,d100b,bdab5,f52e2,b65fb,fda87,b016b,aea3c,b0c71,a4948,c6f0a,bd5be,afda7,b90ee,bad16,a11e0,fe7bc,d4ad0,f16bf,a077e,d1cc0,afb6b,a6e7f,e6e7c,c319c,a5691,eef6b,ce168,cf9f7,c4f90,f90f2,ac4cb,b0b8b,fe599,e6334,b34c0,b7bbb,e57eb,d5a15,ccc4b,cea42,ae845,ae205,b42c7,be7f5,fe7a8,dbdc2,b58f9,e0908,f0f03,bbda3,dd4da,b5700,e155c,a8dda,d7280,ca49b,bb0de,c6028,ab304,d33e4,f695d,f4cb6,dd447,bcfbd,aaf4d,d9978,ab965,f0a74,cf7dc,d2912,f2e6b,c4401,ef645,b4c8c,fd1f7,b71e2,fdd46,a8b27,b26ae,fb62e,b044d,b59a2,efc2c,f1ed3,e3e8b,ce166,a09f2,d257e,c3bd5,e8217,fece1,b3cca,b79a3,e06b9,f26ad,c7850,fbcee,f58e7,a2d58,d9c44,b0e26,a30ec,e6b25,e7898,fe4d7,eee5d,baf9d,fb650,bd31b,7ed55,51b33,4e901,2e726,faa36,95cbd,019e1,d8fc0,c8941,b4c9b,29934,1fe69,5bfaa,652c5,22fc3,f3559,daa75,5dab2,ae8b7,afc58,0a1e1,89f2f,b20ef,a75b5,58e01,7355e,b4ad5,bfd2d,f4041,74931,a4ab3,25e59,459b7,b4587,51168,9ebe0,a9d04,7fcbd,fc419,8ec58,e8ea0,2b963,75b55,5cbe8,33b74,c2245,5a465,bbe12,8ab8a,aaaad,a1d89,6d1df,58802,91ce6,42c91,4bdfc,d8fda,dab6d,a9f84,2428a,75d2f,e4804,af442,4c111,f3862,47008,79c95,fa2c1,b6987,ea07d,7aab8,ac3ab,a12d5,119b7,e2349,c8baa,91136,a78fb,e7cfa,9afe2,eb784,8db3c,5c525,cd5b8,5e42e,459a5,dcf68,0079e,865c9,37779,a6f72,ee4fa,e68e8,6848d,bd019,00428,e948a,59d1f,30284,80e48,cd63d,a8ac2,e5941,9be19,cd0e8,a0c58,91865,d57ff,baafc,dc354,50fd7,8dfac,18d69,7ff63,86a40,4a31c,6b35a,629ee,651f0,57379,80ef2,ce8f5,685a2,7e9f3,bef0e,241ef,ba267,a6227,b6368,ec007,095d8,ef885,cb564,31278,473f7,b1907,d6d84,6f189,5e84f,f2097,6e000,7e143,ea07a,60767,12bed,6ad66,35735,d0a64,30b06,00624,6d67a,f4472,07682,87d56,12250,5b34f,5d8fb,26468,81a32,e30a0,10813,052b5,60c8b,d2f6b,bc702,c0c67,f5304,9e1d1,4645d,52129,81ee4,b9c0f,78201,4b350,0c80a,49d2b,4aea3,41ba2,224fa,59f4a,0cc93,e88f7,ff8a3,11692,4c6b9,c89ea,675b6,0dc12,d6319,8c8ef,cdd6a,0c873,05796,5ea1b,830a8,f5a1d,3b20c,6d652,0b15e,55d48,6002b,35d61,cc269,8341a,7fdc8,36908,e6365,d17ab,54c8e,510d4,ca309,f35a7,994e8,c9409,e0247,c7af2,f569d,2bcc7,2b151,f2df4,42e64,0597c,d71f1,3e015,8f8c9,1d64f,95fc2,1e53c,3c180,39ef9,eac5d,78aff,a3f97,4ef4f,029f7,768c0,4684b,05ecf,b1b9e,485cd,75818,23bf9,aafb6,d4089,877a7,2a33c,74031,a30d3,d344d,83656,61ec8,34536,3c29a,86f18,27e7c,033e5,cd5b1,3f6d6,30115,1de22,50791,76d87,48172,e7424,0da57,70d0f,e6da6,6f23b,a3036,94ee1,931bd,4b642,37fe2,4a23e,52045,9f6b9,adf73,09bc9,95829,ba83d,eb1f7,68fb4,d5376,542d4,5458c,0ece5,1f3da,4912c,4c7a0,ff099,30490,08049,fdb07,34919,e1d38,e0a02,313d5,1b1a6,817ce,db169,f0275,36814,d120a,f107c,b545e,7233c,5a7b6,5f66f,1f1db,cb878,37796,94a14,e00ea,e2fc6,0c708,0c87f,fb550,724c3,6c477,a8621,0f280,47f92,f3181,6f82e,bc6be,723d4,830b4,ed289,30775,f3e7b,17955,d16b8,2086e,03de2,ff7ae,65e7f,3087e,9c2eb,56848,1274f,5314d,92eea,c230c,cb7a5,5b971,7bf6f,ebaea,10e81,03ce2,aa190,415be,fa068,07b04,32b13,35ab4,09d17,3bc19,03074,a1e3d,11dbb,03284,757ad,be050,b4715,fb5f0,f4532,cc289,e9c49,dd13e,f4212,ec509,e517e,cf6a2,f7b1b,fcd6c,e3998,b2025,ee11d,cc7a6,f43a3,c5223,e4190,a8c73,c53aa,c236f,ce6f4,c7414,b3f60,f5269,ba64d,eead5,e2995,bc421,e1bfb,aeea2,eb2ef,aa10f,ca1f8,e4811,bb615,b5e70,e4bd8,f86f4,be7f3,c3713,ba7e3,aa383,fa017,a8347,c657a,d1f49,c7beb,b3bda,c66cc,cfca2,2eaa5,fc42c,2b861,8a1fa,f3b7a,39117,833f6,46343,145c8,498f6,cd1b4,82729,e3bf1,c3b8b,4da8a,3bc18,62e7a,f9162,335c9,80520,1b468,d58be,a1889,79033,ae097,a777e,e353b,a778a,77b66,20dee,25caf,a7d77,86d7c,f1345,008da,08a95,cd313,59790,8922f,e725f,c1a09,9bf91,17a45,3d310,bd5a0,4bdab,f730d,23f56,7f074,4159f,dce58,bf822,c15e8,bccb0,6b182,79aa5,43faf,d8f06,07f3e,97665,6183e,cda6d,35789,b8a26,238c0,80cb4,7e387,08a3a,92233,ef513,c9a4c,d6e57,fcff5,5d209,0d19e,0cb3e,8e953,388fd,046cc,d1a91,d790b,04e39,b457a,81f6f,08d36,95624,d4180,b296d,141c7,9f301,3043a,6d753,d9d60,b5bd3,cd97e,e1ee2,6d664,4fbc8,5bddc,36e03,54ab2,e9da2,4f94f,03617,3d91c,f325f,cd94f,0f24d,29a0f,04fb8,6c7ee,68a5a,7392d,192c0,0c8ce,299b0,94429,bad10,7d2dd,ce94d,cd989,7e748,1ed7e,a746e,1eb97,a73a5,7fa2a,0d1e2,14f83,23520,14166,98e6e,e4e87,f8f05,6c961,fd49d,d92c3,3dd8f,4749b,fc569,b6e67,59e23,eaaba,4904b,e68db,d0f47,1d5b0,86d89,89301,a2eff,11bdc,4a8ad,bff1b,58a51,d9471,ae47a,43946,03512,f0afd,eb828,3ddfb,29fcd,5b32f,d0012,3ec5b,74417,f41a2,f2b36,e5ff7,c9b71,d2071,71c33,ad9e0,6a566,bb20e,7b626,ba719,28956,ad5a8,f2cf0,ebd1c,5ef26,aaddb,48e87,f6034,f25cd,116bd,087de,5611a,0b58c,0bb47,52868,9588c,dd61c,48ae6,50446,4d11d,fda5b,83949,c5d70,c28c2,729d0,39554,f006c,da5e4,be031,9af24,61d97,888e1,7d94f,29e6c,54eed,4fbc1,16c8e,557a6,4c137,c2c3a,aafb9,3398c,9b75f,bbc65,07787,52ebf,c6acf,853d4,a4471,c3309,ab06d,e50c6,781b5,d5473,2afa2,7c495,2b4d3,aa4fa,92638,3b61d,8f2ee,e5949,6b226,22e9c,5cba2,1536e,96863,3e0ad,bf897,53748,0649d,231fd,69db8,3125b,2d73b,59f0a,75253,0d2db,d39f1,319d5,15247,56df7,ffdb2,45229,f1e81,14d02,536f6,5a0ac,8b0a0,f4446,a2675,3cae1,d93ec,a302d,51ff9,81923,7e6e9,68fb5,267e7,a1afb,439f3,bae07,e277d,fe16c,89195,fa045,69410,38189,0752f,1f992,c7f6c,ef8b3,9826a,81c2d,6211d,660de,4860b,bacdf,8a6f1,872ad,46aeb,3cb76,62513,a4f81,530d9,cd369,c5cc8,a9bed,d06cb,ed719,c5ea9,b5225,cd52a,c1f19,af84c,c0d35,c95aa,a2c91,d0a22,abe98,cfb83,c3c0f,be257,da568,fb464,a734e,e89cf,ef5e5,e24d5,c3ed9,e1b9b,b2490,b7392,dc8e3,c024a,a1646,a84a9,bd639,ac40b,e0558,b7f2e,e79bb,e254b,f582c,a88fc,b6755,bfcf5,a34b8,bc160,a3909,c8529,b0c04,cfa5a,f5123,c49fc,f0409,be497,f8049,a288c,f89a8,bf9d7,b3747,d5073,da205,bdf05,ba86e,f88d6,e0a41,ec1b8,cc744,e27b1,fa2f0,d9213,fda06,f069d,b3fd1,e0d73,ae90b,fbc33,b7cea,f42f7,b308b,b9b19,c6916,e9a02,fd731,c2f43,a5d31,a381a,a429f,a64bf,e3f42,d9e4b,e4951,e8c07,c33b0,a0c56,adb87,bc392,ab982,bdc2a,c648c,acdf8,ea31c,a4f93,f78b9,c9f1e,e426f,efea2,dfc24,f064e,d7706,6a1bd,39449,54e4d,2e738,af179,ca0da,ee1da,d26b1,9df0e,b96b0,68834,30254,bf7dd,86dea,3a9e8,94598,94df9,f2e3f,28fa9,aa06a,6e363,c43b6,f93d4,a29ad,f7109,85197,d6f3f,1e624,355c4,be5fb,029f4,d5d6a,32fb5,46759,8bf77,3b5ad,d7bdc,cc6fa,900d2,16a25,3f564,c2128,02f95,fe151,99874,d4d11,3f2eb,9ae7e,a9480,40d08,2fa4c,859b1,74b70,daf04,cf855,aa924,f0083,d9005,fd398,71a6c,a3dee,73b03,cb0b6,b69bc,8d219,17b2f,e89ce,d10be,39a0c,dd9b8,c20d4,78a36,551a9,05d9c,46c54,4539c,109f3,a6bb1,c5c01,1d5ed,bb359,42b9c,c565f,a28db,1bb95,1b7d2,145d9,01e32,b4f0d,af009,34d96,25c0b,8e392,d1493,d669f,58ca4,89c4b,22006,7838f,17d55,6e4fd,e4924,6e438,1978a,92778,1e447,a79c0,b79d0,c79e0,c2ff4,a40d3,9c604,83512,17d01,8c817,86de7,fef40,79c12,3fa04,08491,3007d,1065a,4ab8e,8022a,85b11,362fd,485d5,9f173,b2c15,2bf69,567a4,91bfb,88326,fb25d,3c089,8fa4d,19daa,7573d,4c8fa,b7e75,f267b,e69a8,fdde3,f91d4,dc111,f8d43,aee9c,ce2ad,c9848,acdb7,f07f2,eda53,aa4f4,a5537,c50e6,ec83b,b631e,c7bc0,efc78,a3ee1,a684d,d8174,eaabe,fed38,d23f1,a4f5b,f46ad,c6219,aeec3,b6aee,a8ae3,e5f9e,a7c94,c5de4,b834b,ea81c,ff863,ce818,de69a,ec0c0,fcd0b";
ExamCodes = ExamCodes.split(',')
for i in range(0, 100):
ExamCodei=ExamCodes[i]
urlselecti = 'https://tkdata.mnks.cn/ExamData/'+ ExamCodei +'.json?CALL=?20201231143735.json' #选择题
responsei = requests.get(urlselecti,timeout=30)
resulti = responsei.json()
ExamTi = resulti['tm'].split('<br/>')
if(len(ExamTi) > 1):
print(str(i+1)+'、'+ExamTi[0] + ' 答案:' + resulti['da'] + '\n ' + ExamTi[1] + ' ' + ExamTi[2] + ' ' + ExamTi[3] + ' ' + ExamTi[4])
if (resulti['tv'] != ''):
ExamTiimg = resulti['tv'].split('/')
ExamTiimgurl = 'https://sucimg.itc.cn/sblog/' + ExamTiimg[2]
print(ExamTiimgurl)
else:
print(str(i+1)+'、'+resulti['tm'] + ' 答案:' + resulti['da'])
PyCharm中控制台运行结果如下:
4.2 爬取1685道题并写到word文档的Python代码
由于对该网站请求过多,会提示超过最大连接数导致超时等问题,建议分块或设置超时时间来避免,比如可先爬取200-300道题,只需要再for循环的range中设置即可。
import requests
import time
import urllib.request
import docx
#创建内存中的word文档对象
from docx.shared import Pt
from docx.enum.text import WD_PARAGRAPH_ALIGNMENT
def download_img(img_url,imgname):
request = urllib.request.Request(img_url)
try:
response = urllib.request.urlopen(request)
img_name = imgname+'.png'
filename = "D:\\PyCharm Community Edition 2020.3.1\\PycharmProjects\\Helloworld\\imgpath\\" + img_name
if (response.getcode() == 200):
with open(filename, "wb") as f:
f.write(response.read()) # 将内容写入图片
return filename
except:
return "failed"
ExamCount = 1685;
ExamCodes = "02dec,0d977,02567,84832,3fd79,63ec6,bd93b,f1d94,8525d,dc736,fd969,601d1,8d481,6a5af,9e4bf,85990,96e73,c30ad,09f75,84f6f,3c384,2b592,39e8f,c575e,655f7,8778a,cba5a,df836,52913,3cdaa,bbae1,41c2f,3ba35,96b8e,527ca,4e150,1d5ca,3b40b,f6bfb,da8d6,e7d03,2a612,372cd,345bd,6e636,3bad3,6e1d1,9085f,581c3,5ca2e,bc28e,df99e,1798b,e1f87,11543,0b5ae,62fb9,f4a97,87e91,27071,ab37e,62dd9,9b782,923b2,a9c37,67c8f,550a2,02d0b,ab1b1,8bdd8,a4cc6,45ff2,f8d8e,e6b24,b263f,c79d1,b0a5e,8bf19,0a5d4,0146a,0f847,c8d7c,4ccf0,996f6,3f5c8,97f42,0092c,e39ab,80c79,4fba9,88f79,53a9c,b153d,43282,a2737,9e192,2ae9b,5e8f3,1af1d,908a5,0f560,d654f,07a67,e3cab,8c018,b65f5,d50e9,0eec6,a1b06,b8955,9fe2a,f41d8,c046f,8ea3f,8fcee,18b72,0d8da,0b105,7eb97,a190c,9f7d4,69c76,05016,4aa6c,d2dd5,42f37,88b97,86f88,5a227,57e0b,8ddfd,b59f9,ed2fb,31c18,8cb88,6d143,b0eb7,179be,b89c8,8ff26,2225d,a27ac,10d89,e02f1,f703f,128a1,c65cd,d70e2,06ec7,2827b,77849,9cab6,4855e,c6eec,dbb32,8bfea,bf8f2,581fd,6358c,0b05d,59908,df1fc,17d76,01ea3,991b0,8edc9,0f476,30d2e,cce31,1639c,059be,65ddf,4fac5,bffbd,e80c3,dbded,0beac,12eb5,440f9,39fe8,7e701,70b02,8afff,40d77,3b0fc,3c2be,8432f,eaaf6,c8188,ccc2b,41041,7d0ce,6d45d,05cc3,99729,1494e,0613c,e65b5,50de0,68905,749e8,c2c0f,8759a,b708c,fd962,34c8e,97370,f2824,554bd,c98cc,2bb47,454f5,18bc1,d790c,f5951,a1cd2,f9150,3f35b,9e042,05dde,edadb,27363,51bb7,67cd9,7d72c,3185e,bcbfb,6975e,93929,e0e77,f1fb9,df1a0,2c89d,da55f,c6e3e,22679,c205e,3d06f,3857d,5910e,ccda4,b0955,33d26,216ec,b36da,6bb2e,7daae,485e3,a6b53,a6565,acda3,394ec,1fd42,dbdb6,e9599,83a9a,d5a61,2c748,e0378,98478,e1824,921e2,30de9,0aa26,2c1e1,4f8d1,cfb12,f5287,3baa6,53544,40bed,e8aed,41e71,49277,ac554,6e510,e35c4,89ffa,f4c08,d6d44,353d7,dcbf0,8a7a7,88926,8fb61,e1efe,c1a4f,0fd13,ecb4d,b4051,2d545,cc0e9,45031,b2c67,10f52,0d295,c4976,17805,7dc86,a49d7,8dae5,146ea,fb755,c5053,a6be1,02d55,ead7a,b61cc,0b878,bc56c,d9ed7,f9601,92979,effab,bda94,d95e9,abfdf,17dd0,7b520,147b7,3ee5e,3f4ea,af85b,e2782,ccf76,ddfe3,a8500,ffc61,ccfd7,f1672,73f29,a339c,ce80e,fc93c,e93f2,233d9,61b7e,bc058,b5ab0,a5133,bc157,7a9a5,4ae6b,98c5d,28121,9d00f,67bd6,8720f,8dd28,8de9e,41388,2d2d9,44e5e,04032,dfb7b,6e2a2,80c67,893a5,6a227,3ff6b,aee0c,09bed,4f855,fefd6,73720,218cd,670a1,7d46f,39e04,da25f,da9e9,4f971,b7c9c,c6586,14c46,072f4,1421f,8bd96,e8f63,3f9cf,f1903,6e0d5,b0833,ed1cc,07a25,8bd03,8b78f,154d9,cacc0,c8ecd,b31b8,e4c6c,35c7b,eca2b,4d9d8,d70cb,34623,9617a,214c7,6fae0,ffa17,10a6b,79e7e,bbd55,5df53,94c41,a9d8e,98e15,66b2b,6a3e5,a2193,898ae,74e69,bc9c1,4a5b3,32f33,fecee,c2132,e5a56,1023c,8dbe2,f60c3,4ccc2,26435,c45de,f13cb,a950e,b59fa,36c43,ddd7e,6a944,d6dac,e5f45,02e80,8d3e3,b2697,60567,be57c,97cc9,629e1,32725,66649,93fad,8445a,52f86,f8c13,ab719,2fa27,fb1de,66b87,38b2d,7d9ae,10b65,f9331,606af,177f7,57f7c,c1cfb,839d5,4580a,7c0a4,4e7d9,42481,ed08c,81c71,e3c8f,bbcec,847fa,663fa,9cd64,7df8f,ebd6b,1ca8e,df491,2ee36,11346,164e0,b5fe8,a78a5,ee6ef,1095e,1bac1,35ee6,1e247,7c0be,a02d4,fd52c,36241,bdb21,30f8a,b5642,07081,f33f8,4d1d3,1e918,21535,9bf4e,8f0e0,476d1,31b40,6a3e7,f3685,c5599,8ba9a,c8db9,c20e5,dc36f,dd612,d3984,d62dc,daa6d,cd273,f56d8,b287a,af3a1,aafdd,afda3,f743c,d5a39,b15b4,d8b26,dbc91,fad47,e027f,bb686,cd3c7,ba65d,a1d98,f73cf,b9382,f22cd,dde16,f478c,f068b,cea30,fbc94,e5b7e,ec60a,b85e0,e8738,d0c10,d71ba,ad076,b08b1,c7ef0,e61c7,cbe0b,db127,be45b,cf0a9,d66c9,d90f9,deb39,f6c90,c46c0,d1c98,ec98b,dc306,ff8da,dd87e,a4472,bc436,d1428,cfa72,abf8b,a3a0f,f13d8,bfd01,f4571,da7d1,c99ad,d100b,bdab5,f52e2,b65fb,fda87,b016b,aea3c,b0c71,a4948,c6f0a,bd5be,afda7,b90ee,bad16,a11e0,fe7bc,d4ad0,f16bf,a077e,d1cc0,afb6b,a6e7f,e6e7c,c319c,a5691,eef6b,ce168,cf9f7,c4f90,f90f2,ac4cb,b0b8b,fe599,e6334,b34c0,b7bbb,e57eb,d5a15,ccc4b,cea42,ae845,ae205,b42c7,be7f5,fe7a8,dbdc2,b58f9,e0908,f0f03,bbda3,dd4da,b5700,e155c,a8dda,d7280,ca49b,bb0de,c6028,ab304,d33e4,f695d,f4cb6,dd447,bcfbd,aaf4d,d9978,ab965,f0a74,cf7dc,d2912,f2e6b,c4401,ef645,b4c8c,fd1f7,b71e2,fdd46,a8b27,b26ae,fb62e,b044d,b59a2,efc2c,f1ed3,e3e8b,ce166,a09f2,d257e,c3bd5,e8217,fece1,b3cca,b79a3,e06b9,f26ad,c7850,fbcee,f58e7,a2d58,d9c44,b0e26,a30ec,e6b25,e7898,fe4d7,eee5d,baf9d,fb650,bd31b,7ed55,51b33,4e901,2e726,faa36,95cbd,019e1,d8fc0,c8941,b4c9b,29934,1fe69,5bfaa,652c5,22fc3,f3559,daa75,5dab2,ae8b7,afc58,0a1e1,89f2f,b20ef,a75b5,58e01,7355e,b4ad5,bfd2d,f4041,74931,a4ab3,25e59,459b7,b4587,51168,9ebe0,a9d04,7fcbd,fc419,8ec58,e8ea0,2b963,75b55,5cbe8,33b74,c2245,5a465,bbe12,8ab8a,aaaad,a1d89,6d1df,58802,91ce6,42c91,4bdfc,d8fda,dab6d,a9f84,2428a,75d2f,e4804,af442,4c111,f3862,47008,79c95,fa2c1,b6987,ea07d,7aab8,ac3ab,a12d5,119b7,e2349,c8baa,91136,a78fb,e7cfa,9afe2,eb784,8db3c,5c525,cd5b8,5e42e,459a5,dcf68,0079e,865c9,37779,a6f72,ee4fa,e68e8,6848d,bd019,00428,e948a,59d1f,30284,80e48,cd63d,a8ac2,e5941,9be19,cd0e8,a0c58,91865,d57ff,baafc,dc354,50fd7,8dfac,18d69,7ff63,86a40,4a31c,6b35a,629ee,651f0,57379,80ef2,ce8f5,685a2,7e9f3,bef0e,241ef,ba267,a6227,b6368,ec007,095d8,ef885,cb564,31278,473f7,b1907,d6d84,6f189,5e84f,f2097,6e000,7e143,ea07a,60767,12bed,6ad66,35735,d0a64,30b06,00624,6d67a,f4472,07682,87d56,12250,5b34f,5d8fb,26468,81a32,e30a0,10813,052b5,60c8b,d2f6b,bc702,c0c67,f5304,9e1d1,4645d,52129,81ee4,b9c0f,78201,4b350,0c80a,49d2b,4aea3,41ba2,224fa,59f4a,0cc93,e88f7,ff8a3,11692,4c6b9,c89ea,675b6,0dc12,d6319,8c8ef,cdd6a,0c873,05796,5ea1b,830a8,f5a1d,3b20c,6d652,0b15e,55d48,6002b,35d61,cc269,8341a,7fdc8,36908,e6365,d17ab,54c8e,510d4,ca309,f35a7,994e8,c9409,e0247,c7af2,f569d,2bcc7,2b151,f2df4,42e64,0597c,d71f1,3e015,8f8c9,1d64f,95fc2,1e53c,3c180,39ef9,eac5d,78aff,a3f97,4ef4f,029f7,768c0,4684b,05ecf,b1b9e,485cd,75818,23bf9,aafb6,d4089,877a7,2a33c,74031,a30d3,d344d,83656,61ec8,34536,3c29a,86f18,27e7c,033e5,cd5b1,3f6d6,30115,1de22,50791,76d87,48172,e7424,0da57,70d0f,e6da6,6f23b,a3036,94ee1,931bd,4b642,37fe2,4a23e,52045,9f6b9,adf73,09bc9,95829,ba83d,eb1f7,68fb4,d5376,542d4,5458c,0ece5,1f3da,4912c,4c7a0,ff099,30490,08049,fdb07,34919,e1d38,e0a02,313d5,1b1a6,817ce,db169,f0275,36814,d120a,f107c,b545e,7233c,5a7b6,5f66f,1f1db,cb878,37796,94a14,e00ea,e2fc6,0c708,0c87f,fb550,724c3,6c477,a8621,0f280,47f92,f3181,6f82e,bc6be,723d4,830b4,ed289,30775,f3e7b,17955,d16b8,2086e,03de2,ff7ae,65e7f,3087e,9c2eb,56848,1274f,5314d,92eea,c230c,cb7a5,5b971,7bf6f,ebaea,10e81,03ce2,aa190,415be,fa068,07b04,32b13,35ab4,09d17,3bc19,03074,a1e3d,11dbb,03284,757ad,be050,b4715,fb5f0,f4532,cc289,e9c49,dd13e,f4212,ec509,e517e,cf6a2,f7b1b,fcd6c,e3998,b2025,ee11d,cc7a6,f43a3,c5223,e4190,a8c73,c53aa,c236f,ce6f4,c7414,b3f60,f5269,ba64d,eead5,e2995,bc421,e1bfb,aeea2,eb2ef,aa10f,ca1f8,e4811,bb615,b5e70,e4bd8,f86f4,be7f3,c3713,ba7e3,aa383,fa017,a8347,c657a,d1f49,c7beb,b3bda,c66cc,cfca2,2eaa5,fc42c,2b861,8a1fa,f3b7a,39117,833f6,46343,145c8,498f6,cd1b4,82729,e3bf1,c3b8b,4da8a,3bc18,62e7a,f9162,335c9,80520,1b468,d58be,a1889,79033,ae097,a777e,e353b,a778a,77b66,20dee,25caf,a7d77,86d7c,f1345,008da,08a95,cd313,59790,8922f,e725f,c1a09,9bf91,17a45,3d310,bd5a0,4bdab,f730d,23f56,7f074,4159f,dce58,bf822,c15e8,bccb0,6b182,79aa5,43faf,d8f06,07f3e,97665,6183e,cda6d,35789,b8a26,238c0,80cb4,7e387,08a3a,92233,ef513,c9a4c,d6e57,fcff5,5d209,0d19e,0cb3e,8e953,388fd,046cc,d1a91,d790b,04e39,b457a,81f6f,08d36,95624,d4180,b296d,141c7,9f301,3043a,6d753,d9d60,b5bd3,cd97e,e1ee2,6d664,4fbc8,5bddc,36e03,54ab2,e9da2,4f94f,03617,3d91c,f325f,cd94f,0f24d,29a0f,04fb8,6c7ee,68a5a,7392d,192c0,0c8ce,299b0,94429,bad10,7d2dd,ce94d,cd989,7e748,1ed7e,a746e,1eb97,a73a5,7fa2a,0d1e2,14f83,23520,14166,98e6e,e4e87,f8f05,6c961,fd49d,d92c3,3dd8f,4749b,fc569,b6e67,59e23,eaaba,4904b,e68db,d0f47,1d5b0,86d89,89301,a2eff,11bdc,4a8ad,bff1b,58a51,d9471,ae47a,43946,03512,f0afd,eb828,3ddfb,29fcd,5b32f,d0012,3ec5b,74417,f41a2,f2b36,e5ff7,c9b71,d2071,71c33,ad9e0,6a566,bb20e,7b626,ba719,28956,ad5a8,f2cf0,ebd1c,5ef26,aaddb,48e87,f6034,f25cd,116bd,087de,5611a,0b58c,0bb47,52868,9588c,dd61c,48ae6,50446,4d11d,fda5b,83949,c5d70,c28c2,729d0,39554,f006c,da5e4,be031,9af24,61d97,888e1,7d94f,29e6c,54eed,4fbc1,16c8e,557a6,4c137,c2c3a,aafb9,3398c,9b75f,bbc65,07787,52ebf,c6acf,853d4,a4471,c3309,ab06d,e50c6,781b5,d5473,2afa2,7c495,2b4d3,aa4fa,92638,3b61d,8f2ee,e5949,6b226,22e9c,5cba2,1536e,96863,3e0ad,bf897,53748,0649d,231fd,69db8,3125b,2d73b,59f0a,75253,0d2db,d39f1,319d5,15247,56df7,ffdb2,45229,f1e81,14d02,536f6,5a0ac,8b0a0,f4446,a2675,3cae1,d93ec,a302d,51ff9,81923,7e6e9,68fb5,267e7,a1afb,439f3,bae07,e277d,fe16c,89195,fa045,69410,38189,0752f,1f992,c7f6c,ef8b3,9826a,81c2d,6211d,660de,4860b,bacdf,8a6f1,872ad,46aeb,3cb76,62513,a4f81,530d9,cd369,c5cc8,a9bed,d06cb,ed719,c5ea9,b5225,cd52a,c1f19,af84c,c0d35,c95aa,a2c91,d0a22,abe98,cfb83,c3c0f,be257,da568,fb464,a734e,e89cf,ef5e5,e24d5,c3ed9,e1b9b,b2490,b7392,dc8e3,c024a,a1646,a84a9,bd639,ac40b,e0558,b7f2e,e79bb,e254b,f582c,a88fc,b6755,bfcf5,a34b8,bc160,a3909,c8529,b0c04,cfa5a,f5123,c49fc,f0409,be497,f8049,a288c,f89a8,bf9d7,b3747,d5073,da205,bdf05,ba86e,f88d6,e0a41,ec1b8,cc744,e27b1,fa2f0,d9213,fda06,f069d,b3fd1,e0d73,ae90b,fbc33,b7cea,f42f7,b308b,b9b19,c6916,e9a02,fd731,c2f43,a5d31,a381a,a429f,a64bf,e3f42,d9e4b,e4951,e8c07,c33b0,a0c56,adb87,bc392,ab982,bdc2a,c648c,acdf8,ea31c,a4f93,f78b9,c9f1e,e426f,efea2,dfc24,f064e,d7706,6a1bd,39449,54e4d,2e738,af179,ca0da,ee1da,d26b1,9df0e,b96b0,68834,30254,bf7dd,86dea,3a9e8,94598,94df9,f2e3f,28fa9,aa06a,6e363,c43b6,f93d4,a29ad,f7109,85197,d6f3f,1e624,355c4,be5fb,029f4,d5d6a,32fb5,46759,8bf77,3b5ad,d7bdc,cc6fa,900d2,16a25,3f564,c2128,02f95,fe151,99874,d4d11,3f2eb,9ae7e,a9480,40d08,2fa4c,859b1,74b70,daf04,cf855,aa924,f0083,d9005,fd398,71a6c,a3dee,73b03,cb0b6,b69bc,8d219,17b2f,e89ce,d10be,39a0c,dd9b8,c20d4,78a36,551a9,05d9c,46c54,4539c,109f3,a6bb1,c5c01,1d5ed,bb359,42b9c,c565f,a28db,1bb95,1b7d2,145d9,01e32,b4f0d,af009,34d96,25c0b,8e392,d1493,d669f,58ca4,89c4b,22006,7838f,17d55,6e4fd,e4924,6e438,1978a,92778,1e447,a79c0,b79d0,c79e0,c2ff4,a40d3,9c604,83512,17d01,8c817,86de7,fef40,79c12,3fa04,08491,3007d,1065a,4ab8e,8022a,85b11,362fd,485d5,9f173,b2c15,2bf69,567a4,91bfb,88326,fb25d,3c089,8fa4d,19daa,7573d,4c8fa,b7e75,f267b,e69a8,fdde3,f91d4,dc111,f8d43,aee9c,ce2ad,c9848,acdb7,f07f2,eda53,aa4f4,a5537,c50e6,ec83b,b631e,c7bc0,efc78,a3ee1,a684d,d8174,eaabe,fed38,d23f1,a4f5b,f46ad,c6219,aeec3,b6aee,a8ae3,e5f9e,a7c94,c5de4,b834b,ea81c,ff863,ce818,de69a,ec0c0,fcd0b";
ExamCodes = ExamCodes.split(',')
file = docx.Document()
headers ={
'Connection': 'close'
}
for i in range(0, ExamCount):
ExamCodei=ExamCodes[i]
urlselecti = 'https://tkdata.mnks.cn/ExamData/'+ ExamCodei +'.json?CALL=?20201231143735.json' #选择题
responsei = requests.get(urlselecti, headers=headers,timeout=50,verify=False)
resulti = responsei.json()
ExamTi = resulti['tm'].split('<br/>')
if(len(ExamTi) > 1):
print(str(i+1)+'、'+ExamTi[0] + ' 答案:' + resulti['da'] + '\n ' + ExamTi[1] + ' ' + ExamTi[2] + ' ' + ExamTi[3] + ' ' + ExamTi[4])
file.add_paragraph(str(i+1)+'、'+ExamTi[0] + ' 答案:' + resulti['da'])
if (resulti['tv'] != ''):
ExamTiimg = resulti['tv'].split('/')
ExamTiimgurl = 'https://sucimg.itc.cn/sblog/' + ExamTiimg[2]
print(ExamTiimgurl)
download_img(ExamTiimgurl, ExamTiimg[2])
paragraph = file.add_paragraph() # 图片居中设置
paragraph.alignment = WD_PARAGRAPH_ALIGNMENT.CENTER
run = paragraph.add_run("")
run.add_picture("D:\\PyCharm Community Edition 2020.3.1\\PycharmProjects\\Helloworld\\imgpath\\" + ExamTiimg[2] + '.png', width=Pt(300))
file.add_paragraph(' '+ExamTi[1] + ' ' + ExamTi[2] + ' ' + ExamTi[3] + ' ' + ExamTi[4])
else:
print(str(i+1)+'、'+resulti['tm'] + ' 答案:' + resulti['da'])
file.add_paragraph(str(i+1)+'、'+resulti['tm'] + ' 答案:' + resulti['da'])
if (resulti['tv'] != ''):
ExamTiimg = resulti['tv'].split('/')
ExamTiimgurl = 'https://sucimg.itc.cn/sblog/' + ExamTiimg[2]
print(ExamTiimgurl)
download_img(ExamTiimgurl, ExamTiimg[2])
paragraph = file.add_paragraph() # 图片居中设置
paragraph.alignment = WD_PARAGRAPH_ALIGNMENT.CENTER
run = paragraph.add_run("")
run.add_picture("D:\\PyCharm Community Edition 2020.3.1\\PycharmProjects\\Helloworld\\imgpath\\" + ExamTiimg[2] + '.png', width=Pt(300))
#time.sleep(1)
file.save("D:\\PyCharm Community Edition 2020.3.1\\PycharmProjects\\Helloworld\\C1科目一1685题.docx") #保存
运行结果:
4.3 爬取题目解析的Python代码
题目注释url: https://tkdata.mnks.cn/ExamNote/’+ ExamCode +’.json?CALL=?20201231143735.json’
import json
import requests
ExamCount = 1685;
ExamCodes = "02dec,0d977,02567,84832,3fd79,63ec6,bd93b,f1d94,8525d,dc736,fd969,601d1,8d481,6a5af,9e4bf,85990,96e73,c30ad,09f75,84f6f,3c384,2b592,39e8f,c575e,655f7,8778a,cba5a,df836,52913,3cdaa,bbae1,41c2f,3ba35,96b8e,527ca,4e150,1d5ca,3b40b,f6bfb,da8d6,e7d03,2a612,372cd,345bd,6e636,3bad3,6e1d1,9085f,581c3,5ca2e,bc28e,df99e,1798b,e1f87,11543,0b5ae,62fb9,f4a97,87e91,27071,ab37e,62dd9,9b782,923b2,a9c37,67c8f,550a2,02d0b,ab1b1,8bdd8,a4cc6,45ff2,f8d8e,e6b24,b263f,c79d1,b0a5e,8bf19,0a5d4,0146a,0f847,c8d7c,4ccf0,996f6,3f5c8,97f42,0092c,e39ab,80c79,4fba9,88f79,53a9c,b153d,43282,a2737,9e192,2ae9b,5e8f3,1af1d,908a5,0f560,d654f,07a67,e3cab,8c018,b65f5,d50e9,0eec6,a1b06,b8955,9fe2a,f41d8,c046f,8ea3f,8fcee,18b72,0d8da,0b105,7eb97,a190c,9f7d4,69c76,05016,4aa6c,d2dd5,42f37,88b97,86f88,5a227,57e0b,8ddfd,b59f9,ed2fb,31c18,8cb88,6d143,b0eb7,179be,b89c8,8ff26,2225d,a27ac,10d89,e02f1,f703f,128a1,c65cd,d70e2,06ec7,2827b,77849,9cab6,4855e,c6eec,dbb32,8bfea,bf8f2,581fd,6358c,0b05d,59908,df1fc,17d76,01ea3,991b0,8edc9,0f476,30d2e,cce31,1639c,059be,65ddf,4fac5,bffbd,e80c3,dbded,0beac,12eb5,440f9,39fe8,7e701,70b02,8afff,40d77,3b0fc,3c2be,8432f,eaaf6,c8188,ccc2b,41041,7d0ce,6d45d,05cc3,99729,1494e,0613c,e65b5,50de0,68905,749e8,c2c0f,8759a,b708c,fd962,34c8e,97370,f2824,554bd,c98cc,2bb47,454f5,18bc1,d790c,f5951,a1cd2,f9150,3f35b,9e042,05dde,edadb,27363,51bb7,67cd9,7d72c,3185e,bcbfb,6975e,93929,e0e77,f1fb9,df1a0,2c89d,da55f,c6e3e,22679,c205e,3d06f,3857d,5910e,ccda4,b0955,33d26,216ec,b36da,6bb2e,7daae,485e3,a6b53,a6565,acda3,394ec,1fd42,dbdb6,e9599,83a9a,d5a61,2c748,e0378,98478,e1824,921e2,30de9,0aa26,2c1e1,4f8d1,cfb12,f5287,3baa6,53544,40bed,e8aed,41e71,49277,ac554,6e510,e35c4,89ffa,f4c08,d6d44,353d7,dcbf0,8a7a7,88926,8fb61,e1efe,c1a4f,0fd13,ecb4d,b4051,2d545,cc0e9,45031,b2c67,10f52,0d295,c4976,17805,7dc86,a49d7,8dae5,146ea,fb755,c5053,a6be1,02d55,ead7a,b61cc,0b878,bc56c,d9ed7,f9601,92979,effab,bda94,d95e9,abfdf,17dd0,7b520,147b7,3ee5e,3f4ea,af85b,e2782,ccf76,ddfe3,a8500,ffc61,ccfd7,f1672,73f29,a339c,ce80e,fc93c,e93f2,233d9,61b7e,bc058,b5ab0,a5133,bc157,7a9a5,4ae6b,98c5d,28121,9d00f,67bd6,8720f,8dd28,8de9e,41388,2d2d9,44e5e,04032,dfb7b,6e2a2,80c67,893a5,6a227,3ff6b,aee0c,09bed,4f855,fefd6,73720,218cd,670a1,7d46f,39e04,da25f,da9e9,4f971,b7c9c,c6586,14c46,072f4,1421f,8bd96,e8f63,3f9cf,f1903,6e0d5,b0833,ed1cc,07a25,8bd03,8b78f,154d9,cacc0,c8ecd,b31b8,e4c6c,35c7b,eca2b,4d9d8,d70cb,34623,9617a,214c7,6fae0,ffa17,10a6b,79e7e,bbd55,5df53,94c41,a9d8e,98e15,66b2b,6a3e5,a2193,898ae,74e69,bc9c1,4a5b3,32f33,fecee,c2132,e5a56,1023c,8dbe2,f60c3,4ccc2,26435,c45de,f13cb,a950e,b59fa,36c43,ddd7e,6a944,d6dac,e5f45,02e80,8d3e3,b2697,60567,be57c,97cc9,629e1,32725,66649,93fad,8445a,52f86,f8c13,ab719,2fa27,fb1de,66b87,38b2d,7d9ae,10b65,f9331,606af,177f7,57f7c,c1cfb,839d5,4580a,7c0a4,4e7d9,42481,ed08c,81c71,e3c8f,bbcec,847fa,663fa,9cd64,7df8f,ebd6b,1ca8e,df491,2ee36,11346,164e0,b5fe8,a78a5,ee6ef,1095e,1bac1,35ee6,1e247,7c0be,a02d4,fd52c,36241,bdb21,30f8a,b5642,07081,f33f8,4d1d3,1e918,21535,9bf4e,8f0e0,476d1,31b40,6a3e7,f3685,c5599,8ba9a,c8db9,c20e5,dc36f,dd612,d3984,d62dc,daa6d,cd273,f56d8,b287a,af3a1,aafdd,afda3,f743c,d5a39,b15b4,d8b26,dbc91,fad47,e027f,bb686,cd3c7,ba65d,a1d98,f73cf,b9382,f22cd,dde16,f478c,f068b,cea30,fbc94,e5b7e,ec60a,b85e0,e8738,d0c10,d71ba,ad076,b08b1,c7ef0,e61c7,cbe0b,db127,be45b,cf0a9,d66c9,d90f9,deb39,f6c90,c46c0,d1c98,ec98b,dc306,ff8da,dd87e,a4472,bc436,d1428,cfa72,abf8b,a3a0f,f13d8,bfd01,f4571,da7d1,c99ad,d100b,bdab5,f52e2,b65fb,fda87,b016b,aea3c,b0c71,a4948,c6f0a,bd5be,afda7,b90ee,bad16,a11e0,fe7bc,d4ad0,f16bf,a077e,d1cc0,afb6b,a6e7f,e6e7c,c319c,a5691,eef6b,ce168,cf9f7,c4f90,f90f2,ac4cb,b0b8b,fe599,e6334,b34c0,b7bbb,e57eb,d5a15,ccc4b,cea42,ae845,ae205,b42c7,be7f5,fe7a8,dbdc2,b58f9,e0908,f0f03,bbda3,dd4da,b5700,e155c,a8dda,d7280,ca49b,bb0de,c6028,ab304,d33e4,f695d,f4cb6,dd447,bcfbd,aaf4d,d9978,ab965,f0a74,cf7dc,d2912,f2e6b,c4401,ef645,b4c8c,fd1f7,b71e2,fdd46,a8b27,b26ae,fb62e,b044d,b59a2,efc2c,f1ed3,e3e8b,ce166,a09f2,d257e,c3bd5,e8217,fece1,b3cca,b79a3,e06b9,f26ad,c7850,fbcee,f58e7,a2d58,d9c44,b0e26,a30ec,e6b25,e7898,fe4d7,eee5d,baf9d,fb650,bd31b,7ed55,51b33,4e901,2e726,faa36,95cbd,019e1,d8fc0,c8941,b4c9b,29934,1fe69,5bfaa,652c5,22fc3,f3559,daa75,5dab2,ae8b7,afc58,0a1e1,89f2f,b20ef,a75b5,58e01,7355e,b4ad5,bfd2d,f4041,74931,a4ab3,25e59,459b7,b4587,51168,9ebe0,a9d04,7fcbd,fc419,8ec58,e8ea0,2b963,75b55,5cbe8,33b74,c2245,5a465,bbe12,8ab8a,aaaad,a1d89,6d1df,58802,91ce6,42c91,4bdfc,d8fda,dab6d,a9f84,2428a,75d2f,e4804,af442,4c111,f3862,47008,79c95,fa2c1,b6987,ea07d,7aab8,ac3ab,a12d5,119b7,e2349,c8baa,91136,a78fb,e7cfa,9afe2,eb784,8db3c,5c525,cd5b8,5e42e,459a5,dcf68,0079e,865c9,37779,a6f72,ee4fa,e68e8,6848d,bd019,00428,e948a,59d1f,30284,80e48,cd63d,a8ac2,e5941,9be19,cd0e8,a0c58,91865,d57ff,baafc,dc354,50fd7,8dfac,18d69,7ff63,86a40,4a31c,6b35a,629ee,651f0,57379,80ef2,ce8f5,685a2,7e9f3,bef0e,241ef,ba267,a6227,b6368,ec007,095d8,ef885,cb564,31278,473f7,b1907,d6d84,6f189,5e84f,f2097,6e000,7e143,ea07a,60767,12bed,6ad66,35735,d0a64,30b06,00624,6d67a,f4472,07682,87d56,12250,5b34f,5d8fb,26468,81a32,e30a0,10813,052b5,60c8b,d2f6b,bc702,c0c67,f5304,9e1d1,4645d,52129,81ee4,b9c0f,78201,4b350,0c80a,49d2b,4aea3,41ba2,224fa,59f4a,0cc93,e88f7,ff8a3,11692,4c6b9,c89ea,675b6,0dc12,d6319,8c8ef,cdd6a,0c873,05796,5ea1b,830a8,f5a1d,3b20c,6d652,0b15e,55d48,6002b,35d61,cc269,8341a,7fdc8,36908,e6365,d17ab,54c8e,510d4,ca309,f35a7,994e8,c9409,e0247,c7af2,f569d,2bcc7,2b151,f2df4,42e64,0597c,d71f1,3e015,8f8c9,1d64f,95fc2,1e53c,3c180,39ef9,eac5d,78aff,a3f97,4ef4f,029f7,768c0,4684b,05ecf,b1b9e,485cd,75818,23bf9,aafb6,d4089,877a7,2a33c,74031,a30d3,d344d,83656,61ec8,34536,3c29a,86f18,27e7c,033e5,cd5b1,3f6d6,30115,1de22,50791,76d87,48172,e7424,0da57,70d0f,e6da6,6f23b,a3036,94ee1,931bd,4b642,37fe2,4a23e,52045,9f6b9,adf73,09bc9,95829,ba83d,eb1f7,68fb4,d5376,542d4,5458c,0ece5,1f3da,4912c,4c7a0,ff099,30490,08049,fdb07,34919,e1d38,e0a02,313d5,1b1a6,817ce,db169,f0275,36814,d120a,f107c,b545e,7233c,5a7b6,5f66f,1f1db,cb878,37796,94a14,e00ea,e2fc6,0c708,0c87f,fb550,724c3,6c477,a8621,0f280,47f92,f3181,6f82e,bc6be,723d4,830b4,ed289,30775,f3e7b,17955,d16b8,2086e,03de2,ff7ae,65e7f,3087e,9c2eb,56848,1274f,5314d,92eea,c230c,cb7a5,5b971,7bf6f,ebaea,10e81,03ce2,aa190,415be,fa068,07b04,32b13,35ab4,09d17,3bc19,03074,a1e3d,11dbb,03284,757ad,be050,b4715,fb5f0,f4532,cc289,e9c49,dd13e,f4212,ec509,e517e,cf6a2,f7b1b,fcd6c,e3998,b2025,ee11d,cc7a6,f43a3,c5223,e4190,a8c73,c53aa,c236f,ce6f4,c7414,b3f60,f5269,ba64d,eead5,e2995,bc421,e1bfb,aeea2,eb2ef,aa10f,ca1f8,e4811,bb615,b5e70,e4bd8,f86f4,be7f3,c3713,ba7e3,aa383,fa017,a8347,c657a,d1f49,c7beb,b3bda,c66cc,cfca2,2eaa5,fc42c,2b861,8a1fa,f3b7a,39117,833f6,46343,145c8,498f6,cd1b4,82729,e3bf1,c3b8b,4da8a,3bc18,62e7a,f9162,335c9,80520,1b468,d58be,a1889,79033,ae097,a777e,e353b,a778a,77b66,20dee,25caf,a7d77,86d7c,f1345,008da,08a95,cd313,59790,8922f,e725f,c1a09,9bf91,17a45,3d310,bd5a0,4bdab,f730d,23f56,7f074,4159f,dce58,bf822,c15e8,bccb0,6b182,79aa5,43faf,d8f06,07f3e,97665,6183e,cda6d,35789,b8a26,238c0,80cb4,7e387,08a3a,92233,ef513,c9a4c,d6e57,fcff5,5d209,0d19e,0cb3e,8e953,388fd,046cc,d1a91,d790b,04e39,b457a,81f6f,08d36,95624,d4180,b296d,141c7,9f301,3043a,6d753,d9d60,b5bd3,cd97e,e1ee2,6d664,4fbc8,5bddc,36e03,54ab2,e9da2,4f94f,03617,3d91c,f325f,cd94f,0f24d,29a0f,04fb8,6c7ee,68a5a,7392d,192c0,0c8ce,299b0,94429,bad10,7d2dd,ce94d,cd989,7e748,1ed7e,a746e,1eb97,a73a5,7fa2a,0d1e2,14f83,23520,14166,98e6e,e4e87,f8f05,6c961,fd49d,d92c3,3dd8f,4749b,fc569,b6e67,59e23,eaaba,4904b,e68db,d0f47,1d5b0,86d89,89301,a2eff,11bdc,4a8ad,bff1b,58a51,d9471,ae47a,43946,03512,f0afd,eb828,3ddfb,29fcd,5b32f,d0012,3ec5b,74417,f41a2,f2b36,e5ff7,c9b71,d2071,71c33,ad9e0,6a566,bb20e,7b626,ba719,28956,ad5a8,f2cf0,ebd1c,5ef26,aaddb,48e87,f6034,f25cd,116bd,087de,5611a,0b58c,0bb47,52868,9588c,dd61c,48ae6,50446,4d11d,fda5b,83949,c5d70,c28c2,729d0,39554,f006c,da5e4,be031,9af24,61d97,888e1,7d94f,29e6c,54eed,4fbc1,16c8e,557a6,4c137,c2c3a,aafb9,3398c,9b75f,bbc65,07787,52ebf,c6acf,853d4,a4471,c3309,ab06d,e50c6,781b5,d5473,2afa2,7c495,2b4d3,aa4fa,92638,3b61d,8f2ee,e5949,6b226,22e9c,5cba2,1536e,96863,3e0ad,bf897,53748,0649d,231fd,69db8,3125b,2d73b,59f0a,75253,0d2db,d39f1,319d5,15247,56df7,ffdb2,45229,f1e81,14d02,536f6,5a0ac,8b0a0,f4446,a2675,3cae1,d93ec,a302d,51ff9,81923,7e6e9,68fb5,267e7,a1afb,439f3,bae07,e277d,fe16c,89195,fa045,69410,38189,0752f,1f992,c7f6c,ef8b3,9826a,81c2d,6211d,660de,4860b,bacdf,8a6f1,872ad,46aeb,3cb76,62513,a4f81,530d9,cd369,c5cc8,a9bed,d06cb,ed719,c5ea9,b5225,cd52a,c1f19,af84c,c0d35,c95aa,a2c91,d0a22,abe98,cfb83,c3c0f,be257,da568,fb464,a734e,e89cf,ef5e5,e24d5,c3ed9,e1b9b,b2490,b7392,dc8e3,c024a,a1646,a84a9,bd639,ac40b,e0558,b7f2e,e79bb,e254b,f582c,a88fc,b6755,bfcf5,a34b8,bc160,a3909,c8529,b0c04,cfa5a,f5123,c49fc,f0409,be497,f8049,a288c,f89a8,bf9d7,b3747,d5073,da205,bdf05,ba86e,f88d6,e0a41,ec1b8,cc744,e27b1,fa2f0,d9213,fda06,f069d,b3fd1,e0d73,ae90b,fbc33,b7cea,f42f7,b308b,b9b19,c6916,e9a02,fd731,c2f43,a5d31,a381a,a429f,a64bf,e3f42,d9e4b,e4951,e8c07,c33b0,a0c56,adb87,bc392,ab982,bdc2a,c648c,acdf8,ea31c,a4f93,f78b9,c9f1e,e426f,efea2,dfc24,f064e,d7706,6a1bd,39449,54e4d,2e738,af179,ca0da,ee1da,d26b1,9df0e,b96b0,68834,30254,bf7dd,86dea,3a9e8,94598,94df9,f2e3f,28fa9,aa06a,6e363,c43b6,f93d4,a29ad,f7109,85197,d6f3f,1e624,355c4,be5fb,029f4,d5d6a,32fb5,46759,8bf77,3b5ad,d7bdc,cc6fa,900d2,16a25,3f564,c2128,02f95,fe151,99874,d4d11,3f2eb,9ae7e,a9480,40d08,2fa4c,859b1,74b70,daf04,cf855,aa924,f0083,d9005,fd398,71a6c,a3dee,73b03,cb0b6,b69bc,8d219,17b2f,e89ce,d10be,39a0c,dd9b8,c20d4,78a36,551a9,05d9c,46c54,4539c,109f3,a6bb1,c5c01,1d5ed,bb359,42b9c,c565f,a28db,1bb95,1b7d2,145d9,01e32,b4f0d,af009,34d96,25c0b,8e392,d1493,d669f,58ca4,89c4b,22006,7838f,17d55,6e4fd,e4924,6e438,1978a,92778,1e447,a79c0,b79d0,c79e0,c2ff4,a40d3,9c604,83512,17d01,8c817,86de7,fef40,79c12,3fa04,08491,3007d,1065a,4ab8e,8022a,85b11,362fd,485d5,9f173,b2c15,2bf69,567a4,91bfb,88326,fb25d,3c089,8fa4d,19daa,7573d,4c8fa,b7e75,f267b,e69a8,fdde3,f91d4,dc111,f8d43,aee9c,ce2ad,c9848,acdb7,f07f2,eda53,aa4f4,a5537,c50e6,ec83b,b631e,c7bc0,efc78,a3ee1,a684d,d8174,eaabe,fed38,d23f1,a4f5b,f46ad,c6219,aeec3,b6aee,a8ae3,e5f9e,a7c94,c5de4,b834b,ea81c,ff863,ce818,de69a,ec0c0,fcd0b";
ExamCodes = ExamCodes.split(',')
for i in range(0, 1685):
ExamCodei=ExamCodes[i]
urlselecti = 'https://tkdata.mnks.cn/ExamNote/'+ ExamCodei +'.json?CALL=?20201231143735.json' #选择题
responsei = requests.get(urlselecti)
resultdata = json.loads(responsei.text, strict=False)
print(str(i+1),resultdata[0]['cnt'])
运行结果:
开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!
更多推荐
所有评论(0)